[java-idp-plugin-oidc-rp] branch main updated: Improve class hierarchy for authn response actions

Phil Smart philip.smart at jisc.ac.uk
Wed Apr 26 09:59:14 UTC 2023


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

philsmart pushed a commit to branch main
in repository java-idp-plugin-oidc-rp.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-oidc-rp.git;a=commit;h=520cd9ba0dffd9ad5ca81db6406c280629d39410

The following commit(s) were added to refs/heads/main by this push:
     new 520cd9b  Improve class hierarchy for authn response actions
520cd9b is described below

commit 520cd9ba0dffd9ad5ca81db6406c280629d39410
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Apr 26 10:59:12 2023 +0100

    Improve class hierarchy for authn response actions
---
 .../oidc/rp/encoding/impl/AbstractRequestEncoderFunction.java      | 6 ++++++
 .../authn/oidc/rp/impl/AbstractHttpOIDCAuthenticationAction.java   | 2 ++
 .../oidc/rp/impl/AbstractOIDCAuthenticationResponseAction.java     | 2 +-
 .../idp/plugin/authn/oidc/rp/impl/ProcessEndUserClaims.java        | 7 ++++++-
 .../authn/oidc/rp/impl/ValidateOAuthAccessTokenResponse.java       | 3 ++-
 .../idp/plugin/authn/oidc/rp/impl/ValidateTokenClaims.java         | 3 ++-
 6 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/encoding/impl/AbstractRequestEncoderFunction.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/encoding/impl/AbstractRequestEncoderFunction.java
index bad8f72..ffb65e1 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/encoding/impl/AbstractRequestEncoderFunction.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/encoding/impl/AbstractRequestEncoderFunction.java
@@ -145,6 +145,12 @@ public abstract class AbstractRequestEncoderFunction extends AbstractInitializab
         return providerMetadataContext;
     }
 
+    /**
+     * {@inheritDoc}
+     * 
+     * <p>Creates the HTTP request. Any error in creating the request should return {@code null} to indicate 
+     * failure.</p>
+     */
     @Override
     @Nullable public HttpUriRequest apply(@Nonnull final ProfileRequestContext profileRequestContext) {
 
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractHttpOIDCAuthenticationAction.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractHttpOIDCAuthenticationAction.java
index 14b34bb..466e95b 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractHttpOIDCAuthenticationAction.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractHttpOIDCAuthenticationAction.java
@@ -157,6 +157,8 @@ public abstract class AbstractHttpOIDCAuthenticationAction<T extends Response>
      * and decode the response using the supplied decoder strategy. If an error response is returned an exception
      * is thrown —the error object is not propagated back to the caller.
      * 
+     * <p>The request encoder strategy should return null to indicate an error constructing the request.</p>
+     * 
      * @param profileRequestContext the context to pull information out of for encoding the request.
      * @param authenticatableContext an authenticatable context to set the authenticated flag. Can be {@literal null} if
      *                                  no flag is supplied.
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCAuthenticationResponseAction.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCAuthenticationResponseAction.java
index 36436ad..cf2d346 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCAuthenticationResponseAction.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCAuthenticationResponseAction.java
@@ -47,7 +47,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
  * the {@link ProfileRequestContext#getInboundMessageContext()} and the built {@link OIDCAuthenticationRequest}
  * located under the {@link ProfileRequestContext#getOutboundMessageContext()}.
  * 
- * <p>Also makes available the OpenID Provider metadata context</p>
+ * <p>Also makes available the OpenID Provider metadata context.</p>
  */
 public abstract class AbstractOIDCAuthenticationResponseAction extends AbstractAuthenticationAction {
 
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ProcessEndUserClaims.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ProcessEndUserClaims.java
index 1a9b998..0fca92e 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ProcessEndUserClaims.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ProcessEndUserClaims.java
@@ -37,6 +37,7 @@ import com.nimbusds.common.contenttype.ContentType;
 import com.nimbusds.jwt.JWTClaimsSet;
 import com.nimbusds.openid.connect.sdk.claims.ClaimsSet;
 
+import net.shibboleth.idp.authn.AbstractAuthenticationAction;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.plugin.authn.oidc.rp.context.AccessTokenResponseContext;
 import net.shibboleth.idp.plugin.authn.oidc.rp.context.EndUserClaimsContext;
@@ -57,7 +58,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
  * @event {@link EventIds#INVALID_PROFILE_CTX}
  * @post Add a set of merged and sanatized claims to the {@link EndUserClaimsContext}.
  */
-public class ProcessEndUserClaims extends AbstractOIDCAuthenticationResponseAction {
+public class ProcessEndUserClaims extends AbstractAuthenticationAction {
     
     /** Class logger.*/
     @Nonnull private final Logger log = LoggerFactory.getLogger(ProcessEndUserClaims.class);
@@ -121,6 +122,7 @@ public class ProcessEndUserClaims extends AbstractOIDCAuthenticationResponseActi
      */
     public void setClaimMergingStrategy(@Nonnull final BinaryOperator<ClaimsSet> strategy) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
         
         claimMergingStrategy =  Constraint.isNotNull(strategy,
                 "ClaimMergingStrategy cannot be null");
@@ -133,6 +135,9 @@ public class ProcessEndUserClaims extends AbstractOIDCAuthenticationResponseActi
      * @param strategy the strategy to use.
      */
     public void setClaimSanitizationStrategy(@Nonnull final UnaryOperator<ClaimsSet> strategy) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+        
         claimSanitizationStrategy = Constraint.isNotNull(strategy,
                 "ClaimSanatizationStrategy cannot be null");
     }
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ValidateOAuthAccessTokenResponse.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ValidateOAuthAccessTokenResponse.java
index 3396fdf..2829cae 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ValidateOAuthAccessTokenResponse.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ValidateOAuthAccessTokenResponse.java
@@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
 
 import com.nimbusds.openid.connect.sdk.OIDCTokenResponse;
 
+import net.shibboleth.idp.authn.AbstractAuthenticationAction;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.plugin.authn.oidc.rp.context.AccessTokenResponseContext;
 import net.shibboleth.oidc.profile.core.OidcEventIds;
@@ -50,7 +51,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
  * @event {@link EventIds#INVALID_PROFILE_CTX}
  * @event {@link OidcEventIds#INVALID_ACCESS_TOKEN}
  */
-public class ValidateOAuthAccessTokenResponse extends AbstractOIDCAuthenticationResponseAction {    
+public class ValidateOAuthAccessTokenResponse extends AbstractAuthenticationAction {    
     
     /** Class logger. */    
     @Nonnull @NotEmpty private final Logger log = LoggerFactory.getLogger(ValidateOAuthAccessTokenResponse.class); 
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ValidateTokenClaims.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ValidateTokenClaims.java
index 38cf409..0921547 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ValidateTokenClaims.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/ValidateTokenClaims.java
@@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
 import com.nimbusds.jwt.JWT;
 import com.nimbusds.jwt.JWTClaimsSet;
 
+import net.shibboleth.idp.authn.AbstractAuthenticationAction;
 import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.plugin.authn.oidc.rp.OIDCRPException;
@@ -57,7 +58,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
  * @event {@link AuthnEventIds#INVALID_AUTHN_CTX}
  * @event {@link OidcEventIds#INVALID_TOKEN}
  */
-public class ValidateTokenClaims extends AbstractOIDCAuthenticationResponseAction {
+public class ValidateTokenClaims extends AbstractAuthenticationAction {
     
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(ValidateTokenClaims.class);

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


More information about the commits mailing list