public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if (exception instanceof BadCredentialsException) { exception = new BadCredentialsException(exception.getMessage(), new BadClientCredentialsException()); } authenticationEntryPoint.commence(request, response, exception); } });
@ExceptionHandler(ClientRegistrationException.class) public ModelAndView handleClientRegistrationException(Exception e, ServletWebRequest webRequest) throws Exception { logger.info("Handling ClientRegistrationException error: " + e.getMessage()); return handleException(new BadClientCredentialsException(), webRequest); }
@ExceptionHandler(ClientRegistrationException.class) public ResponseEntity<OAuth2Exception> handleClientRegistrationException(Exception e) throws Exception { if (logger.isWarnEnabled()) { logger.warn("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage()); } return getExceptionTranslator().translate(new BadClientCredentialsException()); }
@Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if (exception instanceof BadCredentialsException) { exception = new BadCredentialsException(exception.getMessage(), new BadClientCredentialsException()); } authenticationEntryPoint.commence(request, response, exception); } });
@ExceptionHandler(ClientRegistrationException.class) public ModelAndView handleClientRegistrationException(Exception e, ServletWebRequest webRequest) throws Exception { logger.info("Handling ClientRegistrationException error: " + e.getMessage()); return handleException(new BadClientCredentialsException(), webRequest); }
@Test(expected = NoSuchClientException.class) public void testNonExistentClient2() throws Exception { Mockito.when(clientDetailsService.retrieve(input.getClientId(), IdentityZoneHolder.get().getId())).thenThrow(new BadClientCredentialsException()); endpoints.getClientDetails(input.getClientId()); }
@ExceptionHandler(ClientRegistrationException.class) public ModelAndView handleClientRegistrationException(Exception e, ServletWebRequest webRequest) throws Exception { logger.info("Handling ClientRegistrationException error: " + e.getMessage()); return handleException(new BadClientCredentialsException(), webRequest); }
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if (exception instanceof BadCredentialsException) { exception = new BadCredentialsException(exception.getMessage(), new BadClientCredentialsException()); } authenticationEntryPoint.commence(request, response, exception); } });
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if (exception instanceof BadCredentialsException) { exception = // NOSONAR new BadCredentialsException(exception.getMessage(), new BadClientCredentialsException()); } authenticationEntryPoint.commence(request, response, exception); } });
@Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { if (exception instanceof BadCredentialsException) { exception = new BadCredentialsException(exception.getMessage(), new BadClientCredentialsException()); } authenticationEntryPoint.commence(request, response, exception); } });
@ExceptionHandler(ClientRegistrationException.class) public ResponseEntity<OAuth2Exception> handleClientRegistrationException(Exception e) throws Exception { if (logger.isWarnEnabled()) { logger.warn("Handling error: " + e.getClass().getSimpleName() + ", " + e.getMessage()); } return getExceptionTranslator().translate(new BadClientCredentialsException()); }
@Override public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { Assert.notNull(tokenStore, "tokenStore must be set"); String token = request.getHeader("Authorization"); Assert.hasText(token, "token must be set"); if (isJwtBearerToken(token)) { token = token.substring(6).trim(); OAuth2AccessToken existingAccessToken = tokenStore.readAccessToken(token); OAuth2RefreshToken refreshToken; if (existingAccessToken != null) { if (existingAccessToken.getRefreshToken() != null) { LOGGER.info("remove refreshToken!", existingAccessToken.getRefreshToken()); refreshToken = existingAccessToken.getRefreshToken(); tokenStore.removeRefreshToken(refreshToken); } LOGGER.info("remove existingAccessToken!", existingAccessToken); tokenStore.removeAccessToken(existingAccessToken); } return; } else { throw new BadClientCredentialsException(); } }
@Override public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { Assert.notNull(tokenStore, "tokenStore must be set"); String token = request.getHeader("Authorization"); Assert.hasText(token, "token must be set"); if (isJwtBearerToken(token)) { token = token.substring(6); OAuth2AccessToken existingAccessToken = tokenStore.readAccessToken(token); OAuth2RefreshToken refreshToken; if (existingAccessToken != null) { if (existingAccessToken.getRefreshToken() != null) { LOGGER.info("remove refreshToken!", existingAccessToken.getRefreshToken()); refreshToken = existingAccessToken.getRefreshToken(); tokenStore.removeRefreshToken(refreshToken); } LOGGER.info("remove existingAccessToken!", existingAccessToken); tokenStore.removeAccessToken(existingAccessToken); } return; } else { throw new BadClientCredentialsException(); } }