org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint Java Examples

The following examples show how to use org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceServerConfig.java    From pacbot with Apache License 2.0 5 votes vote down vote up
/**
 * Inject your custom exception translator into the OAuth2 {@link AuthenticationEntryPoint}.
 *
 * @return AuthenticationEntryPoint
 */
@Bean
public AuthenticationEntryPoint authenticationEntryPoint() {
    final OAuth2AuthenticationEntryPoint entryPoint = new OAuth2AuthenticationEntryPoint();
    entryPoint.setExceptionTranslator(exceptionTranslator());
    return entryPoint;
}
 
Example #2
Source File: SecurityConfiguration.java    From nakadi with MIT License 5 votes vote down vote up
@Override
public void configure(final ResourceServerSecurityConfigurer resources) throws Exception {
    final OAuth2AuthenticationEntryPoint oAuth2AuthenticationEntryPoint = new OAuth2AuthenticationEntryPoint();
    oAuth2AuthenticationEntryPoint.setExceptionRenderer(new ProblemOauthExceptionRenderer());
    resources.authenticationEntryPoint(oAuth2AuthenticationEntryPoint);
    resources.tokenServices(tokenServices);
    resources.expressionHandler(new ExtendedOAuth2WebSecurityExpressionHandler());
    final OAuth2AccessDeniedHandler oAuth2AccessDeniedHandler = new OAuth2AccessDeniedHandler();
    oAuth2AccessDeniedHandler.setExceptionRenderer(new ProblemOauthExceptionRenderer());
    resources.accessDeniedHandler(oAuth2AccessDeniedHandler);
}
 
Example #3
Source File: OAuth2CustomResultConfiguration.java    From onetwo with Apache License 2.0 4 votes vote down vote up
@Bean
public OAuth2AuthenticationEntryPoint oauth2AuthenticationEntryPoint(ObjectMapperProvider objectMapperProvider){
	OAuth2AuthenticationEntryPoint ep = new OAuth2CustomAuthenticationEntryPoint();
	ep.setExceptionRenderer(oauth2ExceptionRenderer(objectMapperProvider));
	return ep;
}