/** * Executes the call to the REST Service and processes the response. * * @param accessToken The access token obtained from the oxAuth authorization request. * @return The service response. */ public UserInfoResponse execUserInfo(String accessToken) { setRequest(new UserInfoRequest(accessToken)); return exec(); }
@Override public String getHttpMethod() { if (getRequest().getAuthorizationMethod() == null || getRequest().getAuthorizationMethod() == AuthorizationMethod.AUTHORIZATION_REQUEST_HEADER_FIELD || getRequest().getAuthorizationMethod() == AuthorizationMethod.FORM_ENCODED_BODY_PARAMETER) { return HttpMethod.POST; } else { // AuthorizationMethod.URL_QUERY_PARAMETER return HttpMethod.GET; } }
/** * Executes the call to the REST Service and processes the response. * * @param accessToken The access token obtained from the oxAuth authorization request. * @return The service response. */ public ClientInfoResponse execClientInfo(String accessToken) { setRequest(new ClientInfoRequest(accessToken)); return exec(); }
private UserInfoResponse getUserInfo(final String accessToken) { logger.debug("Session validation successful. Getting user information"); final UserInfoClient userInfoClient = new UserInfoClient(this.openIdConfiguration.getUserInfoEndpoint()); final UserInfoResponse userInfoResponse = userInfoClient.execUserInfo(accessToken); logger.trace("userInfoResponse.getStatus(): '{}'", userInfoResponse.getStatus()); logger.trace("userInfoResponse.getErrorType(): '{}'", userInfoResponse.getErrorType()); logger.debug("userInfoResponse.getClaims(): '{}'", userInfoResponse.getClaims()); return userInfoResponse; }
/** * Executes the call to the REST service requesting to register and process the response. * * @param applicationType The application type. * @param clientName The client name. * @param redirectUri A list of space-delimited redirection URIs. * @return The service response. */ public RegisterResponse execRegister(ApplicationType applicationType, String clientName, List<String> redirectUri) { setRequest(new RegisterRequest(applicationType, clientName, redirectUri)); return exec(); }
public OpenIdConnectDiscoveryClient(String resource) throws URISyntaxException { setRequest(new OpenIdConnectDiscoveryRequest(resource)); setUrl(SCHEMA + getRequest().getHost() + PATH); }
/** * Executes the call to the REST Service requesting to end session and processes the response. * * @param idTokenHint The issued ID Token. * @param postLogoutRedirectUri The URL to which the RP is requesting that the End-User's User-Agent be redirected * after a logout has been performed. * @param state The state. * @return The service response. */ public EndSessionResponse execEndSession(String idTokenHint, String postLogoutRedirectUri, String state) { setRequest(new EndSessionRequest(idTokenHint, postLogoutRedirectUri, state)); return exec(); }
public TokenRequest build() { final TokenRequest request = new TokenRequest(grantType); request.setScope(scope); return request; } }
public static RSAPublicKey getRSAPublicKey(String jwkSetUri, String keyId, ClientExecutor clientExecutor) { RSAPublicKey publicKey = null; JwkClient jwkClient = new JwkClient(jwkSetUri); jwkClient.setExecutor(clientExecutor); JwkResponse jwkResponse = jwkClient.exec(); if (jwkResponse != null && jwkResponse.getStatus() == 200) { PublicKey pk = jwkResponse.getPublicKey(keyId); if (pk instanceof RSAPublicKey) { publicKey = (RSAPublicKey) pk; } } return publicKey; }
/** * Constructs a User Info Request. * * @param accessToken The access token obtained from the oxAuth authorization request. */ public UserInfoRequest(String accessToken) { this.accessToken = accessToken; setAuthorizationMethod(AuthorizationMethod.AUTHORIZATION_REQUEST_HEADER_FIELD); }
@Override public String getHttpMethod() { if (getRequest() != null) { if (StringUtils.isNotBlank(getRequest().getHttpMethod())) { return getRequest().getHttpMethod(); } if (getRequest().getRegistrationAccessToken() != null) { return HttpMethod.GET; } } return HttpMethod.POST; }
public ResponseAsserter assertRegisterResponse() { assertStatusOk(); json = assertJsonObject(); json.hasKeys(RegisterResponseParam.CLIENT_ID.toString(), CLIENT_SECRET.toString(), REGISTRATION_ACCESS_TOKEN.toString(), REGISTRATION_CLIENT_URI.toString(), CLIENT_ID_ISSUED_AT.toString(), CLIENT_SECRET_EXPIRES_AT.toString() ); return this; }
public static RegisterResponse valueOf(String p_json) { final RegisterResponse r = new RegisterResponse(); r.injectDataFromJson(p_json); return r; }
/** * Constructs a token revocation request. */ public TokenRevocationRequest() { super(); setContentType(MediaType.APPLICATION_FORM_URLENCODED); setAuthenticationMethod(AuthenticationMethod.CLIENT_SECRET_BASIC); }
/** * Constructs a Client Info Request. * * @param accessToken The access token obtained from the oxAuth authorization request. */ public ClientInfoRequest(String accessToken) { this.accessToken = accessToken; setAuthorizationMethod(AuthorizationMethod.AUTHORIZATION_REQUEST_HEADER_FIELD); }
@Override public String getHttpMethod() { if (request.getAuthorizationMethod() == null || request.getAuthorizationMethod() == AuthorizationMethod.AUTHORIZATION_REQUEST_HEADER_FIELD || request.getAuthorizationMethod() == AuthorizationMethod.URL_QUERY_PARAMETER) { return HttpMethod.GET; } else /*if (request.getAuthorizationMethod() == AuthorizationMethod.FORM_ENCODED_BODY_PARAMETER)*/ { return HttpMethod.POST; } }
@Override public String getHttpMethod() { if (request.getAuthorizationMethod() == null || request.getAuthorizationMethod() == AuthorizationMethod.AUTHORIZATION_REQUEST_HEADER_FIELD || request.getAuthorizationMethod() == AuthorizationMethod.FORM_ENCODED_BODY_PARAMETER) { return HttpMethod.POST; } else { // AuthorizationMethod.URL_QUERY_PARAMETER return HttpMethod.GET; } }
/** * Executes the call to the REST Service requesting the token revocation and processes the response. * * @param clientId The client identifier. * @param clientSecret The client secret. * @param token The token that the client wants to get revoked. * @return The token revocation response. */ public TokenRevocationResponse execTokenRevocation(String clientId, String clientSecret, String token) { return execTokenRevocation(clientId, clientSecret, token, null); }
public ResponseAsserter assertStatusOk() { assertStatus(200); return this; }
public static ECDSAPublicKey getECDSAPublicKey(String jwkSetUrl, String keyId) { ECDSAPublicKey publicKey = null; JwkClient jwkClient = new JwkClient(jwkSetUrl); JwkResponse jwkResponse = jwkClient.exec(); if (jwkResponse != null && jwkResponse.getStatus() == 200) { PublicKey pk = jwkResponse.getPublicKey(keyId); if (pk instanceof ECDSAPublicKey) { publicKey = (ECDSAPublicKey) pk; } } return publicKey; } }