[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/impl/attribute/resolve...

noreply at shibboleth.net noreply at shibboleth.net
Sat Mar 1 19:36:40 EST 2014


Author: scantor
Date: Sat Mar  1 19:36:39 2014
New Revision: 5506

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5506&view=rev
Log:
Refactor storage-based transient generation and add new-style generators.

Added:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/StoredTransientIdGenerator.java   (with props)
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/TransientIdGenerator.java   (with props)
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/TransientSAML1NameIdentifierGenerator.java   (with props)
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/TransientSAML2NameIDGenerator.java   (with props)
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/StoredTransientSAML1NameIdentifierGeneratorTest.java   (with props)
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/StoredTransientSAML2NameIDGeneratorTest.java   (with props)
Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/attribute/resolver/TransientIdAttributeDefinition.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/attribute/resolver/TransientIdAttributeDefinitionTest.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/attribute/resolver/TransientIdAttributeDefinition.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/attribute/resolver/TransientIdAttributeDefinition.java?rev=5506&r1=5505&r2=5506&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/attribute/resolver/TransientIdAttributeDefinition.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/attribute/resolver/TransientIdAttributeDefinition.java Sat Mar  1 19:36:39 2014
@@ -28,117 +28,111 @@
 import net.shibboleth.idp.attribute.resolver.ResolutionException;
 import net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext;
 import net.shibboleth.idp.attribute.resolver.context.AttributeResolverWorkContext;
-import net.shibboleth.idp.saml.nameid.TransientIdParameters;
-import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.idp.saml.impl.nameid.StoredTransientIdGenerator;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 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 net.shibboleth.utilities.java.support.security.IdentifierGenerationStrategy;
-import net.shibboleth.utilities.java.support.security.RandomIdentifierGenerationStrategy;
 
 import org.opensaml.storage.StorageService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Strings;
+
 /**
- * An attribute definition that generates random identifiers useful for transient subject IDs. <br/>
- * Information about the created IDs are stored within a provided {@link StorageService}. The identifier itself is the
- * record key, and the value combines the principal name with the identifier of the recipient.
+ * An attribute definition that generates random identifiers useful for transient subject IDs.
+ * 
+ * <p>Information about the created IDs are stored within a provided {@link StorageService}. The identifier
+ * itself is the record key, and the value combines the principal name with the identifier of the recipient.</p>
  */
 public class TransientIdAttributeDefinition extends AbstractAttributeDefinition {
 
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(TransientIdAttributeDefinition.class);
 
-    /** Store used to map identifiers to principals. */
-    @NonnullAfterInit private StorageService idStore;
-
-    /** Generator of random, hex-encoded, identifiers. */
-    @NonnullAfterInit private IdentifierGenerationStrategy idGenerator;
-
-    /** Size, in bytes, of the token. */
-    private int idSize;
-
-    /** Length, in milliseconds, tokens are valid. */
-    private long idLifetime;
-
-    /**
-     * Constructor. Sets the defaults where required.
-     */
+    /** The actual implementation of the transient generation process. */
+    @Nonnull private final StoredTransientIdGenerator idGenerator;
+    
+    /** Constructor. */
     public TransientIdAttributeDefinition() {
-        idSize = 16;
-        idLifetime = 1000 * 60 * 60 * 4;
+        idGenerator = new StoredTransientIdGenerator();
     }
 
     /**
-     * Gets the ID store we are using.
-     * 
-     * @return the ID store we are using.
-     */
-    @NonnullAfterInit public StorageService getIdStore() {
-        return idStore;
-    }
-
-    /**

[... 191 lines stripped ...]


More information about the commits mailing list