use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class AddACRClaimToIdTokenClaims method evaluate.
@Override
@PreEnvironment(required = "id_token_claims", strings = "requested_id_token_acr_values")
@PostEnvironment(required = "id_token_claims")
public Environment evaluate(Environment env) {
JsonObject claims = env.getObject("id_token_claims");
String acr = env.getString("requested_id_token_acr_values");
JsonArray acrValues = (JsonArray) JsonParser.parseString(acr);
if (acrValues == null || !acrValues.isJsonPrimitive()) {
String[] acrValuesString = new Gson().fromJson(acrValues, String[].class);
List<String> requestedACRs;
requestedACRs = Arrays.asList(acrValuesString);
List<String> acceptableAcrValues = new ArrayList<>();
acceptableAcrValues.add("urn:openbanking:psd2:sca");
acceptableAcrValues.add("urn:openbanking:psd2:ca");
String acrValue = null;
for (String singleACRValue : requestedACRs) {
if (singleACRValue.contains(acceptableAcrValues.get(0))) {
acrValue = singleACRValue;
break;
} else if (singleACRValue.contains(acceptableAcrValues.get(1))) {
acrValue = singleACRValue;
} else {
throw error("Unsupported acr value in id_token_claims", args("supported_acr_values", acceptableAcrValues, "received_value", requestedACRs));
}
}
claims.addProperty("acr", acrValue);
env.putObject("id_token_claims", claims);
logSuccess("Added acr value to id_token_claims", args("claims", claims, "acr_value", acrValue));
}
return env;
}
use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class AddAuthorizationSigningAlgValuesSupportedToServerConfiguration method evaluate.
@Override
@PreEnvironment(required = { "server" }, strings = "signing_algorithm")
@PostEnvironment(required = "server")
public Environment evaluate(Environment env) {
String alg = env.getString("signing_algorithm");
JsonArray data = new JsonArray();
data.add(alg);
JsonObject server = env.getObject("server");
server.add("authorization_signing_alg_values_supported", data);
logSuccess("Added authorization_signing_alg_values_supported to server configuration", args("alg_values", data));
return env;
}
use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class AddCHashToIdTokenClaims method evaluate.
@Override
@PreEnvironment(required = "id_token_claims", strings = "c_hash")
@PostEnvironment(required = "id_token_claims")
public Environment evaluate(Environment env) {
JsonObject claims = env.getObject("id_token_claims");
String hash = env.getString("c_hash");
claims.addProperty("c_hash", hash);
env.putObject("id_token_claims", claims);
logSuccess("Added c_hash to ID token claims", args("id_token_claims", claims, "c_hash", hash));
return env;
}
use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class AddCodeToAuthorizationEndpointResponseParams method evaluate.
@Override
@PreEnvironment(required = CreateAuthorizationEndpointResponseParams.ENV_KEY, strings = "authorization_code")
@PostEnvironment(required = CreateAuthorizationEndpointResponseParams.ENV_KEY)
public Environment evaluate(Environment env) {
JsonObject params = env.getObject(CreateAuthorizationEndpointResponseParams.ENV_KEY);
String code = env.getString("authorization_code");
params.addProperty("code", code);
env.putObject(CreateAuthorizationEndpointResponseParams.ENV_KEY, params);
logSuccess("Added code to authorization endpoint response params", args(CreateAuthorizationEndpointResponseParams.ENV_KEY, params));
return env;
}
use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class AddIdTokenToAuthorizationEndpointResponseParams method evaluate.
@Override
@PreEnvironment(required = CreateAuthorizationEndpointResponseParams.ENV_KEY, strings = "id_token")
@PostEnvironment(required = CreateAuthorizationEndpointResponseParams.ENV_KEY)
public Environment evaluate(Environment env) {
JsonObject params = env.getObject(CreateAuthorizationEndpointResponseParams.ENV_KEY);
String idToken = env.getString("id_token");
params.addProperty("id_token", idToken);
env.putObject(CreateAuthorizationEndpointResponseParams.ENV_KEY, params);
logSuccess("Added id_token to authorization endpoint response params", args(CreateAuthorizationEndpointResponseParams.ENV_KEY, params));
return env;
}
Aggregations