use of com.predic8.membrane.core.interceptor.oauth2.ReusableJsonGenerator in project service-proxy by membrane.
the class TokenFlow method getResponse.
@Override
public Outcome getResponse() throws IOException {
Client client;
synchronized (session) {
client = authServer.getClientList().getClient(session.getUserAttributes().get("client_id"));
}
String grantTypes = client.getGrantTypes();
if (!grantTypes.contains("implicit")) {
exc.setResponse(OAuth2Util.createParameterizedJsonErrorResponse(exc, new ReusableJsonGenerator(), "error", "invalid_grant_type"));
return Outcome.RETURN;
}
return respondWithTokenAndRedirect(exc, generateAccessToken(client), authServer.getTokenGenerator().getTokenType(), session);
}
use of com.predic8.membrane.core.interceptor.oauth2.ReusableJsonGenerator in project service-proxy by membrane.
the class ClaimsParameter method writeCompleteJson.
public static String writeCompleteJson(ReusableJsonGenerator jsonGen, String[] userinfoClaims, String[] idTokenClaims) throws IOException {
if (userinfoClaims == null && idTokenClaims == null)
return "";
JsonGenerator gen = jsonGen.resetAndGet();
gen.writeStartObject();
if (userinfoClaims != null)
writeSingleClaimsObject(gen, USERINFO, userinfoClaims);
if (idTokenClaims != null)
writeSingleClaimsObject(gen, ID_TOKEN, idTokenClaims);
gen.writeEndObject();
return jsonGen.getJson();
}
Aggregations