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

noreply at shibboleth.net noreply at shibboleth.net
Fri Dec 20 00:21:00 EST 2013


Author: scantor
Date: Fri Dec 20 00:21:00 2013
New Revision: 5068

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5068&view=rev
Log:
- Synchronize questionable Json methods in PrincipalSerializers
- Make PrincipalSerializer an InitializableComponent

Added:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/AbstractPrincipalSerializer.java   (with props)
Modified:
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationFlowDescriptor.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/DefaultAuthenticationResultSerializer.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/GenericPrincipalSerializer.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/PrincipalSerializer.java
    trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/principal/UsernamePrincipalSerializer.java
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/principal/LdapPrincipalSerializer.java

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationFlowDescriptor.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationFlowDescriptor.java?rev=5068&r1=5067&r2=5068&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationFlowDescriptor.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/AuthenticationFlowDescriptor.java Fri Dec 20 00:21:00 2013
@@ -40,6 +40,7 @@
 import net.shibboleth.utilities.java.support.annotation.constraint.Positive;
 import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
 import net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.component.IdentifiableComponent;
 import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -345,5 +346,10 @@
         STORAGE_EXPIRATION_OFFSET = 10 * 60 * 1000;
         DEFAULT_SUBJECT_C14N_FLOWID = "SubjectC14N/Simple";
         DEFAULT_SERIALIZER = new DefaultAuthenticationResultSerializer();
+        try {
+            DEFAULT_SERIALIZER.initialize();
+        } catch (ComponentInitializationException e) {
+            // TODO: not sure how to handle 
+        }
     }
 }

Modified: trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/DefaultAuthenticationResultSerializer.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/DefaultAuthenticationResultSerializer.java?rev=5068&r1=5067&r2=5068&view=diff
==============================================================================
--- trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/DefaultAuthenticationResultSerializer.java (original)
+++ trunk/idp-authn-api/src/main/java/net/shibboleth/idp/authn/DefaultAuthenticationResultSerializer.java Fri Dec 20 00:21:00 2013
@@ -44,6 +44,7 @@
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.component.AbstractInitializableComponent;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
 
 import org.opensaml.storage.StorageSerializer;
@@ -90,9 +91,7 @@
         generatorFactory = Json.createGeneratorFactory(null);
         readerFactory = Json.createReaderFactory(null);
         
-        principalSerializers =
-                Collections.<PrincipalSerializer<String>>singletonList(new UsernamePrincipalSerializer());
-        
+        principalSerializers = Collections.emptyList();
         genericSerializer = new GenericPrincipalSerializer();
     }
 
@@ -117,10 +116,26 @@
     @Nonnull public GenericPrincipalSerializer getGenericPrincipalSerializer() {
         return genericSerializer;
     }
+    
+    /** {@inheritDoc} */
+    @Override
+    public void doInitialize() throws ComponentInitializationException {
+        super.doInitialize();
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
+        genericSerializer.initialize();
+        
+        if (principalSerializers.isEmpty()) {
+            PrincipalSerializer<String> ups = new UsernamePrincipalSerializer();
+            ups.initialize();
+            principalSerializers = Collections.singletonList(ups);
+        }
+    }
 
     /** {@inheritDoc} */
     @Nonnull @NotEmpty public String serialize(@Nonnull final AuthenticationResult instance) throws IOException {
-
+        ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
+        
         try {

[... 405 lines stripped ...]


More information about the commits mailing list