[java-oidc-common] branch main updated: Make error event Id configurable, defaults to InvalidToken instead of InvalidIdToken.
Henri Mikkonen
henri.mikkonen at iki.fi
Tue May 2 09:11:19 UTC 2023
This is an automated email from the git hooks/post-receive script.
hjmikkon pushed a commit to branch main
in repository java-oidc-common.
View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=318b7873e98b253a200a43ac8488191ab6d8f776
The following commit(s) were added to refs/heads/main by this push:
new 318b787 Make error event Id configurable, defaults to InvalidToken instead of InvalidIdToken.
318b787 is described below
commit 318b7873e98b253a200a43ac8488191ab6d8f776
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Tue May 2 12:10:29 2023 +0300
Make error event Id configurable, defaults to InvalidToken instead of InvalidIdToken.
---
.../shibboleth/oidc/security/impl/DecryptJWE.java | 23 ++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/impl/DecryptJWE.java b/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/impl/DecryptJWE.java
index e1d25ea..76b5753 100644
--- a/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/impl/DecryptJWE.java
+++ b/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/impl/DecryptJWE.java
@@ -50,7 +50,7 @@ import net.shibboleth.utilities.java.support.logic.Constraint;
*
* @event {@link org.opensaml.profile.action.EventIds#PROCEED_EVENT_ID}
* @event {@link EventIds#INVALID_SEC_CFG}
- * @event {@link OidcEventIds#INVALID_ID_TOKEN}
+ * @event {@link OidcEventIds#INVALID_TOKEN}
* @post Decrypt a JWT and add it back to via an update strategy.
*/
public class DecryptJWE extends AbstractProfileAction {
@@ -65,7 +65,10 @@ public class DecryptJWE extends AbstractProfileAction {
* A consumer that sets the JWT produced from this decryption operation back into the profile request context.
*/
@NonnullAfterInit private BiConsumer<ProfileRequestContext, JWT> jwtUpdateStrategy;
-
+
+ /** Event identifier to publish in the case of decryption errors. */
+ @Nonnull private String errorEventId;
+
/** The extracted encrypted JWT that is to be validated.*/
@Nullable private EncryptedJWT encryptedJwt;
@@ -80,6 +83,7 @@ public class DecryptJWE extends AbstractProfileAction {
securityParamsLookupStrategy =
new ChildContextLookup<>(SecurityParametersContext.class).compose(
new InboundMessageContextLookup());
+ errorEventId = OidcEventIds.INVALID_TOKEN;
}
/**
@@ -121,7 +125,18 @@ public class DecryptJWE extends AbstractProfileAction {
jwtTokenLookupStrategy = Constraint.isNotNull(strategy,
"JwtToken lookup strategy cannot be null");
}
-
+
+ /**
+ * Sets the event identifier to publish in the case of decryption errors.
+ *
+ * @param id the identifier to set
+ */
+ public void setErrorEventId(@Nonnull final String id) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+ errorEventId = Constraint.isNotEmpty(id, "Error event identifier cannot be empty");
+ }
+
@Override
protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
@@ -175,7 +190,7 @@ public class DecryptJWE extends AbstractProfileAction {
jwtUpdateStrategy.accept(profileRequestContext, decryptedJWT);
} catch (final DecryptionException e) {
log.error("{} Unable to decrypt JWT", getLogPrefix(), e);
- ActionSupport.buildEvent(profileRequestContext, OidcEventIds.INVALID_ID_TOKEN);
+ ActionSupport.buildEvent(profileRequestContext, errorEventId);
return;
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list