[java-identity-provider] branch main updated: IDP-1597 Change of language incomplete when switching locale

Rod Widdowson rdw at steadingsoftware.com
Tue Sep 29 12:44:34 UTC 2020


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=8291fc056dedd5cddfca49e638337b8f9cb1dba8

The following commit(s) were added to refs/heads/main by this push:
       new  8291fc056 IDP-1597 Change of language incomplete when switching locale
8291fc056 is described below

commit 8291fc056dedd5cddfca49e638337b8f9cb1dba8
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Sep 29 13:30:00 2020 +0100

    IDP-1597 Change of language incomplete when switching locale
    
    https://issues.shibboleth.net/jira/browse/IDP-1597
    
    Use the "Spring-favoring" variant of getLanguageRange(HttpServletRequest).
---
 .../InitializeAdministrativeProfileContextTree.java |  4 ++--
 .../resources/net/shibboleth/idp/conf/mvc-beans.xml | 10 ++++++++++
 .../src/main/resources/conf/attribute-filter.xml    | 14 ++------------
 .../src/main/resources/conf/attribute-resolver.xml  | 19 +++++--------------
 idp-conf/src/main/resources/conf/global.xml         |  1 -
 idp-conf/src/main/resources/conf/idp.properties     |  4 ++--
 idp-conf/src/main/resources/conf/logback.xml        |  4 ++--
 idp-conf/src/main/resources/conf/relying-party.xml  |  2 +-
 idp-conf/src/test/resources/conf/relying-party.xml  | 21 ++++++++++-----------
 .../impl/AbstractAttributeDisplayFunction.java      |  4 ++--
 .../shibboleth/idp/ui/impl/SetRPUIInformation.java  |  4 ++--
 11 files changed, 38 insertions(+), 49 deletions(-)

diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTree.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTree.java
index c6043740f..720a58e40 100644
--- a/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTree.java
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTree.java
@@ -27,6 +27,7 @@ import org.opensaml.profile.context.ProfileRequestContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import net.shibboleth.ext.spring.util.SpringSupport;
 import net.shibboleth.idp.admin.AdministrativeFlowDescriptor;
 import net.shibboleth.idp.profile.AbstractProfileAction;
 import net.shibboleth.idp.profile.IdPEventIds;
@@ -34,7 +35,6 @@ import net.shibboleth.idp.profile.context.RelyingPartyContext;
 import net.shibboleth.idp.ui.context.RelyingPartyUIContext;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
