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

noreply at shibboleth.net noreply at shibboleth.net
Wed Sep 9 00:38:59 EDT 2015


Author: scantor
Date: Wed Sep  9 00:38:59 2015
New Revision: 7735

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7735&view=rev
Log:
IDP-796 - Support storage and persistence of passwords as a private credential

Added:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AbstractUsernamePasswordValidationAction.java   (with props)
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/PasswordPrincipal.java   (with props)
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/principal/impl/PasswordPrincipalSerializer.java   (with props)
    trunk/idp-authn-impl/src/test/resources/data/net/shibboleth/idp/authn/impl/SealerKeyStore.jks   (with props)
    trunk/idp-authn-impl/src/test/resources/data/net/shibboleth/idp/authn/impl/SealerKeyStore.kver
Modified:
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstJAAS.java
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstKerberos.java
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/ValidateUsernamePasswordAgainstLDAP.java
    trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializerTest.java
    trunk/idp-conf/src/main/resources/system/conf/general-authn-system.xml

Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java?rev=7735&r1=7734&r2=7735&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java	(original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/DefaultAuthenticationResultSerializer.java	Wed Sep  9 00:38:59 2015
@@ -24,6 +24,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Set;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -72,6 +73,12 @@
     /** Field name of principal array. */
     @Nonnull @NotEmpty private static final String PRINCIPAL_ARRAY_FIELD = "princ";
 
+    /** Field name of public credentials array. */
+    @Nonnull @NotEmpty private static final String PUB_CREDS_ARRAY_FIELD = "pub";
+
+    /** Field name of private credentials array. */
+    @Nonnull @NotEmpty private static final String PRIV_CREDS_ARRAY_FIELD = "priv";
+
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(DefaultAuthenticationResultSerializer.class);
 
@@ -145,33 +152,33 @@
                     .write(AUTHN_INSTANT_FIELD, instance.getAuthenticationInstant())
                     .writeStartArray(PRINCIPAL_ARRAY_FIELD);
 
-            for (Principal p : instance.getSubject().getPrincipals()) {
-                boolean serialized = false;
-                for (PrincipalSerializer<String> serializer : principalSerializers) {
-                    if (serializer.supports(p)) {
-                        final JsonReader reader = readerFactory.createReader(new StringReader(serializer.serialize(p)));
-                        try {
-                            gen.write(reader.readObject());
-                        } finally {
-                            reader.close();
-                        }
-                        serialized = true;
-                    }
-                }
-                if (!serialized && genericSerializer.supports(p)) {
-                    final JsonReader reader =
-                            readerFactory.createReader(new StringReader(genericSerializer.serialize(p)));
-                    try {
-                        gen.write(reader.readObject());
-                    } finally {
-                        reader.close();
-                    }
-                }
+            for (final Principal p : instance.getSubject().getPrincipals()) {
+                serializePrincipal(gen, p);
+            }
+
+            gen.writeEnd();
+            
+            final Set<Principal> publicCreds = instance.getSubject().getPublicCredentials(Principal.class);
+            if (publicCreds != null && !publicCreds.isEmpty()) {
+                gen.writeStartArray(PUB_CREDS_ARRAY_FIELD);
+                for (final Principal p : publicCreds) {
+                    serializePrincipal(gen, p);
+                }
+                gen.writeEnd();
+            }
+
+            final Set<Principal> privateCreds = instance.getSubject().getPrivateCredentials(Principal.class);
+            if (privateCreds != null && !privateCreds.isEmpty()) {
+                gen.writeStartArray(PRIV_CREDS_ARRAY_FIELD);
+                for (final Principal p : privateCreds) {
+                    serializePrincipal(gen, p);
+                }

[... 784 lines stripped ...]


More information about the commits mailing list