Search in sources :

Example 1 with UnsupportedTokenType

use of io.gravitee.am.gateway.handler.oauth2.exception.UnsupportedTokenType in project gravitee-access-management by gravitee-io.

the class IntrospectionEndpoint method createRequest.

private static IntrospectionRequest createRequest(RoutingContext context) {
    String token = context.request().getParam(ConstantKeys.TOKEN_PARAM_KEY);
    String tokenTypeHint = context.request().getParam(ConstantKeys.TOKEN_TYPE_HINT_PARAM_KEY);
    if (token == null) {
        throw new InvalidRequestException();
    }
    IntrospectionRequest introspectionRequest = new IntrospectionRequest(token);
    if (tokenTypeHint != null) {
        try {
            introspectionRequest.setHint(TokenTypeHint.from(tokenTypeHint));
        } catch (IllegalArgumentException iae) {
            throw new UnsupportedTokenType(tokenTypeHint);
        }
    }
    return introspectionRequest;
}
Also used : UnsupportedTokenType(io.gravitee.am.gateway.handler.oauth2.exception.UnsupportedTokenType) IntrospectionRequest(io.gravitee.am.gateway.handler.oauth2.service.introspection.IntrospectionRequest) InvalidRequestException(io.gravitee.am.common.exception.oauth2.InvalidRequestException)

Aggregations

InvalidRequestException (io.gravitee.am.common.exception.oauth2.InvalidRequestException)1 UnsupportedTokenType (io.gravitee.am.gateway.handler.oauth2.exception.UnsupportedTokenType)1 IntrospectionRequest (io.gravitee.am.gateway.handler.oauth2.service.introspection.IntrospectionRequest)1