[java-idp-plugin-vci] branch main updated: Fail nonce request with server_error when no nonce is generated
Codeberg
noreply at shibboleth.net
Thu Oct 22 13:55:52 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-idp-plugin-vci.
View the commit online:
https://codeberg.org/Shibboleth/java-idp-plugin-vci/commit/55ffa1b725e0c4508d80191a65369428e08bb247
The following commit(s) were added to refs/heads/main by this push:
new 55ffa1b Fail nonce request with server_error when no nonce is generated
55ffa1b is described below
commit 55ffa1b725e0c4508d80191a65369428e08bb247
Author: Janne Lauros <janne.lauros at csc.fi>
AuthorDate: Thu Oct 22 16:55:42 2026 +0300
Fail nonce request with server_error when no nonce is generated
---
.../impl/FormOutboundNonceResponseMessage.java | 27 +++++++++++++---------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundNonceResponseMessage.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundNonceResponseMessage.java
index 2134472..f767a41 100644
--- a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundNonceResponseMessage.java
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/FormOutboundNonceResponseMessage.java
@@ -19,6 +19,7 @@ package org.geant.shibboleth.plugin.openidvci.profile.impl;
import java.util.function.Function;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import org.geant.shibboleth.plugin.openidvci.profile.config.OpenIDVCIConfiguration;
import org.geant.shibboleth.plugin.openidvci.messaging.impl.NonceSuccessResponse;
@@ -31,7 +32,6 @@ import net.shibboleth.idp.profile.AbstractProfileAction;
import net.shibboleth.idp.profile.IdPEventIds;
import net.shibboleth.profile.config.ProfileConfiguration;
import net.shibboleth.profile.context.RelyingPartyContext;
-import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.logic.Constraint;
/**
@@ -41,10 +41,10 @@ public class FormOutboundNonceResponseMessage extends AbstractProfileAction {
/** Class logger. */
@Nonnull
- private Logger log = LoggerFactory.getLogger(FormOutboundNonceResponseMessage.class);
+ private final Logger log = LoggerFactory.getLogger(FormOutboundNonceResponseMessage.class);
/** Nonce generator. */
- @NonnullAfterInit
+ @Nullable
private Function<ProfileRequestContext, String> generator;
/**
@@ -54,9 +54,6 @@ public class FormOutboundNonceResponseMessage extends AbstractProfileAction {
@Nonnull
private Function<ProfileRequestContext, RelyingPartyContext> relyingPartyContextLookupStrategy;
- /** Relying party context. */
- private RelyingPartyContext rpCtx;
-
/** Constructor. */
public FormOutboundNonceResponseMessage() {
relyingPartyContextLookupStrategy = new ChildContextLookup<>(RelyingPartyContext.class);
@@ -80,7 +77,10 @@ public class FormOutboundNonceResponseMessage extends AbstractProfileAction {
/** {@inheritDoc} */
@Override
protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
- rpCtx = relyingPartyContextLookupStrategy.apply(profileRequestContext);
+ if (!super.doPreExecute(profileRequestContext)) {
+ return false;
+ }
+ final RelyingPartyContext rpCtx = relyingPartyContextLookupStrategy.apply(profileRequestContext);
if (rpCtx == null) {
log.error("{} No relying party context associated with this profile request", getLogPrefix());
ActionSupport.buildEvent(profileRequestContext, IdPEventIds.INVALID_RELYING_PARTY_CTX);
@@ -96,16 +96,21 @@ public class FormOutboundNonceResponseMessage extends AbstractProfileAction {
}
if (generator == null) {
log.error("{} No nonce generator available for this profile request", getLogPrefix());
- ActionSupport.buildEvent(profileRequestContext, IdPEventIds.INVALID_RELYING_PARTY_CTX);
+ ActionSupport.buildEvent(profileRequestContext, IdPEventIds.INVALID_PROFILE_CONFIG);
return false;
}
- return super.doPreExecute(profileRequestContext);
+ return true;
}
/** {@inheritDoc} */
@Override
protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
- profileRequestContext.ensureOutboundMessageContext()
- .setMessage(new NonceSuccessResponse(generator.apply(profileRequestContext)));
+ final String nonce = generator.apply(profileRequestContext);
+ if (nonce == null) {
+ log.error("{} Could not create new nonce via generator", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, IdPEventIds.INVALID_PROFILE_CONFIG);
+ return;
+ }
+ profileRequestContext.ensureOutboundMessageContext().setMessage(new NonceSuccessResponse(nonce));
}
}
\ 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