List of usage examples for org.springframework.security.oauth2.client.resource OAuth2AccessDeniedException getHttpErrorCode
@Override public int getHttpErrorCode()
From source file:org.cloudfoundry.client.lib.oauth2.OauthClient.java
private OAuth2AccessToken createToken(String username, String password, String clientId, String clientSecret) { OAuth2ProtectedResourceDetails resource = getResourceDetails(username, password, clientId, clientSecret); AccessTokenRequest request = createAccessTokenRequest(username, password); ResourceOwnerPasswordAccessTokenProvider provider = createResourceOwnerPasswordAccessTokenProvider(); try {/*from ww w .j a va 2 s . c o m*/ return provider.obtainAccessToken(resource, request); } catch (OAuth2AccessDeniedException oauthEx) { HttpStatus status = HttpStatus.valueOf(oauthEx.getHttpErrorCode()); CloudFoundryException cfEx = new CloudFoundryException(status, oauthEx.getMessage()); cfEx.setDescription(oauthEx.getSummary()); throw cfEx; } }