Search in sources :

Example 1 with ReusableJsonGenerator

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);
}
Also used : ReusableJsonGenerator(com.predic8.membrane.core.interceptor.oauth2.ReusableJsonGenerator) Client(com.predic8.membrane.core.interceptor.oauth2.Client)

Example 2 with ReusableJsonGenerator

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();
}
Also used : ReusableJsonGenerator(com.predic8.membrane.core.interceptor.oauth2.ReusableJsonGenerator) JsonGenerator(com.fasterxml.jackson.core.JsonGenerator)

Aggregations

ReusableJsonGenerator (com.predic8.membrane.core.interceptor.oauth2.ReusableJsonGenerator)2 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 Client (com.predic8.membrane.core.interceptor.oauth2.Client)1