public boolean supportRefreshToken() { return this.grantTypes != null && this.grantTypes.contains(GrantType.REFRESH_TOKEN.toString()); } }
public boolean supportRefreshToken() { return this.grantTypes != null && this.grantTypes.contains(GrantType.REFRESH_TOKEN.toString()); } }
public TokenRequestBuilder setGrantType(GrantType grantType) { this.parameters.put(OAuth.OAUTH_GRANT_TYPE, grantType == null ? null : grantType.toString()); return this; }
public TokenRequestBuilder setGrantType(GrantType grantType) { this.parameters.put(OAuth.OAUTH_GRANT_TYPE, grantType == null ? null : grantType.toString()); return this; }
@Override protected OAuthValidator<HttpServletRequest> initValidator() throws OAuthProblemException, OAuthSystemException { validators.put(GrantType.PASSWORD.toString(), UnauthenticatedPasswordValidator.class); validators.put(GrantType.AUTHORIZATION_CODE.toString(), UnauthenticatedAuthorizationCodeValidator.class); validators.put(GrantType.REFRESH_TOKEN.toString(), UnauthenticatedRefreshTokenValidator.class); return super.initValidator(); } }
@Override protected OAuthValidator<HttpServletRequest> initValidator() throws OAuthProblemException, OAuthSystemException { validators.put(GrantType.PASSWORD.toString(), PasswordValidator.class); validators.put(GrantType.CLIENT_CREDENTIALS.toString(), ClientCredentialValidator.class); validators.put(GrantType.AUTHORIZATION_CODE.toString(), AuthorizationCodeValidator.class); validators.put(GrantType.REFRESH_TOKEN.toString(), RefreshTokenValidator.class); return super.initValidator(); } }
@Override protected OAuthValidator<HttpServletRequest> initValidator() throws OAuthProblemException, OAuthSystemException { validators.put(GrantType.PASSWORD.toString(), PasswordValidator.class); validators.put(GrantType.CLIENT_CREDENTIALS.toString(), ClientCredentialValidator.class); validators.put(GrantType.AUTHORIZATION_CODE.toString(), AuthorizationCodeValidator.class); validators.put(GrantType.REFRESH_TOKEN.toString(), RefreshTokenValidator.class); return super.initValidator(); } }
@Override protected OAuthValidator<HttpServletRequest> initValidator() throws OAuthProblemException, OAuthSystemException { validators.put(GrantType.PASSWORD.toString(), UnauthenticatedPasswordValidator.class); validators.put(GrantType.AUTHORIZATION_CODE.toString(), UnauthenticatedAuthorizationCodeValidator.class); validators.put(GrantType.REFRESH_TOKEN.toString(), UnauthenticatedRefreshTokenValidator.class); return super.initValidator(); } }
public EcZfbOauthToken grantType(GrantType grantType) { this.grantType = (grantType == null ? null : grantType.toString()); putTokenRequestParam(OAuth.OAUTH_GRANT_TYPE, grantType); return this; }
public EcWechatOauthToken grantType(GrantType grantType) { putTokenRequestParam(OAuth.OAUTH_GRANT_TYPE, grantType == null ? null : grantType.toString()); return this; } @Override
private void validateSupportedGrantType(String requestedGrantType) { for (GrantType grantType : SUPPORTED_GRANT_TYPES) { if (grantType.toString().equalsIgnoreCase(requestedGrantType)) { return; } } throw ApiAuthenticationExceptionFactory .newOAuthException(OAuthAuthenticationException.class, OAuthAuthenticationException.UNSUPPORTED_GRANT_TYPE); }
@Override protected OAuthValidator<HttpServletRequest> initValidator() throws OAuthProblemException, OAuthSystemException { validators.put(GrantType.JWT_BEARER.toString(), JWTBearerValidator.class); return super.initValidator(); }
private void validateSupportedGrantType(String requestedGrantType) { for (GrantType grantType : SUPPORTED_GRANT_TYPES) { if (grantType.toString().equalsIgnoreCase(requestedGrantType)) { return; } } throw ApiAuthenticationExceptionFactory .newOAuthException(OAuthAuthenticationException.class, OAuthAuthenticationException.UNSUPPORTED_GRANT_TYPE); }
@Override protected OAuthValidator<HttpServletRequest> initValidator() throws OAuthProblemException, OAuthSystemException { validators.put(GrantType.JWT_BEARER.toString(), JWTBearerValidator.class); return super.initValidator(); }
private boolean isRefreshTokenType(OAuthRevocationRequestDTO revokeRequestDTO) { return StringUtils.equals(GrantType.REFRESH_TOKEN.toString(), revokeRequestDTO.getTokenType()); }
.put(GrantType.PASSWORD.toString(), PasswordValidator.class); supportedGrantTypeValidatorsTemp.put(GrantType.CLIENT_CREDENTIALS.toString(), ClientCredentialValidator.class); supportedGrantTypeValidatorsTemp.put(GrantType.AUTHORIZATION_CODE.toString(), AuthorizationCodeValidator.class); supportedGrantTypeValidatorsTemp.put(GrantType.REFRESH_TOKEN.toString(), RefreshTokenValidator.class); supportedGrantTypeValidatorsTemp.put(
grantTypes.add(GrantType.AUTHORIZATION_CODE.toString());
@Override public boolean validateScope(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { Set<String> idTokenNotAllowedGrantTypesSet = OAuthServerConfiguration.getInstance() .getIdTokenNotAllowedGrantTypesSet(); String grantType = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getGrantType(); // validating the authorization_code grant type with openid scope ignoring the IdTokenAllowed element defined // in the identity.xml if (GrantType.AUTHORIZATION_CODE.toString().equals(grantType)) { return true; } else if (!idTokenNotAllowedGrantTypesSet.contains(grantType)) { // if id_token is allowed for requested grant type. return true; } else { // Remove openid scope from the token message context. String[] scopes = (String[]) ArrayUtils.removeElement(tokReqMsgCtx.getScope(), OAuthConstants.Scope.OPENID); tokReqMsgCtx.setScope(scopes); if (log.isDebugEnabled()) { log.debug("id_token is not allowed for requested grant type: " + grantType + ". Removing 'openid' " + "scope."); } // Returning 'true' since we are dropping openid scope and don't need to prevent issuing the token for // remaining scopes. return true; } }
private OAuth2AccessTokenRespDTO createResponseWithTokenBean(AccessTokenDO existingAccessTokenDO, long expireTimeMillis, String scope) throws IdentityOAuth2Exception { OAuth2AccessTokenRespDTO tokenRespDTO = new OAuth2AccessTokenRespDTO(); tokenRespDTO.setAccessToken(existingAccessTokenDO.getAccessToken()); tokenRespDTO.setTokenId(existingAccessTokenDO.getTokenId()); if (issueRefreshToken() && OAuthServerConfiguration.getInstance().getSupportedGrantTypes().containsKey( GrantType.REFRESH_TOKEN.toString())) { tokenRespDTO.setRefreshToken(existingAccessTokenDO.getRefreshToken()); } if (expireTimeMillis > 0) { tokenRespDTO.setExpiresIn(expireTimeMillis / SECONDS_TO_MILISECONDS_FACTOR); tokenRespDTO.setExpiresInMillis(expireTimeMillis); } else { tokenRespDTO.setExpiresIn(Long.MAX_VALUE / SECONDS_TO_MILISECONDS_FACTOR); tokenRespDTO.setExpiresInMillis(Long.MAX_VALUE); } tokenRespDTO.setAuthorizedScopes(scope); return tokenRespDTO; }
if (grantType.equals(GrantType.CLIENT_CREDENTIALS.toString())) { String userId = client.getUserId(); String accessToken = oauthIssuerImpl.accessToken();