/** * <p> * Executes the call to the REST Service requesting the authorization and * processes the response. * </p> * <p> * If the authorization server issued a refresh token to the client, the * client can make a request to the token endpoint for a new access token. * </p> * * @param scope The scope of the access request. This value is optional. * @param refreshToken The refresh token issued to the client. This value is * required. * @param clientId The client identifier. * @param clientSecret The client secret. * @return The token response. */ public TokenResponse execRefreshToken(String scope, String refreshToken, String clientId, String clientSecret) { setRequest(new TokenRequest(GrantType.REFRESH_TOKEN)); getRequest().setScope(scope); getRequest().setRefreshToken(refreshToken); getRequest().setAuthUsername(clientId); getRequest().setAuthPassword(clientSecret); return exec(); }
String clientId, String clientSecret) { setRequest(new TokenRequest(GrantType.RESOURCE_OWNER_PASSWORD_CREDENTIALS)); getRequest().setUsername(username); getRequest().setPassword(password); getRequest().setScope(scope); getRequest().setAuthUsername(clientId); getRequest().setAuthPassword(clientSecret);
/** * <p> * Executes the call to the REST Service requesting the authorization and * processes the response. * </p> * <p> * The client can request an access token using only its client credentials * when the client is requesting access to the protected resources under its * control, or those of another resource owner which has been previously * arranged with the authorization server. The client credentials grant type * must only be used by confidential clients. * </p> * * @param scope The scope of the access request. This parameter is optional. * @param clientId The client identifier. * @param clientSecret The client secret. * @return The token response. */ public TokenResponse execClientCredentialsGrant( String scope, String clientId, String clientSecret) { setRequest(new TokenRequest(GrantType.CLIENT_CREDENTIALS)); getRequest().setScope(scope); getRequest().setAuthUsername(clientId); getRequest().setAuthPassword(clientSecret); return exec(); }
String clientId, String clientSecret) { setRequest(new TokenRequest(GrantType.AUTHORIZATION_CODE)); getRequest().setCode(code); getRequest().setRedirectUri(redirectUri); getRequest().setAuthUsername(clientId); getRequest().setAuthPassword(clientSecret);
/** * <p> * Executes the call to the REST Service requesting the authorization and * processes the response. * </p> * <p> * The client uses an extension grant type by specifying the grant type * using an absolute URI (defined by the authorization server) as the value * of the grant_type parameter of the token endpoint, and by adding any * additional parameters necessary. * </p> * * @param grantTypeUri Absolute URI. * @param assertion Assertion grant type. * @param clientId The client identifier. * @param clientSecret The client secret. * @return The token response. */ public TokenResponse execExtensionGrant(String grantTypeUri, String assertion, String clientId, String clientSecret) { GrantType grantType = GrantType.fromString(grantTypeUri); setRequest(new TokenRequest(grantType)); getRequest().setAssertion(assertion); getRequest().setAuthUsername(clientId); getRequest().setAuthPassword(clientSecret); return exec(); }
if (getRequest().getGrantType() != null) { clientRequest.formParameter("grant_type", getRequest().getGrantType()); if (StringUtils.isNotBlank(getRequest().getCode())) { clientRequest.formParameter("code", getRequest().getCode()); if (StringUtils.isNotBlank(getRequest().getCodeVerifier())) { clientRequest.formParameter("code_verifier", getRequest().getCodeVerifier()); if (StringUtils.isNotBlank(getRequest().getRedirectUri())) { clientRequest.formParameter("redirect_uri", getRequest().getRedirectUri()); if (StringUtils.isNotBlank(getRequest().getUsername())) { clientRequest.formParameter("username", getRequest().getUsername()); if (StringUtils.isNotBlank(getRequest().getPassword())) { clientRequest.formParameter("password", getRequest().getPassword()); if (StringUtils.isNotBlank(getRequest().getScope())) { clientRequest.formParameter("scope", getRequest().getScope()); if (StringUtils.isNotBlank(getRequest().getAssertion())) { clientRequest.formParameter("assertion", getRequest().getAssertion()); if (StringUtils.isNotBlank(getRequest().getRefreshToken())) { clientRequest.formParameter("refresh_token", getRequest().getRefreshToken()); if (getRequest().getAuthenticationMethod() == AuthenticationMethod.CLIENT_SECRET_POST) { if (getRequest().getAuthUsername() != null && !getRequest().getAuthUsername().isEmpty()) {