From ba139fdba6409c8cde4798816e7cd379b7efbca7 Mon Sep 17 00:00:00 2001
From: Benjamin Scholtes <88310985+bscholtes1A@users.noreply.github.com>
Date: Tue, 26 Mar 2024 16:59:29 +0100
Subject: [PATCH] refactor: log `JtiValidationRule` warning only once at
creation time (#4049)
refactor: log JtiValidationRule warning only once at creation time
---
.../verifiablecredentials/jwt/rules/JtiValidationRule.java | 7 -------
.../iam/identitytrust/core/IdentityAndTrustExtension.java | 3 ++-
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/extensions/common/crypto/jwt-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/jwt/rules/JtiValidationRule.java b/extensions/common/crypto/jwt-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/jwt/rules/JtiValidationRule.java
index cbbf10208ee..e216a885f93 100644
--- a/extensions/common/crypto/jwt-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/jwt/rules/JtiValidationRule.java
+++ b/extensions/common/crypto/jwt-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/jwt/rules/JtiValidationRule.java
@@ -15,7 +15,6 @@
package org.eclipse.edc.verifiablecredentials.jwt.rules;
import org.eclipse.edc.spi.iam.ClaimToken;
-import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.result.Result;
import org.eclipse.edc.token.spi.TokenValidationRule;
import org.jetbrains.annotations.NotNull;
@@ -29,15 +28,9 @@
* Note that this rule can only be implemented after this related issue
*/
public class JtiValidationRule implements TokenValidationRule {
- private final Monitor monitor;
-
- public JtiValidationRule(Monitor monitor) {
- this.monitor = monitor;
- }
@Override
public Result checkRule(@NotNull ClaimToken toVerify, @Nullable Map additional) {
- monitor.warning("The JTI Validation rule is not yet implemented as it depends on https://github.com/eclipse-edc/Connector/issues/3749.");
return Result.success();
}
}
diff --git a/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/IdentityAndTrustExtension.java b/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/IdentityAndTrustExtension.java
index 7035d431909..cf9d14061c9 100644
--- a/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/IdentityAndTrustExtension.java
+++ b/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/IdentityAndTrustExtension.java
@@ -125,7 +125,8 @@ public void initialize(ServiceExtensionContext context) {
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new IssuerEqualsSubjectRule());
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new SubJwkIsNullRule());
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new AudienceValidationRule(getOwnDid(context)));
- rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new JtiValidationRule(context.getMonitor()));
+ context.getMonitor().warning("The JTI Validation rule is not yet implemented as it depends on https://github.com/eclipse-edc/Connector/issues/3749.");
+ rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new JtiValidationRule());
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new ExpirationIssuedAtValidationRule(clock, 5));
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new TokenNotNullRule());