[java-identity-provider COMMIT] in /trunk: idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernam...

noreply at shibboleth.net noreply at shibboleth.net
Mon Feb 22 10:53:10 EST 2016


Author: scantor
Date: Mon Feb 22 10:53:10 2016
New Revision: 8099

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8099&view=rev
Log:
IDP-925 - Dynamic determination of JAAS configuration and custom Principals

https://issues.shibboleth.net/jira/browse/IDP-925

Correct iteration to use derived list, and support strategy injection.

Modified:
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAAS.java
    trunk/idp-conf/src/main/resources/system/flows/authn/password-authn-beans.xml

Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAAS.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAAS.java?rev=8099&r1=8098&r2=8099&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAAS.java	(original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAAS.java	Mon Feb 22 10:53:10 2016
@@ -41,7 +41,6 @@
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.collection.Pair;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
-import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 import org.opensaml.profile.action.ActionSupport;
@@ -140,11 +139,14 @@
      * @param names list of JAAS application names to use
      */
     public void setLoginConfigurations(
-            @Nonnull @NonnullElements final Collection< Pair< String,Collection<Principal> > > names) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        Constraint.isNotNull(names, "Configuration list cannot be null");
-
-        loginConfigurations = new ArrayList<>(names);
+            @Nullable @NonnullElements final Collection< Pair< String,Collection<Principal> > > names) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+        if (names != null) {
+            loginConfigurations = new ArrayList<>(names);
+        } else {
+            loginConfigurations = Collections.emptyList();
+        }
     }
 
     /**
@@ -152,17 +154,20 @@
      * 
      * @param names list of JAAS application names to use
      */
-    public void setLoginConfigNames(@Nonnull @NonnullElements final Collection<String> names) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-        Constraint.isNotNull(names, "Configuration name list cannot be null");
-
-        loginConfigurations = new ArrayList<>(names.size());
-        for (final String name : names) {
-            final String trimmed = StringSupport.trimOrNull(name);
-            if (trimmed != null) {
-                loginConfigurations.add(
-                        new Pair<String,Collection<Principal>>(trimmed,Collections.<Principal>emptyList()));
-            }
+    public void setLoginConfigNames(@Nullable @NonnullElements final Collection<String> names) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+        if (names != null) {
+            loginConfigurations = new ArrayList<>(names.size());
+            for (final String name : names) {
+                final String trimmed = StringSupport.trimOrNull(name);
+                if (trimmed != null) {
+                    loginConfigurations.add(
+                            new Pair<String,Collection<Principal>>(trimmed,Collections.<Principal>emptyList()));
+                }
+            }
+        } else {
+            loginConfigurations = Collections.emptyList();
         }
     }
     
@@ -197,7 +202,7 @@
             return;
         }
         
-        for (final Pair< String,Collection<Principal> > loginConfig : loginConfigurations) {
+        for (final Pair< String,Collection<Principal> > loginConfig : configs) {
             try {
                 log.debug("{} Attempting to authenticate user '{}' via '{}'", getLogPrefix(),
                         getUsernamePasswordContext().getUsername(), loginConfig.getFirst());

Modified: trunk/idp-conf/src/main/resources/system/flows/authn/password-authn-beans.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/system/flows/authn/password-authn-beans.xml?rev=8099&r1=8098&r2=8099&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/system/flows/authn/password-authn-beans.xml	(original)
+++ trunk/idp-conf/src/main/resources/system/flows/authn/password-authn-beans.xml	Mon Feb 22 10:53:10 2016
@@ -55,7 +55,9 @@
     <bean id="ValidateUsernamePasswordAgainstJAAS"
             class="net.shibboleth.idp.authn.impl.ValidateUsernamePasswordAgainstJAAS" scope="prototype"

[... 9 lines stripped ...]


More information about the commits mailing list