Gracefully fail when source data from targeted ID is not available.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 29 Jul 2003 15:40:01 +0000 (15:40 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 29 Jul 2003 15:40:01 +0000 (15:40 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@708 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/attrresolv/provider/PersistentIDAttributeDefinition.java

index 939b3c7..fcf5bb4 100644 (file)
@@ -202,6 +202,15 @@ public class PersistentIDAttributeDefinition extends BaseAttributeDefinition imp
        public void resolve(ResolverAttribute attribute, Principal principal, String requester, Dependencies depends)
                throws ResolutionPlugInException {
                log.debug("Resolving attribute: (" + getId() + ")");
+               
+               if (requester == null || requester.equals("")) {
+                       log.debug("Could not create ID for unauthenticated requester.");
+                       attribute.setResolved();
+                       return;
+               }
+               
+               System.out.println(principal.getName() + requester);
+               
                String localId = null;
 
                //Resolve the correct local persistent identifier.
@@ -259,6 +268,12 @@ public class PersistentIDAttributeDefinition extends BaseAttributeDefinition imp
                        localId = principal.getName();
                }
 
+               if (localId == null || localId.equals("")) {
+                       log.error("Specified source data not supplied from dependencies.  Unable to create ID.");
+                       attribute.setResolved();
+                       return;
+               }
+
                if (lifeTime != -1) {
                        attribute.setLifetime(lifeTime);
                }