Search in sources :

Example 51 with PostEnvironment

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

the class AddClientIdToAuthorizationEndpointRequest method evaluate.

@Override
@PreEnvironment(required = { "authorization_endpoint_request", "client" })
@PostEnvironment(required = "authorization_endpoint_request")
public Environment evaluate(Environment env) {
    JsonObject authorizationEndpointRequest = env.getObject("authorization_endpoint_request");
    String clientId = env.getString("client", "client_id");
    if (Strings.isNullOrEmpty(clientId)) {
        throw error("client_id missing/empty in client object");
    }
    authorizationEndpointRequest.addProperty("client_id", clientId);
    env.putObject("authorization_endpoint_request", authorizationEndpointRequest);
    logSuccess("Added client_id of '" + clientId + "' to authorization endpoint request", authorizationEndpointRequest);
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 52 with PostEnvironment

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

the class AddInitiateLoginUriAsNonHttpsToDynamicRegistrationRequest method evaluate.

@Override
@PreEnvironment(required = "dynamic_registration_request", strings = "initiate_login_uri")
@PostEnvironment(required = "dynamic_registration_request")
public Environment evaluate(Environment env) {
    String initiateLoginUri = env.getString("initiate_login_uri");
    JsonObject dynamicRegistrationRequest = env.getObject("dynamic_registration_request");
    initiateLoginUri = initiateLoginUri.replace("https://", "http://");
    dynamicRegistrationRequest.addProperty("initiate_login_uri", initiateLoginUri);
    env.putObject("dynamic_registration_request", dynamicRegistrationRequest);
    log("Added non-https version of initiate_login_uri to dynamic registration request", args("initiate_login_uri", initiateLoginUri));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment) PreEnvironment(net.openid.conformance.condition.PreEnvironment)

Example 53 with PostEnvironment

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

the class AddInitiateLoginUriToDynamicRegistrationRequest method evaluate.

@Override
@PreEnvironment(required = "dynamic_registration_request", strings = "initiate_login_uri")
@PostEnvironment(required = "dynamic_registration_request")
public Environment evaluate(Environment env) {
    String initiateLoginUri = env.getString("initiate_login_uri");
    JsonObject dynamicRegistrationRequest = env.getObject("dynamic_registration_request");
    dynamicRegistrationRequest.addProperty("initiate_login_uri", initiateLoginUri);
    env.putObject("dynamic_registration_request", dynamicRegistrationRequest);
    log("Added initiate_login_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 54 with PostEnvironment

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

the class AddIpV6FapiCustomerIpAddressToResourceEndpointRequest method evaluate.

@Override
@PostEnvironment(required = "resource_endpoint_request_headers")
public Environment evaluate(Environment env) {
    JsonObject headers = env.getObject("resource_endpoint_request_headers");
    String ip = env.getString("resource", "x_fapi_customer_ipv4_address");
    if (Strings.isNullOrEmpty(ip)) {
        ip = "2001:DB8::1893:25c8:1946";
    }
    headers.addProperty("x-fapi-customer-ip-address", ip);
    log("Added x-fapi-customer-ip-address containing IPv6 address to resource endpoint request headers", args("resource_endpoint_request_headers", headers));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) PostEnvironment(net.openid.conformance.condition.PostEnvironment)

Example 55 with PostEnvironment

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

the class AddFAPIAuthDateToResourceEndpointRequest method evaluate.

@Override
@PostEnvironment(required = "resource_endpoint_request_headers")
public Environment evaluate(Environment env) {
    // User just logged in
    Date loginDate = new Date();
    JsonObject headers = env.getObject("resource_endpoint_request_headers");
    headers.addProperty("x-fapi-auth-date", DateUtils.formatDate(loginDate));
    logSuccess("Added x-fapi-auth-date to resource endpoint request headers", args("resource_endpoint_request_headers", headers));
    return env;
}
Also used : JsonObject(com.google.gson.JsonObject) Date(java.util.Date) PostEnvironment(net.openid.conformance.condition.PostEnvironment)

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