Skip to content

Commit

Permalink
feat(jans-auth-server): add Token Exchange interception script #8157
Browse files Browse the repository at this point in the history
Signed-off-by: YuriyZ <[email protected]>
  • Loading branch information
yuriyz committed Dec 27, 2024
1 parent ef085e6 commit 0e74efd
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
import io.jans.model.custom.script.type.spontaneous.SpontaneousScopeType;
import io.jans.model.custom.script.type.ssa.DummyModifySsaResponseType;
import io.jans.model.custom.script.type.ssa.ModifySsaResponseType;
import io.jans.model.custom.script.type.token.DummyTokenExchangeType;
import io.jans.model.custom.script.type.token.DummyUpdateTokenType;
import io.jans.model.custom.script.type.token.TokenExchangeType;
import io.jans.model.custom.script.type.token.UpdateTokenType;
import io.jans.model.custom.script.type.uma.*;
import io.jans.model.custom.script.type.user.CacheRefreshType;
Expand Down Expand Up @@ -106,6 +108,7 @@ public enum CustomScriptType implements AttributeEnum {
new DummyAccessEvaluationType()),
ACCESS_EVALUATION_DISCOVERY("access_evaluation_discovery", "Access Evaluation Discovery", AccessEvaluationDiscoveryType.class, CustomScript.class, "AccessEvaluationDiscovery",
new DummyAccessEvaluationDiscoveryType()),
TOKEN_EXCHANGE("token_exchange", "Token Exchange", TokenExchangeType.class, CustomScript.class, "TokenExchange", new DummyTokenExchangeType()),
CONSENT_GATHERING("consent_gathering", "Consent Gathering", ConsentGatheringType.class, CustomScript.class, "ConsentGathering",
new DummyConsentGatheringType()),
DYNAMIC_SCOPE("dynamic_scope", "Dynamic Scopes", DynamicScopeType.class, CustomScript.class, "DynamicScope",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package io.jans.model.custom.script.type.token;

import io.jans.model.SimpleCustomProperty;
import io.jans.model.custom.script.model.CustomScript;

import java.util.Map;

/**
* @author Yuriy Z
*/
public class DummyTokenExchangeType implements TokenExchangeType {
@Override
public boolean modifyResponse(Object context) {
return false;
}

@Override
public void validate(Object context) {
// dummy
}

@Override
public boolean skipBuiltinValidation(Object context) {
return false;
}

@Override
public boolean init(Map<String, SimpleCustomProperty> configurationAttributes) {
return true;
}

@Override
public boolean init(CustomScript customScript, Map<String, SimpleCustomProperty> configurationAttributes) {
return true;
}

@Override
public boolean destroy(Map<String, SimpleCustomProperty> configurationAttributes) {
return true;
}

@Override
public int getApiVersion() {
return 1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.jans.model.custom.script.type.token;

import io.jans.model.custom.script.type.BaseExternalType;

/**
* @author Yuriy Z
*/
public interface TokenExchangeType extends BaseExternalType {

boolean modifyResponse(Object context);

void validate(Object context);

boolean skipBuiltinValidation(Object context);
}

0 comments on commit 0e74efd

Please sign in to comment.