[java-identity-provider] branch master updated: Fix NPE when no SubjectContext exists.

Scott Cantor cantor.2 at osu.edu
Thu Oct 31 18:28:36 EDT 2019


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=5a80b2c62f9c9d6f00131635cfaa17f4bcea20c9

The following commit(s) were added to refs/heads/master by this push:
       new  5a80b2c   Fix NPE when no SubjectContext exists.
5a80b2c is described below

commit 5a80b2c62f9c9d6f00131635cfaa17f4bcea20c9
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Oct 31 18:28:29 2019 -0400

    Fix NPE when no SubjectContext exists.
---
 .../resolver/ad/impl/SubjectDerivedAttributeValuesFunction.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/SubjectDerivedAttributeValuesFunction.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/SubjectDerivedAttributeValuesFunction.java
index 96d9956..eebfcba 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/SubjectDerivedAttributeValuesFunction.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/impl/SubjectDerivedAttributeValuesFunction.java
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
 
 /**
  * A Function which returns {@link IdPAttributeValue}s derived from the {@link java.security.Principal}s
- * associated with the request.  The precise values are determined by an injected {@link Function}.
+ * associated with the request. The precise values are determined by an injected {@link Function}.
  */
 public class SubjectDerivedAttributeValuesFunction extends AbstractIdentifiableInitializableComponent implements
         Function<ProfileRequestContext,List<IdPAttributeValue>> {
@@ -101,6 +101,11 @@ public class SubjectDerivedAttributeValuesFunction extends AbstractIdentifiableI
     /** {@inheritDoc} */
     @Nullable public List<IdPAttributeValue> apply(@Nullable final ProfileRequestContext prc) {
         final SubjectContext cs = scLookupStrategy.apply(prc);
+        if (cs == null) {
+            log.debug("{} No SubjectContext returned from lookup strategy, no attribute resolved", getLogPrefix());
+            return null;
+        }
+        
         final List<IdPAttributeValue> results = new ArrayList<>();
 
         for (final Subject subject : cs.getSubjects()) {
@@ -126,7 +131,7 @@ public class SubjectDerivedAttributeValuesFunction extends AbstractIdentifiableI
      * @return a  consistent log prefix
      */
     private String getLogPrefix() {
-        return "SubjectDerivedAttributeDefinition" + getId();
+        return "SubjectDerivedAttributeDefinition " + getId();
     }
     
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list