public static AuthenticationRequest parse(final URI uri, final Map<String,String> params)
throws ParseException {
// Parse and validate the core OAuth 2.0 autz request params in
// the context of OIDC
AuthorizationRequest ar = AuthorizationRequest.parse(uri, params);
ClientID clientID = ar.getClientID();
State state = ar.getState();
// Required in OIDC
URI redirectURI = ar.getRedirectionURI();
if (redirectURI == null)
throw new ParseException("Missing \"redirect_uri\" parameter",
OAuth2Error.INVALID_REQUEST, clientID, null, state);
ResponseType rt = ar.getResponseType();
try {
OIDCResponseTypeValidator.validate(rt);
} catch (IllegalArgumentException e) {
throw new ParseException("Unsupported \"response_type\" parameter: " + e.getMessage(),
OAuth2Error.UNSUPPORTED_RESPONSE_TYPE,
clientID, redirectURI, state);
}
// Required in OIDC, must include "openid" parameter
Scope scope = ar.getScope();
if (scope == null)
throw new ParseException("Missing \"scope\" parameter",
OAuth2Error.INVALID_REQUEST,
clientID, redirectURI, state);