Search in sources :

Example 26 with PreEnvironment

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

the class RemoveSHashFromIdToken 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");
    claims.remove("s_hash");
    env.putObject("id_token_claims", claims);
    logSuccess("Removed s_hash value from ID token claims", args("id_token_claims", claims));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 27 with PreEnvironment

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

the class RemoveSubFromIdToken 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");
    claims.remove("sub");
    env.putObject("id_token_claims", claims);
    log("Removed sub value from ID token claims", args("id_token_claims", claims));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 28 with PreEnvironment

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

the class SendAuthorizationResponseWithResponseModeQuery method evaluate.

@Override
@PreEnvironment(required = CreateAuthorizationEndpointResponseParams.ENV_KEY)
@PostEnvironment(strings = "authorization_endpoint_response_redirect")
public Environment evaluate(Environment env) {
    JsonObject params = env.getObject(CreateAuthorizationEndpointResponseParams.ENV_KEY);
    String redirectUri = OIDFJSON.getString(params.remove("redirect_uri"));
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(redirectUri);
    for (String paramName : params.keySet()) {
        builder.queryParam(paramName, OIDFJSON.getString(params.get(paramName)));
    }
    String redirectTo = builder.toUriString();
    log("Redirecting back to client", args("uri", redirectTo));
    env.putString("authorization_endpoint_response_redirect", redirectTo);
    return env;
}
Also used : UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 29 with PreEnvironment

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

the class SetTokenEndpointAuthMethodsSupportedToPrivateKeyJWTOnly method evaluate.

@Override
@PreEnvironment(required = "server")
@PostEnvironment(required = "server")
public Environment evaluate(Environment env) {
    JsonArray data = new JsonArray();
    data.add("private_key_jwt");
    JsonObject server = env.getObject("server");
    server.add("token_endpoint_auth_methods_supported", data);
    env.putObject("server", server);
    log("Changed token_endpoint_auth_methods_supported to private_key_jwt only in server configuration", args("server_configuration", 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)

Example 30 with PreEnvironment

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

the class SetTokenEndpointAuthMethodsSupportedToTlsClientAuthOnly method evaluate.

@Override
@PreEnvironment(required = "server")
@PostEnvironment(required = "server")
public Environment evaluate(Environment env) {
    JsonArray data = new JsonArray();
    data.add("tls_client_auth");
    JsonObject server = env.getObject("server");
    server.add("token_endpoint_auth_methods_supported", data);
    env.putObject("server", server);
    log("Changed token_endpoint_auth_methods_supported to tls_client_auth only in server configuration", args("server_configuration", 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

PreEnvironment (net.openid.conformance.condition.PreEnvironment)591 JsonObject (com.google.gson.JsonObject)469 PostEnvironment (net.openid.conformance.condition.PostEnvironment)379 JsonElement (com.google.gson.JsonElement)143 JsonArray (com.google.gson.JsonArray)74 Instant (java.time.Instant)40 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)29 IOException (java.io.IOException)25 CertificateException (java.security.cert.CertificateException)24 ParseException (java.text.ParseException)24 KeyManagementException (java.security.KeyManagementException)20 KeyStoreException (java.security.KeyStoreException)20 UnrecoverableKeyException (java.security.UnrecoverableKeyException)20 InvalidKeySpecException (java.security.spec.InvalidKeySpecException)20 RestClientException (org.springframework.web.client.RestClientException)20 RestTemplate (org.springframework.web.client.RestTemplate)20 JsonPrimitive (com.google.gson.JsonPrimitive)18 Date (java.util.Date)17 JWK (com.nimbusds.jose.jwk.JWK)13 JOSEException (com.nimbusds.jose.JOSEException)11