public OAuth2Exception read(Class<? extends OAuth2Exception> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { MultiValueMap<String, String> data = delegateMessageConverter.read(null, inputMessage); Map<String,String> flattenedData = data.toSingleValueMap(); return OAuth2Exception.valueOf(flattenedData); }
private void maybeThrowExceptionFromHeader(String authenticateHeader, String headerType) { headerType = headerType.toLowerCase(); if (authenticateHeader.toLowerCase().startsWith(headerType)) { Map<String, String> headerEntries = StringSplitUtils.splitEachArrayElementAndCreateMap( StringSplitUtils.splitIgnoringQuotes(authenticateHeader.substring(headerType.length()), ','), "=", "\""); OAuth2Exception ex = OAuth2Exception.valueOf(headerEntries); if (ex instanceof InvalidTokenException) { // Special case: an invalid token can be renewed so tell the caller what to do throw new AccessTokenRequiredException(resource); } throw ex; } }
protected OAuth2AccessToken obtainNewAccessTokenInternal( OAuth2ProtectedResourceDetails details, AccessTokenRequest request) throws UserRedirectRequiredException, AccessDeniedException { if (request.isError()) { // there was an oauth error... throw OAuth2Exception.valueOf(request.toSingleValueMap()); } for (AccessTokenProvider tokenProvider : chain) { if (tokenProvider.supportsResource(details)) { return tokenProvider.obtainAccessToken(details, request); } } throw new OAuth2AccessDeniedException( "Unable to obtain a new access token for resource '" + details.getId() + "'. The provider manager is not configured to support it.", details); }
private void maybeThrowExceptionFromHeader(String authenticateHeader, String headerType) { headerType = headerType.toLowerCase(); if (authenticateHeader.toLowerCase().startsWith(headerType)) { Map<String, String> headerEntries = StringSplitUtils.splitEachArrayElementAndCreateMap( StringSplitUtils.splitIgnoringQuotes(authenticateHeader.substring(headerType.length()), ','), "=", "\""); OAuth2Exception ex = OAuth2Exception.valueOf(headerEntries); if (ex instanceof InvalidTokenException) { // Special case: an invalid token can be renewed so tell the caller what to do throw new AccessTokenRequiredException(resource); } throw ex; } }
public OAuth2Exception read(Class<? extends OAuth2Exception> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { MultiValueMap<String, String> data = delegateMessageConverter.read(null, inputMessage); Map<String,String> flattenedData = data.toSingleValueMap(); return OAuth2Exception.valueOf(flattenedData); }
protected OAuth2AccessToken obtainNewAccessTokenInternal(OAuth2ProtectedResourceDetails details, AccessTokenRequest request) throws UserRedirectRequiredException, AccessDeniedException { if(request.isError()) { throw OAuth2Exception.valueOf(request.toSingleValueMap()); } else { Iterator var3 = this.chain.iterator(); AccessTokenProvider tokenProvider; do { if(!var3.hasNext()) { throw new OAuth2AccessDeniedException("Unable to obtain a new access token for resource '" + details.getId() + "'. The provider manager is not configured to support it.", details); } tokenProvider = (AccessTokenProvider)var3.next(); } while(!tokenProvider.supportsResource(details)); if (tokenProvider != null) System.out.println("tokeProvider == " + tokenProvider.toString()); return tokenProvider.obtainAccessToken(details, request); } }
protected OAuth2AccessToken obtainNewAccessTokenInternal( OAuth2ProtectedResourceDetails details, AccessTokenRequest request) throws UserRedirectRequiredException, AccessDeniedException { if (request.isError()) { // there was an oauth error... throw OAuth2Exception.valueOf(request.toSingleValueMap()); } for (AccessTokenProvider tokenProvider : chain) { if (tokenProvider.supportsResource(details)) { return tokenProvider.obtainAccessToken(details, request); } } throw new OAuth2AccessDeniedException( "Unable to obtain a new access token for resource '" + details.getId() + "'. The provider manager is not configured to support it.", details); }