List of usage examples for org.springframework.security.oauth2.common.exceptions OAuth2Exception OAuth2Exception
public OAuth2Exception(String msg, Throwable t)
From source file:com.springsource.greenhouse.develop.oauth.AppClientDetailsService.java
@Override public ClientDetails loadClientByClientId(String appId) throws OAuth2Exception { try {/*from w ww . j a v a 2 s .c o m*/ return clientDetailsFor(appRepository.findAppByApiKey(appId)); } catch (InvalidApiKeyException e) { throw new OAuth2Exception("Invalid OAuth App ID " + appId, e); } }
From source file:org.zalando.stups.oauth2.spring.client.StupsTokensAccessTokenProvider.java
@Override public OAuth2AccessToken obtainAccessToken(final OAuth2ProtectedResourceDetails details, final AccessTokenRequest parameters) { final AccessToken accessToken; try {/*from www.ja v a 2 s. com*/ accessToken = tokens.getAccessToken(tokenId); } catch (final AccessTokenUnavailableException e) { throw new OAuth2Exception("Could not obtain access token.", e); } final Map<String, String> tokenParams = new HashMap<>(); tokenParams.put(ACCESS_TOKEN, accessToken.getToken()); tokenParams.put(TOKEN_TYPE, OAuth2AccessToken.BEARER_TYPE); tokenParams.put(EXPIRES_IN, secondsTo(accessToken.getValidUntil())); return DefaultOAuth2AccessToken.valueOf(tokenParams); }
From source file:com.haulmont.restapi.ldap.LdapAuthController.java
@ExceptionHandler(Exception.class) public ResponseEntity<OAuth2Exception> handleException(Exception e) throws Exception { log.error("Exception in LDAP auth controller", e); return new ResponseEntity<>(new OAuth2Exception("Server error", e), HttpStatus.INTERNAL_SERVER_ERROR); }
From source file:com.haulmont.restapi.idp.IdpAuthController.java
@ExceptionHandler(MissingServletRequestParameterException.class) public ResponseEntity<OAuth2Exception> handleMissingServletRequestParameterException(Exception e) throws Exception { log.debug("Missing parameter in IDP auth controller: {}", e.getMessage()); return new ResponseEntity<>(new OAuth2Exception(e.getMessage(), e), HttpStatus.BAD_REQUEST); }
From source file:com.haulmont.restapi.idp.IdpAuthController.java
@ExceptionHandler(Exception.class) public ResponseEntity<OAuth2Exception> handleException(Exception e) throws Exception { log.error("Exception in IDP auth controller", e); return new ResponseEntity<>(new OAuth2Exception("Server error", e), HttpStatus.INTERNAL_SERVER_ERROR); }