Search in sources :

Example 16 with PostEnvironment

use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.

the class AddInvalidCHashValueToIdToken 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");
    // Add number 1 onto end of hash string
    String concat = (hash + 1);
    claims.addProperty("c_hash", concat);
    env.putObject("id_token_claims", claims);
    logSuccess("Added invalid c_hash to ID token claims", args("id_token_claims", claims, "c_hash", concat));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 17 with PostEnvironment

use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.

the class AddInvalidExpiredExpValueToIdToken method evaluate.

@Override
@PreEnvironment(required = "id_token_claims")
@PostEnvironment(required = "id_token_claims")
public Environment evaluate(Environment env) {
    JsonObject claims = env.getObject("id_token_claims");
    Instant exp = Instant.now().minusSeconds(60 * 6);
    claims.addProperty("exp", exp.getEpochSecond());
    env.putObject("id_token_claims", claims);
    logSuccess("Added expired exp value to ID token claims", args("id_token_claims", claims, "exp", exp));
    return env;
}
Also used : Instant(java.time.Instant) JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 18 with PostEnvironment

use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.

the class AddInvalidOpenBankingIntentIdToIdToken method evaluate.

@Override
@PreEnvironment(required = "id_token_claims", strings = "openbanking_intent_id")
@PostEnvironment(required = "id_token_claims")
public Environment evaluate(Environment env) {
    JsonObject claims = env.getObject("id_token_claims");
    String intent = env.getString("openbanking_intent_id");
    // Add number 1 onto end of intent string
    String concat = intent + 1;
    claims.addProperty("openbanking_intent_id", concat);
    env.putObject("id_token_claims", claims);
    logSuccess("Added invalid openbanking_intent_id to ID token claims", args("id_token_claims", claims, "openbanking_intent_id", concat));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 19 with PostEnvironment

use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.

the class AddIssToAuthorizationEndpointResponseParams method evaluate.

@Override
@PreEnvironment(required = CreateAuthorizationEndpointResponseParams.ENV_KEY, strings = "issuer")
@PostEnvironment(required = CreateAuthorizationEndpointResponseParams.ENV_KEY)
public Environment evaluate(Environment env) {
    JsonObject params = env.getObject(CreateAuthorizationEndpointResponseParams.ENV_KEY);
    String issuer = env.getString("issuer");
    params.addProperty("iss", issuer);
    env.putObject(CreateAuthorizationEndpointResponseParams.ENV_KEY, params);
    logSuccess("Added Iss to authorization endpoint response params", args(CreateAuthorizationEndpointResponseParams.ENV_KEY, params));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 20 with PostEnvironment

use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.

the class FAPIBrazilAddBrazilSpecificSettingsToServerConfiguration method evaluate.

@Override
@PreEnvironment(required = { "server" })
@PostEnvironment(required = { "server" })
public Environment evaluate(Environment env) {
    JsonObject server = env.getObject("server");
    {
        JsonArray algValues = new JsonArray();
        algValues.add("RSA-OAEP");
        server.add("request_object_encryption_alg_values_supported", algValues);
    }
    {
        JsonArray encValues = new JsonArray();
        encValues.add("A256GCM");
        server.add("request_object_encryption_enc_values_supported", encValues);
    }
    {
        JsonArray claimsSupported = new JsonArray();
        claimsSupported.add("cpf");
        claimsSupported.add("cnpj");
        claimsSupported.add("acr");
        server.add("claims_supported", claimsSupported);
    }
    {
        JsonArray acrValuesSupported = new JsonArray();
        acrValuesSupported.add("urn:brasil:openbanking:loa2");
        acrValuesSupported.add("urn:brasil:openbanking:loa3");
        server.add("acr_values_supported", acrValuesSupported);
    }
    {
        JsonArray idTokenSigAlgs = new JsonArray();
        idTokenSigAlgs.add("PS256");
        server.add("id_token_signing_alg_values_supported", idTokenSigAlgs);
    }
    {
        JsonArray algs = new JsonArray();
        algs.add("PS256");
        server.add("request_object_signing_alg_values_supported", algs);
    }
    {
        JsonArray scopes = new JsonArray();
        scopes.add("openid");
        scopes.add("phone");
        scopes.add("profile");
        scopes.add("email");
        scopes.add("address");
        scopes.add("offline_access");
        scopes.add("consents");
        scopes.add("resources");
        scopes.add("payments");
        server.add("scopes_supported", scopes);
    }
    log("Added open banking Brazil specific server settings", args("server", server));
    return env;
}
Also used : JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Aggregations

PostEnvironment (net.openid.conformance.condition.PostEnvironment)399 PreEnvironment (net.openid.conformance.condition.PreEnvironment)379 JsonObject (com.google.gson.JsonObject)372 JsonElement (com.google.gson.JsonElement)61 JsonArray (com.google.gson.JsonArray)49 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)22 Instant (java.time.Instant)21 ParseException (java.text.ParseException)17 CertificateException (java.security.cert.CertificateException)16 IOException (java.io.IOException)15 KeyManagementException (java.security.KeyManagementException)15 KeyStoreException (java.security.KeyStoreException)15 UnrecoverableKeyException (java.security.UnrecoverableKeyException)15 InvalidKeySpecException (java.security.spec.InvalidKeySpecException)15 RestClientException (org.springframework.web.client.RestClientException)15 RestTemplate (org.springframework.web.client.RestTemplate)15 JOSEException (com.nimbusds.jose.JOSEException)9 JWK (com.nimbusds.jose.jwk.JWK)9 RestClientResponseException (org.springframework.web.client.RestClientResponseException)9 JWKSet (com.nimbusds.jose.jwk.JWKSet)7