From e1ba0b444e40a3fa20ffb7a82c2286419f05d68a Mon Sep 17 00:00:00 2001 From: YuriyZ Date: Wed, 12 Jan 2022 11:51:02 +0200 Subject: [PATCH] feat: use ExecutionContext instead of token revoke context in custom scripts https://github.com/JanssenProject/jans-auth-server/issues/372 --- .../service/external/ExternalRevokeTokenService.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/io/jans/as/server/service/external/ExternalRevokeTokenService.java b/server/src/main/java/io/jans/as/server/service/external/ExternalRevokeTokenService.java index dce56e28a38..8f981edb4dc 100644 --- a/server/src/main/java/io/jans/as/server/service/external/ExternalRevokeTokenService.java +++ b/server/src/main/java/io/jans/as/server/service/external/ExternalRevokeTokenService.java @@ -1,6 +1,6 @@ package io.jans.as.server.service.external; -import io.jans.as.server.service.external.context.RevokeTokenContext; +import io.jans.as.server.model.common.ExecutionContext; import io.jans.model.custom.script.CustomScriptType; import io.jans.model.custom.script.conf.CustomScriptConfiguration; import io.jans.model.custom.script.type.revoke.RevokeTokenType; @@ -22,7 +22,7 @@ public ExternalRevokeTokenService() { super(CustomScriptType.REVOKE_TOKEN); } - public boolean revokeToken(CustomScriptConfiguration script, RevokeTokenContext context) { + public boolean revokeToken(CustomScriptConfiguration script, ExecutionContext context) { try { log.trace("Executing python 'revokeToken' method, context: {}", context); context.setScript(script); @@ -38,12 +38,10 @@ public boolean revokeToken(CustomScriptConfiguration script, RevokeTokenContext return false; } - public boolean revokeTokenMethods(RevokeTokenContext context) { + public boolean revokeTokenMethods(ExecutionContext context) { for (CustomScriptConfiguration script : this.customScriptConfigurations) { - if (script.getExternalType().getApiVersion() > 1) { - if (!revokeToken(script, context)) { - return false; - } + if (script.getExternalType().getApiVersion() > 1 && !revokeToken(script, context)) { + return false; } } return true;