Using a similar setup to my implicit flow forum post, I encounter the following error with "password" flow:
My resource config:Code:error="access_denied", error_description="Unable to obtain a new access token for resource 'rs'. The provider manager is not configured to support it."
The error is thrown after iterating over the AccessTokenProvider chain and not finding one that supports the instance of OAuth2ProtectedResourceDetails passed to AccessTokenProviderChain.obtainNewAccessTokenInter nalCode:<oauth:resource id="rs" type="password" client-id="client3" client-secret="${secret}" access-token-uri="${accessTokenUri}" scope="read" />
Code:protected OAuth2AccessToken obtainNewAccessTokenInternal(OAuth2ProtectedResourceDetails details, AccessTokenRequest request) throws UserRedirectRequiredException, AccessDeniedException { ... 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);Looking into it further, "details" is an instance of BaseOAuth2ProtectedResourceDetails, NOT ResourceOwnerPasswordResourceDetails, so supportsResource() returns false. How can this be?Code:public class ResourceOwnerPasswordAccessTokenProvider extends OAuth2AccessTokenSupport implements AccessTokenProvider { public boolean supportsResource(OAuth2ProtectedResourceDetails resource) { return resource instanceof ResourceOwnerPasswordResourceDetails && "password".equals(resource.getGrantType()); }
Adding another if-clause for ResourceOwnerPasswordResourceDetails should fix the problem. Am I missing something or shall I file a JIRA request?Code:public class ResourceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { @Override protected Class<?> getBeanClass(Element element) { if ("authorization_code".equals(element.getAttribute("type"))) { return AuthorizationCodeResourceDetails.class; } if ("implicit".equals(element.getAttribute("type"))) { return ImplicitResourceDetails.class; } if ("client_credentials".equals(element.getAttribute("type"))) { return ClientCredentialsResourceDetails.class; } return BaseOAuth2ProtectedResourceDetails.class; }


Reply With Quote
