use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class FAPIBrazilAddConsentIdToClientScope method evaluate.
@Override
@PreEnvironment(strings = "consent_id", required = "client")
@PostEnvironment(required = "client")
public Environment evaluate(Environment env) {
String consentId = env.getString("consent_id");
JsonObject client = env.getObject("client");
JsonElement scopeElement = client.get("scope");
if (scopeElement == null) {
throw error("scope missing in client object");
}
String scope = OIDFJSON.getString(scopeElement);
if (Strings.isNullOrEmpty(scope)) {
throw error("scope empty in client object");
}
scope += " consent:" + consentId;
client.addProperty("scope", scope);
logSuccess("Added scope of '" + scope + "' to client's scope", client);
return env;
}
use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class ExtractExpiresInFromTokenEndpointResponse method evaluate.
@Override
@PreEnvironment(required = "token_endpoint_response")
@PostEnvironment(required = "expires_in")
public Environment evaluate(Environment env) {
JsonObject tokenEndpoint = env.getObject("token_endpoint_response");
JsonElement expiresInValue = tokenEndpoint.get("expires_in");
if (expiresInValue == null) {
throw error("'expires_in' not present in the token endpoint response. RFC6749 recommends expires_in is included.", tokenEndpoint);
}
/* Create our cut down JsonObject with just a single value in it */
JsonObject value = new JsonObject();
value.add("expires_in", expiresInValue);
env.putObject("expires_in", value);
logSuccess("Extracted 'expires_in'", value);
return env;
}
use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class ExtractIdTokenFromTokenResponse method evaluate.
@Override
@PreEnvironment(required = "token_endpoint_response")
@PostEnvironment(required = "id_token")
public Environment evaluate(Environment env) {
JsonObject client = env.getObject("client");
JsonObject clientJwks = env.getObject("client_jwks");
return extractJWT(env, "token_endpoint_response", "id_token", "id_token", client, clientJwks);
}
use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class ExtractImplicitHashToCallbackResponse method evaluate.
@Override
@PreEnvironment(strings = "implicit_hash")
@PostEnvironment(required = "callback_params")
public Environment evaluate(Environment env) {
String implicit_hash = env.getString("implicit_hash");
if (!Strings.isNullOrEmpty(implicit_hash)) {
// strip off the leading # character
String hash = implicit_hash.substring(1);
List<NameValuePair> parameters = URLEncodedUtils.parse(hash, Charset.defaultCharset(), '&');
log("Extracted response from URL fragment", args("parameters", parameters));
JsonObject o = new JsonObject();
for (NameValuePair pair : parameters) {
o.addProperty(pair.getName(), pair.getValue());
}
env.putObject("callback_params", o);
logSuccess("Extracted the hash values", o);
return env;
}
JsonObject o = new JsonObject();
env.putObject("callback_params", o);
logSuccess("implicit_hash is empty", o);
return env;
}
use of net.openid.conformance.condition.PostEnvironment in project conformance-suite by openid-certification.
the class ExtractJWKSDirectFromClientConfiguration method evaluate.
@Override
@PreEnvironment(required = "config")
@PostEnvironment(required = { "client_jwks", "client_public_jwks" })
public Environment evaluate(Environment env) {
// bump the client's internal JWK up to the root
JsonElement jwks = env.getElementFromObject("config", "client.jwks");
extractJwks(env, jwks);
return env;
}
Aggregations