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

noreply at shibboleth.net noreply at shibboleth.net
Sun Mar 16 15:55:05 EDT 2014


Author: scantor
Date: Sun Mar 16 15:55:04 2014
New Revision: 5591

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5591&view=rev
Log:
IDP-6 - unit test and fixes to new persistent ID generator

Added:
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGeneratorTest.java   (with props)
    trunk/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/nameid/
    trunk/idp-saml-impl/src/test/resources/net/shibboleth/idp/saml/impl/nameid/StoredIdStore.sql   (with props)
Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGenerator.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGenerator.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGenerator.java?rev=5591&r1=5590&r2=5591&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGenerator.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/nameid/PersistentSAML2NameIDGenerator.java Sun Mar 16 15:55:04 2014
@@ -143,7 +143,9 @@
     protected void doInitialize() throws ComponentInitializationException {
         super.doInitialize();
         
-        if (attributeSourceIds.isEmpty()) {
+        if (persistentIdStrategy == null) {
+            throw new ComponentInitializationException("PersistentIdGenerationStrategy cannot be null");
+        } else if (attributeSourceIds.isEmpty()) {
             throw new ComponentInitializationException("Attribute source ID list cannot be empty");
         }
     }
@@ -157,7 +159,7 @@
         Function<ProfileRequestContext,String> lookup = getDefaultIdPNameQualifierLookupStrategy();
         final String responderId = lookup != null ? lookup.apply(profileRequestContext) : null;
         if (responderId == null) {
-            log.debug("No responder identifier available, can't generate persistent ID");
+            log.debug("No responder identifier, can't generate persistent ID");
             return null;
         }
 
@@ -168,17 +170,21 @@
             relyingPartyId = lookup != null ? lookup.apply(profileRequestContext) : null;
         }
         if (relyingPartyId == null) {
-            log.debug("No relying party identifier available, can't generate persistent ID");
+            log.debug("No relying party identifier, can't generate persistent ID");
             return null;
         }
         
         final SubjectContext subjectCtx = subjectContextLookupStrategy.apply(profileRequestContext);
         if (subjectCtx == null || subjectCtx.getPrincipalName() == null) {
-            log.debug("No principal name available, can't generate persistent ID");
+            log.debug("No principal name, can't generate persistent ID");
             return null;
         }
         
         final AttributeContext attributeCtx = attributeContextLookupStrategy.apply(profileRequestContext);
+        if (attributeCtx == null) {
+            log.debug("No attribute context, can't generate persistent ID");
+            return null;
+        }
         
         final Map<String, IdPAttribute> attributes = attributeCtx.getIdPAttributes();
         for (final String sourceId : attributeSourceIds) {



More information about the commits mailing list