public TokenRequestBuilder setGrantType(GrantType grantType) { this.parameters.put(OAuth.OAUTH_GRANT_TYPE, grantType == null ? null : grantType.toString()); return this; }
private boolean isAuthorizationCodeIssued(String responseType) { return StringUtils.contains(responseType, ResponseType.CODE.toString()); }
public boolean supportRefreshToken() { return this.grantTypes != null && this.grantTypes.contains(GrantType.REFRESH_TOKEN.toString()); } }
private boolean isCodeHashApplicable(String responseType) { // If the ID Token is issued from the Authorization Endpoint with a code c_hash should be generated. return responseType.contains(ResponseType.CODE.toString()) && !OAuthConstants.NONE.equalsIgnoreCase(responseType); }
public boolean supportRefreshToken() { return this.grantTypes != null && this.grantTypes.contains(GrantType.REFRESH_TOKEN.toString()); } }
public static boolean isImplicitResponseType(String responseType) { if(StringUtils.isNotBlank(responseType) && (responseType.contains(ResponseType.TOKEN.toString()) || responseType.contains(OAuthConstants.ID_TOKEN))) { return true; } return false; }
public TokenRequestBuilder setGrantType(GrantType grantType) { this.parameters.put(OAuth.OAUTH_GRANT_TYPE, grantType == null ? null : grantType.toString()); return this; }
public static boolean isImplicitResponseType(String responseType) { if (StringUtils.isNotBlank(responseType) && (responseType.contains(ResponseType.TOKEN.toString()) || responseType.contains(OAuthConstants.ID_TOKEN))) { return true; } return false; }
@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(); } }
public String generateForwardUrl(String registrationEndpoint, String authorizeUrl, String returnUrl) throws ServerException, UserException { try (DatabaseSession session = getBimServer().getDatabase().createSession()) { OAuthServer oAuthServer = session.querySingle(StorePackage.eINSTANCE.getOAuthServer_RegistrationEndpoint(), registrationEndpoint); if (oAuthServer == null) { throw new UserException("Application not registered"); } OAuthClientRequest request2 = OAuthClientRequest.authorizationLocation(authorizeUrl).setParameter("auth_type", "service").setClientId(oAuthServer.getClientId()).setRedirectURI(returnUrl).setResponseType(ResponseType.CODE.toString()).setState("state").buildQueryMessage(); return request2.getLocationUri(); } catch (Exception e) { return handleException(e); } }
@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(); } }
if (responseType.equals(ResponseType.CODE.toString())) { builder.setCode(oauthCode.getCode());
@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(), 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); }
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(); }
@Override protected OAuthValidator<HttpServletRequest> initValidator() throws OAuthProblemException, OAuthSystemException { validators.put(GrantType.JWT_BEARER.toString(), JWTBearerValidator.class); return super.initValidator(); }