Search in sources :

Example 41 with PostEnvironment

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

the class AddLogoUriToDynamicRegistrationRequest method evaluate.

@Override
@PreEnvironment(required = "dynamic_registration_request", strings = "logo_uri")
@PostEnvironment(required = "dynamic_registration_request")
public Environment evaluate(Environment env) {
    JsonObject dynamicRegistrationRequest = env.getObject("dynamic_registration_request");
    String logoUri = env.getString("logo_uri");
    dynamicRegistrationRequest.addProperty("logo_uri", logoUri);
    env.putObject("dynamic_registration_request", dynamicRegistrationRequest);
    log("Added logo_uri to dynamic registration request", args("dynamic_registration_request", dynamicRegistrationRequest));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 42 with PostEnvironment

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

the class AddMultipleHintsToAuthorizationEndpointRequest method evaluate.

@Override
@PreEnvironment(required = "authorization_endpoint_request")
@PostEnvironment(required = "authorization_endpoint_request")
public Environment evaluate(Environment env) {
    JsonObject authorizationEndpointRequest = env.getObject("authorization_endpoint_request");
    // add two hints value to authorization endpoint request
    String hintType1 = "login_hint";
    String hintValue1 = "join@example.com";
    authorizationEndpointRequest.addProperty(hintType1, hintValue1);
    String hintType2 = "login_hint_token";
    String hintValue2 = "xxxxxxxxxxxxxxxxxxxx";
    authorizationEndpointRequest.addProperty(hintType2, hintValue2);
    env.putObject("authorization_endpoint_request", authorizationEndpointRequest);
    logSuccess("Added two hints value to authorization endpoint request", args(hintType1, hintValue1, hintType2, hintValue2));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 43 with PostEnvironment

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

the class AddMultipleRedirectUriToDynamicRegistrationRequest method evaluate.

@Override
@PreEnvironment(required = "dynamic_registration_request", strings = "redirect_uri")
@PostEnvironment(required = "dynamic_registration_request")
public Environment evaluate(Environment env) {
    if (!env.containsObject("dynamic_registration_request")) {
        throw error("No dynamic registration request found");
    }
    JsonObject dynamicRegistrationRequest = env.getObject("dynamic_registration_request");
    String redirectUri = env.getString("redirect_uri");
    if (Strings.isNullOrEmpty(redirectUri)) {
        throw error("No redirect_uri found");
    }
    JsonArray redirectUris = new JsonArray();
    redirectUris.add(redirectUri);
    redirectUris.add("https://example.org/redirect");
    dynamicRegistrationRequest.add("redirect_uris", redirectUris);
    env.putObject("dynamic_registration_request", dynamicRegistrationRequest);
    log("Added redirect_uris array to dynamic registration request", args("dynamic_registration_request", dynamicRegistrationRequest));
    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 44 with PostEnvironment

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

the class AddCdrXCdsClientHeadersToResourceEndpointRequest method evaluate.

@Override
@PreEnvironment(required = "resource_endpoint_request_headers")
@PostEnvironment(required = "resource_endpoint_request_headers")
public Environment evaluate(Environment env) {
    JsonObject headers = env.getObject("resource_endpoint_request_headers");
    // example value taken from https://consumerdatastandardsaustralia.github.io/standards/#http-headers
    // the contents of this header is very poorly defined, the format and contents is entirely at the discretion
    // of the OAuth2 client.
    headers.addProperty("x-cds-client-headers", "TW96aWxsYS81LjAgKFgxMTsgTGludXggeDg2XzY0KSBBcHBsZVdlYktpdC81MzcuMzYgKEtIVE1MLCBsaWtlIEdlY2tvKSBDaHJvbWUvNzkuMC4zOTQ1Ljg4IFNhZmFyaS81MzcuMzY=");
    log("Added x-cds-client-headers to resource_endpoint_request_headers", headers);
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 45 with PostEnvironment

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

the class AddCibaRequestSigningPS256ToDynamicRegistrationRequest method evaluate.

@Override
@PreEnvironment(required = "dynamic_registration_request")
@PostEnvironment(required = "dynamic_registration_request")
public Environment evaluate(Environment env) {
    JsonObject dynamicRegistrationRequest = env.getObject("dynamic_registration_request");
    dynamicRegistrationRequest.addProperty("backchannel_authentication_request_signing_alg", "PS256");
    env.putObject("dynamic_registration_request", dynamicRegistrationRequest);
    log("Added CIBA request sign alg to dynamic registration request", args("dynamic_registration_request", dynamicRegistrationRequest));
    return env;
}
Also used : 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