[java-opensaml COMMIT] in /trunk: opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/AbstractNameIdenti...

noreply at shibboleth.net noreply at shibboleth.net
Tue Jan 28 14:59:10 EST 2014


Author: scantor
Date: Tue Jan 28 14:59:10 2014
New Revision: 3580

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3580&view=rev
Log:
Add format parameter to NameIdentifierGenerator interface, needed for legacy NameIDEncoder support

Modified:
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/AbstractNameIdentifierGenerator.java
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/NameIdentifierGenerator.java
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/profile/SAML1NameIdentifierGenerator.java
    trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/saml2/profile/SAML2NameIDGenerator.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddNameIdentifierToSubjects.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AddNameIDToSubjects.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml1/profile/AbstractSAML1NameIdentifierGeneratorTest.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/saml2/profile/AbstractSAML2NameIDGeneratorTest.java

Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/AbstractNameIdentifierGenerator.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/AbstractNameIdentifierGenerator.java?rev=3580&r1=3579&r2=3580&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/AbstractNameIdentifierGenerator.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/AbstractNameIdentifierGenerator.java Tue Jan 28 14:59:10 2014
@@ -220,10 +220,13 @@
     
     /** {@inheritDoc} */
     @Override
-    @Nullable public NameIdType generate(@Nonnull final ProfileRequestContext profileRequestContext)
-            throws ProfileException {
+    @Nullable public NameIdType generate(@Nonnull final ProfileRequestContext profileRequestContext,
+            @Nonnull @NotEmpty final String theFormat) throws ProfileException {
         ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
         
+        if (!Objects.equal(format, theFormat)) {
+            throw new ProfileException("The format to generate does not match the value configured");
+        }
         return doGenerate(profileRequestContext);
     }
     
@@ -231,7 +234,6 @@
      * Override this method to fully control the generation process.
      * 
      * @param profileRequestContext current profile request context
-     * 
      * @return  the generated object
      * @throws ProfileException if an error occurs
      */
@@ -239,7 +241,7 @@
             throws ProfileException;
 
     /**
-     * Override this method to reuse this implementation of the {@link #doGenerate(ProfileRequestContext)} method,
+     * Override this method to reuse this implementation of {@link #doGenerate(ProfileRequestContext)},
      * and return the identifier to be included as the value of the eventual element.
      * 
      * @param profileRequestContext current profile request context

Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/NameIdentifierGenerator.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/NameIdentifierGenerator.java?rev=3580&r1=3579&r2=3580&view=diff
==============================================================================
--- trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/NameIdentifierGenerator.java (original)
+++ trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/common/profile/NameIdentifierGenerator.java Tue Jan 28 14:59:10 2014
@@ -19,6 +19,8 @@
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 
 import org.opensaml.profile.ProfileException;
 import org.opensaml.profile.context.ProfileRequestContext;
@@ -49,11 +51,12 @@
      * Generate an identifier object.
      * 
      * @param profileRequestContext the current profile request context
+     * @param format the identifier format to generate
      * 
      * @return  the identifier object, or null
      * @throws ProfileException if an error occurs while generating the identifier
      */
-    @Nullable NameIdType generate(@Nonnull final ProfileRequestContext profileRequestContext)
-        throws ProfileException;
+    @Nullable NameIdType generate(@Nonnull final ProfileRequestContext profileRequestContext,
+            @Nonnull @NotEmpty final String format) throws ProfileException;
     
 }

Modified: trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/profile/SAML1NameIdentifierGenerator.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-api/src/main/java/org/opensaml/saml/saml1/profile/SAML1NameIdentifierGenerator.java?rev=3580&r1=3579&r2=3580&view=diff

[... 162 lines stripped ...]


More information about the commits mailing list