[java-idp-plugin-oidc-op-oidfed] 01/03: Removed final references to Nimbus EntityStatement from the main source
Codeberg
noreply at shibboleth.net
Thu Dec 18 17:55:46 UTC 2025
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch dev/CACHE-REFACTOR
in repository java-idp-plugin-oidc-op-oidfed.
View the commit online:
https://codeberg.org/Shibboleth/java-idp-plugin-oidc-op-oidfed/commit/ef2fed004abaee01b08cc8d7fbc93d86edd38cc9
commit ef2fed004abaee01b08cc8d7fbc93d86edd38cc9
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Thu Dec 18 14:22:26 2025 +0200
Removed final references to Nimbus EntityStatement from the main source
- WIP: Some references still exist on test
---
.../impl/EntityConfigurationResponse.java | 55 ++++++++++++++++++++++
.../impl/ExplicitClientRegistrationResponse.java | 1 +
.../impl/AbstractBuildEntityStatementAction.java | 3 +-
.../impl/FormExplicitRegistrationResponse.java | 18 ++-----
...ormOutboundFederationConfigurationResponse.java | 15 ++----
.../impl/FormOutboundResolveEntityResponse.java | 3 +-
6 files changed, 65 insertions(+), 30 deletions(-)
diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/messaging/impl/EntityConfigurationResponse.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/messaging/impl/EntityConfigurationResponse.java
new file mode 100644
index 0000000..7086ef8
--- /dev/null
+++ b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/messaging/impl/EntityConfigurationResponse.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.idp.plugin.oidc.op.oidfed.messaging.impl;
+
+import javax.annotation.Nonnull;
+
+import com.nimbusds.common.contenttype.ContentType;
+import com.nimbusds.jose.JOSEObjectType;
+import com.nimbusds.jwt.SignedJWT;
+
+/**
+ * Response message to the OpenID federation entity configuration endpoint.
+ */
+public class EntityConfigurationResponse extends AbstractSignedJWTResponse {
+
+ /** The JWT type header. */
+ @Nonnull
+ public static final JOSEObjectType JWT_TYPE_HEADER = new JOSEObjectType("entity-statement+jwt");
+
+ /** The content type. */
+ @Nonnull public static final ContentType HTTP_RESPONSE_CONTENT_TYPE =
+ new ContentType("application", JWT_TYPE_HEADER.toString());
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param statement entity statement
+ */
+ public EntityConfigurationResponse(@Nonnull final SignedJWT statement) {
+ super(statement);
+ }
+
+ /** {@inheritDoc} */
+ protected ContentType getHttpResponseContentType() {
+ return HTTP_RESPONSE_CONTENT_TYPE;
+ }
+
+ /** {@inheritDoc} */
+ protected JOSEObjectType getJWTTypeHeader() {
+ return JWT_TYPE_HEADER;
+ }
+}
\ No newline at end of file
diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/messaging/impl/ExplicitClientRegistrationResponse.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/messaging/impl/ExplicitClientRegistrationResponse.java
index 6909e59..66ee22e 100644
--- a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/messaging/impl/ExplicitClientRegistrationResponse.java
+++ b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/messaging/impl/ExplicitClientRegistrationResponse.java
@@ -79,6 +79,7 @@ public class ExplicitClientRegistrationResponse extends AbstractSignedJWTRespons
try {
final SignedJWT jwt = SignedJWT.parse(httpResponse.getContent());
+ assert jwt != null;
return new ExplicitClientRegistrationResponse(jwt);
} catch (final java.text.ParseException | ConstraintViolationException e) {
throw new ParseException(e.getMessage(), e);
diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/AbstractBuildEntityStatementAction.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/AbstractBuildEntityStatementAction.java
index e77eb2a..4ed8004 100644
--- a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/AbstractBuildEntityStatementAction.java
+++ b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/AbstractBuildEntityStatementAction.java
@@ -37,7 +37,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.nimbusds.jwt.JWT;
import com.nimbusds.jwt.JWTClaimsSet;
import com.nimbusds.jwt.PlainJWT;
-import com.nimbusds.openid.connect.sdk.federation.entities.EntityStatement;
import net.shibboleth.idp.plugin.oidc.op.oidfed.profile.config.navigate.EntityStatementClaimsSetManipulationStrategyLookupFunction;
import net.shibboleth.idp.profile.AbstractProfileAction;
@@ -53,7 +52,7 @@ import net.shibboleth.shared.security.IdentifierGenerationStrategy;
import net.shibboleth.shared.security.impl.SecureRandomIdentifierGenerationStrategy;
/**
- * Abstract action used by actions that build {@link EntityStatement}s.
+ * Abstract action used by actions that build entity statements.
*/
public abstract class AbstractBuildEntityStatementAction extends AbstractProfileAction {
diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormExplicitRegistrationResponse.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormExplicitRegistrationResponse.java
index d8c5c77..bd6be85 100644
--- a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormExplicitRegistrationResponse.java
+++ b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormExplicitRegistrationResponse.java
@@ -17,7 +17,6 @@ package net.shibboleth.idp.plugin.oidc.op.oidfed.profile.impl;
import java.util.function.Function;
import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import org.opensaml.messaging.context.navigate.ChildContextLookup;
import org.opensaml.profile.action.ActionSupport;
@@ -27,17 +26,16 @@ import org.opensaml.profile.context.navigate.OutboundMessageContextLookup;
import org.slf4j.Logger;
import com.nimbusds.jwt.SignedJWT;
-import com.nimbusds.oauth2.sdk.ParseException;
-import com.nimbusds.openid.connect.sdk.federation.entities.EntityStatement;
import net.shibboleth.idp.plugin.oidc.op.oidfed.messaging.impl.ExplicitClientRegistrationResponse;
import net.shibboleth.idp.profile.AbstractProfileAction;
+import net.shibboleth.shared.annotation.constraint.NonnullBeforeExec;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.LoggerFactory;
/**
* This action builds a response for the OpenID federation explicit registration request. The response contains an
- * {@link EntityStatement}.
+ * {@link SignedJWT} obtained from {@link EntityStatementContext#getJWT()}.
*/
public class FormExplicitRegistrationResponse extends AbstractProfileAction {
@@ -48,7 +46,7 @@ public class FormExplicitRegistrationResponse extends AbstractProfileAction {
@Nonnull private Function<ProfileRequestContext,EntityStatementContext> entityStatementContextLookupStrategy;
/** JWT used to build entity statement. */
- @Nullable private SignedJWT jwt;
+ @NonnullBeforeExec private SignedJWT jwt;
/**
* Constructor.
@@ -100,15 +98,7 @@ public class FormExplicitRegistrationResponse extends AbstractProfileAction {
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
- final EntityStatement entityStatement;
- try {
- entityStatement = EntityStatement.parse(jwt);
- } catch (ParseException e) {
- log.error("{} Could not parse entity statement from JWT", getLogPrefix(), e);
- ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
- return;
- }
- assert entityStatement != null;
+ assert jwt != null;
final ExplicitClientRegistrationResponse response = new ExplicitClientRegistrationResponse(jwt);
log.debug("{} Response message set to the outbound message context", getLogPrefix());
profileRequestContext.ensureOutboundMessageContext().setMessage(response);
diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormOutboundFederationConfigurationResponse.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormOutboundFederationConfigurationResponse.java
index 8db787c..2060a74 100644
--- a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormOutboundFederationConfigurationResponse.java
+++ b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormOutboundFederationConfigurationResponse.java
@@ -30,11 +30,9 @@ import org.opensaml.profile.context.navigate.OutboundMessageContextLookup;
import org.slf4j.Logger;
import com.nimbusds.jwt.SignedJWT;
-import com.nimbusds.oauth2.sdk.ParseException;
import com.nimbusds.oauth2.sdk.Response;
-import com.nimbusds.openid.connect.sdk.federation.config.FederationEntityConfigurationSuccessResponse;
-import com.nimbusds.openid.connect.sdk.federation.entities.EntityStatement;
+import net.shibboleth.idp.plugin.oidc.op.oidfed.messaging.impl.EntityConfigurationResponse;
import net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.ResponseContainerExpirationCriterion;
import net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.local.NimbusResponseContainer;
import net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.local.NimbusResponseCriterion;
@@ -51,7 +49,7 @@ import net.shibboleth.shared.resolver.CriteriaSet;
/**
* This action builds a response for the OpenID federation configuration request. The response contains an
- * {@link EntityStatement}.
+ * {@link SignedJWT} obtained from {@link EntityStatementContext#getJWT()}.
*/
public class FormOutboundFederationConfigurationResponse extends AbstractProfileAction {
@@ -186,14 +184,7 @@ public class FormOutboundFederationConfigurationResponse extends AbstractProfile
}
assert jwt != null;
- final FederationEntityConfigurationSuccessResponse response;
- try {
- response = new FederationEntityConfigurationSuccessResponse(EntityStatement.parse(jwt));
- } catch (ParseException e) {
- log.error("{} No signed JWT found from the entity statement context", getLogPrefix());
- ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
- return;
- }
+ final EntityConfigurationResponse response = new EntityConfigurationResponse(jwt);
final NimbusResponseCriterion responseCriterion = new NimbusResponseCriterion(response);
final Duration lifetime = cachedResponseLifetimeLookupStrategy.apply(profileRequestContext);
if (lifetime == null) {
diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormOutboundResolveEntityResponse.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormOutboundResolveEntityResponse.java
index e671a97..2f8b3a7 100644
--- a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormOutboundResolveEntityResponse.java
+++ b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/profile/impl/FormOutboundResolveEntityResponse.java
@@ -31,7 +31,6 @@ import org.slf4j.Logger;
import com.nimbusds.jwt.SignedJWT;
import com.nimbusds.oauth2.sdk.Response;
-import com.nimbusds.openid.connect.sdk.federation.entities.EntityStatement;
import net.shibboleth.idp.plugin.oidc.op.oidfed.messaging.impl.ResolveEntityRequest;
import net.shibboleth.idp.plugin.oidc.op.oidfed.messaging.impl.ResolveEntityResponse;
@@ -52,7 +51,7 @@ import net.shibboleth.shared.resolver.CriteriaSet;
/**
* This action builds a response for the OpenID federation resolve entity request. The response contains an
- * {@link EntityStatement}. The response is put in the {@link #responseCache} using the lifetime resolved via
+ * {@link SignedJWT}. The response is put in the {@link #responseCache} using the lifetime resolved via
* {@link #cachedResponseLifetimeLookupStrategy}.
*/
public class FormOutboundResolveEntityResponse extends AbstractProfileAction {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list