[java-idp-oidc] branch main updated: Fix NPE, and adjust handling of absent AttributeContext.
Scott Cantor
cantor.2 at osu.edu
Wed Mar 16 17:59:21 UTC 2022
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository java-idp-oidc.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-oidc.git;a=commit;h=b3a76ef73b97d1bce1c84f3533d3b52ff3ec873c
The following commit(s) were added to refs/heads/main by this push:
new b3a76ef7 Fix NPE, and adjust handling of absent AttributeContext.
b3a76ef7 is described below
commit b3a76ef73b97d1bce1c84f3533d3b52ff3ec873c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Mar 16 13:59:18 2022 -0400
Fix NPE, and adjust handling of absent AttributeContext.
---
.../oidc/op/profile/impl/SetConsentToResponseContext.java | 11 +++++------
.../oidc/op/profile/impl/SetConsentToResponseContextTest.java | 6 +++---
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetConsentToResponseContext.java b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetConsentToResponseContext.java
index 32158c4b..a2cc4a74 100644
--- a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetConsentToResponseContext.java
+++ b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetConsentToResponseContext.java
@@ -127,18 +127,17 @@ public class SetConsentToResponseContext extends AbstractOIDCResponseAction {
return false;
}
- if (!attributeCtx.isConsented() && !encodeConsentPredicate.test(profileRequestContext)) {
- log.debug("{} Consent is not being encoded into tokens, nothing to do", getLogPrefix());
- return false;
- }
-
attributeCtx = attributeContextLookupStrategy.apply(profileRequestContext);
if (attributeCtx == null) {
log.debug("{} No AttributeSubcontext available, nothing to do", getLogPrefix());
- ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
return false;
}
+ if (!attributeCtx.isConsented() && !encodeConsentPredicate.test(profileRequestContext)) {
+ log.debug("{} Consent is not being encoded into tokens, nothing to do", getLogPrefix());
+ return false;
+ }
+
return true;
}
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetConsentToResponseContextTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetConsentToResponseContextTest.java
index 4f85664b..bc7ef211 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetConsentToResponseContextTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetConsentToResponseContextTest.java
@@ -42,7 +42,7 @@ public class SetConsentToResponseContextTest extends BaseOIDCResponseActionTest
private AttributeContext attributeCtx;
- private void init(boolean encodeConsent, boolean consentEnabled) throws ComponentInitializationException {
+ private void init(final boolean encodeConsent, final boolean consentEnabled) throws ComponentInitializationException {
attributeCtx = new AttributeContext();
final Set<IdPAttribute> attributes = new HashSet<>();
attributes.add(new IdPAttribute("1"));
@@ -79,7 +79,7 @@ public class SetConsentToResponseContextTest extends BaseOIDCResponseActionTest
init(true, true);
profileRequestCtx.getSubcontext(RelyingPartyContext.class).removeSubcontext(AttributeContext.class);
final Event event = action.execute(requestCtx);
- ActionTestingSupport.assertEvent(event, EventIds.INVALID_PROFILE_CTX);
+ ActionTestingSupport.assertProceedEvent(event);
Assert.assertNull(respCtx.getSubcontext(OIDCAuthenticationResponseConsentContext.class, false));
}
@@ -106,7 +106,7 @@ public class SetConsentToResponseContextTest extends BaseOIDCResponseActionTest
init(true, true);
final Event event = action.execute(requestCtx);
ActionTestingSupport.assertProceedEvent(event);
- OIDCAuthenticationResponseConsentContext ctx =
+ final OIDCAuthenticationResponseConsentContext ctx =
respCtx.getSubcontext(OIDCAuthenticationResponseConsentContext.class, false);
Assert.assertNotNull(ctx);
Assert.assertTrue(ctx.getConsentedAttributes().contains("1"));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list