-import net.shibboleth.utilities.java.support.net.HttpServletSupport;
 
 /**
  * An action that processes settings from a supplied {@link AdministrativeFlowDescriptor} to prepare
@@ -121,7 +121,7 @@ public class InitializeAdministrativeProfileContextTree extends AbstractProfileA
         
         final RelyingPartyUIContext uiCtx = rpCtx.getSubcontext(RelyingPartyUIContext.class, true);
         uiCtx.setRPUInfo(flowDescriptor.getUIInfo());
-        uiCtx.setBrowserLanguageRanges(HttpServletSupport.getLanguageRange(getHttpServletRequest()));
+        uiCtx.setBrowserLanguageRanges(SpringSupport.getLanguageRange(getHttpServletRequest()));
         
         if (null != fallbackLanguages) {
             uiCtx.setFallbackLanguages(fallbackLanguages);
diff --git a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/mvc-beans.xml b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/mvc-beans.xml
index 9b5e68e6d..79466d712 100644
--- a/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/mvc-beans.xml
+++ b/idp-conf-impl/src/main/resources/net/shibboleth/idp/conf/mvc-beans.xml
@@ -23,6 +23,16 @@
             </list>
         </property>
     </bean>
+        <mvc:interceptors xmlns:mvc="http://www.springframework.org/schema/mvc">
+  <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
+    <property name="paramName" value="lang"/>
+  </bean>
+</mvc:interceptors>
+<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
+  <property name="defaultLocale" value="en"/>
+</bean>
+
+    
     
     <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping" p:order="0"
             p:flowRegistry-ref="flowRegistry">
diff --git a/idp-conf/src/main/resources/conf/attribute-filter.xml b/idp-conf/src/main/resources/conf/attribute-filter.xml
index 7787d0c53..36ede7340 100644
--- a/idp-conf/src/main/resources/conf/attribute-filter.xml
+++ b/idp-conf/src/main/resources/conf/attribute-filter.xml
@@ -21,19 +21,9 @@
 	<AttributeFilterPolicy id="Per-Attribute-singleValued">
 	    <PolicyRequirementRule xsi:type="ANY" />
 	 
-	    <AttributeRule attributeID="eduPersonPrincipalName">
-	        <PermitValueRule xsi:type="EntityAttributeExactMatch"
-	            attributeName="http://shibboleth.net/ns/attributes/releaseAllValues"
-	            attributeNameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
-	            attributeValue="eduPersonPrincipalName" />
-	    </AttributeRule>
+	    <AttributeRule attributeID="eduPersonPrincipalName" permitAny="true"/> 
 	 
-	    <AttributeRule attributeID="mail">
-	        <PermitValueRule xsi:type="EntityAttributeExactMatch"
-	            attributeName="http://shibboleth.net/ns/attributes/releaseAllValues"
-	            attributeNameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
-	            attributeValue="mail" />
-	    </AttributeRule>
+	    <AttributeRule attributeID="mail" permitAny="true"/> 
 	</AttributeFilterPolicy>
 
     <!--
diff --git a/idp-conf/src/main/resources/conf/attribute-resolver.xml b/idp-conf/src/main/resources/conf/attribute-resolver.xml
index 0ee236be2..95ceff72e 100644
--- a/idp-conf/src/main/resources/conf/attribute-resolver.xml
+++ b/idp-conf/src/main/resources/conf/attribute-resolver.xml
@@ -1,18 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- 
-    This file is an EXAMPLE configuration file. While the configuration
-    presented in this example file is semi-functional, it isn't very
-    interesting. It is here only as a starting point for your deployment
-    process.
-    
-    Very few attribute definitions and data connectors are demonstrated,
-    and the data is derived statically from the logged-in username and a
-    static example connector.
-
-    Attribute-resolver-full.xml contains more examples of attributes,
-    encoders, and data connectors. Deployers should refer to the Shibboleth
-    documentation for a complete list of components and their options.
--->
+<!-- This file is an EXAMPLE configuration file. While the configuration presented in this example file is semi-functional, 
+    it isn't very interesting. It is here only as a starting point for your deployment process. Very few attribute definitions 
+    and data connectors are demonstrated, and the data is derived statically from the logged-in username and a static example 
+    connector. Attribute-resolver-full.xml contains more examples of attributes, encoders, and data connectors. Deployers should 
+    refer to the Shibboleth documentation for a complete list of components and their options. -->
 <AttributeResolver
         xmlns="urn:mace:shibboleth:2.0:resolver" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
diff --git a/idp-conf/src/main/resources/conf/global.xml b/idp-conf/src/main/resources/conf/global.xml
index c485f3f65..688f86f78 100644
--- a/idp-conf/src/main/resources/conf/global.xml
+++ b/idp-conf/src/main/resources/conf/global.xml
@@ -33,7 +33,6 @@
     <util:set id="shibboleth.ExcludedEncryptionAlgorithms">
     </util:set>
     -->
-
     <!--
     If you need to define and inject custom Java object(s) into the various views used throughout the
     system (errors, login, logout, etc.), you can uncomment and define the bean below to be of any
diff --git a/idp-conf/src/main/resources/conf/idp.properties b/idp-conf/src/main/resources/conf/idp.properties
index c42c09d68..935700a24 100644
--- a/idp-conf/src/main/resources/conf/idp.properties
+++ b/idp-conf/src/main/resources/conf/idp.properties
@@ -128,7 +128,7 @@ idp.session.secondaryServiceIndex = true
 #idp.session.defaultSPlifetime = PT2H
 
 # Set to "shibboleth.StorageService" or custom bean for alternate storage of consent
-#idp.consent.StorageService = shibboleth.ClientPersistentStorageService
+idp.consent.StorageService = shibboleth.ClientPersistentStorageService
 
 # Default consent auditing formats
 #idp.consent.terms-of-use.auditFormat = %T|%SP|%e|%u|%CCI|%CCV|%CCA
@@ -146,7 +146,7 @@ idp.session.secondaryServiceIndex = true
 #idp.consent.terms-of-use.consentValueMessageCodeSuffix = .text
 
 # Flags controlling how built-in attribute consent feature operates 
-#idp.consent.allowDoNotRemember = true
+idp.consent.allowDoNotRemember = true
 #idp.consent.allowGlobal = true
 #idp.consent.allowPerAttribute = false
 
diff --git a/idp-conf/src/main/resources/conf/logback.xml b/idp-conf/src/main/resources/conf/logback.xml
index 730f583bc..79b29c7a8 100644
--- a/idp-conf/src/main/resources/conf/logback.xml
+++ b/idp-conf/src/main/resources/conf/logback.xml
@@ -14,14 +14,14 @@
 
     <!-- Location and retention. -->
     
-    <variable name="idp.logfiles" value="${idp.logfiles:-${idp.home}/logs}" />
+    <variable name="idp.logfiles" value="C:/Users/rdw/Desktop/logs" />
     <variable name="idp.loghistory" value="${idp.loghistory:-180}" />
     
     <!-- Much higher performance if you operate on DEBUG. -->
     <!-- <variable name="idp.process.appender" value="ASYNC_PROCESS" /> -->
     
     <!-- Logging level shortcuts. -->
-    <variable name="idp.loglevel.idp" value="${idp.loglevel.idp:-INFO}" />
+    <variable name="idp.loglevel.idp" value="${idp.loglevel.idp:-DEBUG}" />
     <variable name="idp.loglevel.ldap" value="${idp.loglevel.ldap:-WARN}" />
     <variable name="idp.loglevel.messages" value="${idp.loglevel.messages:-INFO}" />
     <variable name="idp.loglevel.encryption" value="${idp.loglevel.encryption:-INFO}" />
diff --git a/idp-conf/src/main/resources/conf/relying-party.xml b/idp-conf/src/main/resources/conf/relying-party.xml
index 9072d3310..f81b0996a 100644
--- a/idp-conf/src/main/resources/conf/relying-party.xml
+++ b/idp-conf/src/main/resources/conf/relying-party.xml
@@ -40,7 +40,7 @@
                 <ref bean="SAML1.AttributeQuery" />
                 <ref bean="SAML1.ArtifactResolution" />
                 -->
-                <bean parent="SAML2.SSO" p:postAuthenticationFlows="attribute-release" />
+                <bean parent="SAML2.SSO" p:postAuthenticationFlows="attribute-release" p:encryptAssertions="false" p:encryptAttributes="false"/>
                 <ref bean="SAML2.ECP" />
                 <ref bean="SAML2.Logout" />
                 <!--
diff --git a/idp-conf/src/test/resources/conf/relying-party.xml b/idp-conf/src/test/resources/conf/relying-party.xml
index f46789624..e4038eee7 100644
--- a/idp-conf/src/test/resources/conf/relying-party.xml
+++ b/idp-conf/src/test/resources/conf/relying-party.xml
@@ -30,19 +30,18 @@
 
     <!-- Default configuration, with default settings applied for all profiles. -->
 
-    <bean id="shibboleth.DefaultRelyingParty" parent="RelyingParty.MDDriven">
+    <bean id="shibboleth.DefaultRelyingParty" parent="RelyingParty">
         <property name="profileConfigurations">
             <list>
-                <ref bean="CAS.LoginConfiguration.MDDriven" />
-                <ref bean="CAS.ValidateConfiguration.MDDriven" />
-                <ref bean="Shibboleth.SSO.MDDriven" />
-                <ref bean="SAML1.AttributeQuery.MDDriven" />
-                <ref bean="SAML1.ArtifactResolution.MDDriven" />
-                <ref bean="SAML2.SSO.MDDriven" />
-                <ref bean="SAML2.ECP.MDDriven" />
-                <ref bean="SAML2.Logout.MDDriven" />
-                <ref bean="SAML2.AttributeQuery.MDDriven" />
-                <ref bean="SAML2.ArtifactResolution.MDDriven" />
+                <bean parent="Shibboleth.SSO" p:postAuthenticationFlows="attribute-release" />
+                <ref bean="SAML1.AttributeQuery" />
+                <ref bean="SAML1.ArtifactResolution" />
+                <bean parent="SAML2.SSO" p:postAuthenticationFlows="attribute-release" p:encryptAssertions="false" p:encryptAttributes="false"/>
+                <ref bean="SAML2.ECP" />
+                <ref bean="SAML2.Logout" />
+                <ref bean="SAML2.AttributeQuery" />
+                <ref bean="SAML2.ArtifactResolution" />
+                <ref bean="Liberty.SSOS" />
             </list>
         </property>
     </bean>
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AbstractAttributeDisplayFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AbstractAttributeDisplayFunction.java
index d6798e908..c3714626f 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AbstractAttributeDisplayFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AbstractAttributeDisplayFunction.java
@@ -29,9 +29,9 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.servlet.http.HttpServletRequest;
 
+import net.shibboleth.ext.spring.util.SpringSupport;
 import net.shibboleth.idp.attribute.IdPAttribute;
 import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
-import net.shibboleth.utilities.java.support.net.HttpServletSupport;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 /**
@@ -57,7 +57,7 @@ public abstract class AbstractAttributeDisplayFunction implements Function<IdPAt
     public AbstractAttributeDisplayFunction(@Nonnull final HttpServletRequest request,
             @Nullable final List<String> defaultLanguages) {
 
-        languageRange = HttpServletSupport.getLanguageRange(request);
+        languageRange = SpringSupport.getLanguageRange(request);
         if (defaultLanguages == null || defaultLanguages.isEmpty()) {
             defaultLanguageRange = Collections.emptyList();
         } else {
diff --git a/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java b/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java
index 61763549b..10675aa2b 100644
--- a/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java
+++ b/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java
@@ -39,6 +39,7 @@ import org.opensaml.saml.saml2.metadata.SPSSODescriptor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import net.shibboleth.ext.spring.util.SpringSupport;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.profile.AbstractProfileAction;
 import net.shibboleth.idp.saml.profile.context.navigate.SAMLMetadataContextLookupFunction;
@@ -46,7 +47,6 @@ import net.shibboleth.idp.ui.context.RelyingPartyUIContext;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.logic.Constraint;
-import net.shibboleth.utilities.java.support.net.HttpServletSupport;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 /**
@@ -213,7 +213,7 @@ public class SetRPUIInformation extends AbstractProfileAction {
         rpUIContext.setRPSPSSODescriptor(spSSODescriptor);
         rpUIContext.setRPAttributeConsumingService(acsDesriptor);
         rpUIContext.setRPUInfo(getRPUInfo());
-        rpUIContext.setBrowserLanguageRanges(HttpServletSupport.getLanguageRange(getHttpServletRequest()));
+        rpUIContext.setBrowserLanguageRanges(SpringSupport.getLanguageRange(getHttpServletRequest()));
     }
 
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list