[java-plugin-shibd-oidc] branch main updated: More refactoring of authorization request builders (handlers)
Phil Smart
philip.smart at jisc.ac.uk
Fri Sep 26 16:17:24 UTC 2025
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-plugin-shibd-oidc.
View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd-oidc.git;a=commit;h=4814d3129a08f1fd27e5686c9933160c007085d2
The following commit(s) were added to refs/heads/main by this push:
new 4814d31 More refactoring of authorization request builders (handlers)
4814d31 is described below
commit 4814d3129a08f1fd27e5686c9933160c007085d2
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Sep 26 17:17:21 2025 +0100
More refactoring of authorization request builders (handlers)
---
...tAgentAndRelyingPartyContextLookupFunction.java | 35 +++++++++++++++++++---
.../profile/impl/ResponseModeLookupStrategy.java | 11 ++++---
.../profile/impl/ResponseTypeLookupStrategy.java | 6 ++--
3 files changed, 39 insertions(+), 13 deletions(-)
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AbstractAgentAndRelyingPartyContextLookupFunction.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AbstractAgentAndRelyingPartyContextLookupFunction.java
index 1884432..c003197 100644
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AbstractAgentAndRelyingPartyContextLookupFunction.java
+++ b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AbstractAgentAndRelyingPartyContextLookupFunction.java
@@ -24,6 +24,8 @@ import org.opensaml.messaging.context.navigate.ChildContextLookup;
import org.opensaml.messaging.context.navigate.ParentContextLookup;
import org.opensaml.profile.context.ProfileRequestContext;
+import net.shibboleth.oidc.profile.config.OIDCAuthenticationRelyingPartyProfileConfiguration;
+import net.shibboleth.profile.context.RelyingPartyContext;
import net.shibboleth.profile.context.navigate.messaging.AbstractRelyingPartyLookupFunction;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.sp.Agent;
@@ -32,11 +34,15 @@ import net.shibboleth.sp.context.AgentRequestContext;
import net.shibboleth.sp.ddf.DDF;
/**
+ * Abstract base class for lookup functions that require access to both {@link AgentRequestContext}
+ * and {@link RelyingPartyContext} from a {@link MessageContext}.
+ * <p>
+ * This class provides additional methods to extract agent-related information such as {@link Agent},
+ * {@link Application}, and {@link DDF}, as well as relying party configuration specific to
+ * OpenID Connect Relying Party authentication.
+ * </p>
*
- * Abstract base class for a function that requires a {@link AgentRequestContext}
- * obtained via a lookup function, by default a child of the {@link ProfileRequestContext}.
- *
- * @param <ResultType> return type of function
+ * @param <ResultType> return type of the lookup function
*/
public abstract class AbstractAgentAndRelyingPartyContextLookupFunction<ResultType>
extends AbstractRelyingPartyLookupFunction<ResultType>{
@@ -125,4 +131,25 @@ public abstract class AbstractAgentAndRelyingPartyContextLookupFunction<ResultTy
return null;
}
}
+
+
+ /**
+ * Extracts the {@link OIDCAuthenticationRelyingPartyProfileConfiguration} from the given {@link MessageContext}.
+ *
+ * @param messageContext the current {@link MessageContext}, may be {@code null}
+ *
+ * @return the resolved {@link OIDCAuthenticationRelyingPartyProfileConfiguration}, or {@code null} if
+ * unavailable
+ */
+ @Nullable protected OIDCAuthenticationRelyingPartyProfileConfiguration
+ getOIDCRelyingPartyProfileConfiguration(@Nullable final MessageContext messageContext) {
+
+ final RelyingPartyContext rpc = getRelyingPartyContext(messageContext);
+ if (rpc != null && rpc.getProfileConfig() instanceof final
+ OIDCAuthenticationRelyingPartyProfileConfiguration config) {
+ return config;
+ }
+ return null;
+
+ }
}
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResponseModeLookupStrategy.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResponseModeLookupStrategy.java
index c6e2f10..d761469 100644
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResponseModeLookupStrategy.java
+++ b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResponseModeLookupStrategy.java
@@ -43,12 +43,11 @@ public class ResponseModeLookupStrategy extends AbstractAgentAndRelyingPartyCont
/** {@inheritDoc} */
@Override
- public ResponseMode apply(final MessageContext messageContext) {
+ public ResponseMode apply(@Nullable final MessageContext messageContext) {
- final RelyingPartyContext rpc = getRelyingPartyContext(messageContext);
-
- if (!(rpc != null && rpc.getProfileConfig()
- instanceof final OIDCAuthenticationRelyingPartyProfileConfiguration rpConfig)) {
+ final OIDCAuthenticationRelyingPartyProfileConfiguration rpConfig =
+ getOIDCRelyingPartyProfileConfiguration(messageContext);
+ if (rpConfig == null) {
return null;
}
// If there is no other path, and the compiler can prove rpConfig is true, you can use it here.
@@ -60,7 +59,7 @@ public class ResponseModeLookupStrategy extends AbstractAgentAndRelyingPartyCont
// Checkstyle: ReturnCount OFF
/**
- * Parse the response_mode into a known {@link ResponseMode}.
+ * Parse the {@code responseModeFromProfile} into a known {@link ResponseMode}.
*
* @param responseModeFromProfile the response_mode as a string
*
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResponseTypeLookupStrategy.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResponseTypeLookupStrategy.java
index 2c28d32..1d3a910 100644
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResponseTypeLookupStrategy.java
+++ b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResponseTypeLookupStrategy.java
@@ -48,10 +48,10 @@ public class ResponseTypeLookupStrategy extends AbstractAgentAndRelyingPartyCont
/** {@inheritDoc} */
@Override
public ResponseType apply(@Nullable final MessageContext messageContext) {
- final RelyingPartyContext rpc = getRelyingPartyContext(messageContext);
- if (!(rpc != null && rpc.getProfileConfig()
- instanceof final OIDCAuthenticationRelyingPartyProfileConfiguration rpConfig)) {
+ final OIDCAuthenticationRelyingPartyProfileConfiguration rpConfig =
+ getOIDCRelyingPartyProfileConfiguration(messageContext);
+ if (rpConfig == null) {
return null;
}
// If there is no other path, and the compiler can prove rpConfig is true, you can use it here.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list