本文整理汇总了Java中org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint.setExceptionRenderer方法的典型用法代码示例。如果您正苦于以下问题:Java OAuth2AuthenticationEntryPoint.setExceptionRenderer方法的具体用法?Java OAuth2AuthenticationEntryPoint.setExceptionRenderer怎么用?Java OAuth2AuthenticationEntryPoint.setExceptionRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint
的用法示例。
在下文中一共展示了OAuth2AuthenticationEntryPoint.setExceptionRenderer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint; //导入方法依赖的package包/类
@Override
public void configure(HttpSecurity http) throws Exception {
super.configure(http);
http
.authorizeRequests()
.anyRequest()
.fullyAuthenticated()
.anyRequest()
.access("#oauth2.hasScopeMatching('openid') and #oauth2.hasScopeMatching('profile')");
ResourceServerSecurityConfigurer configurer = new ResourceServerSecurityConfigurer();
configurer.setBuilder(http);
configurer.tokenServices(introspectingTokenService());
CustomOAuth2ExceptionRenderer exceptionRenderer = new CustomOAuth2ExceptionRenderer();
OAuth2AuthenticationEntryPoint authenticationEntryPoint = new OAuth2AuthenticationEntryPoint();
authenticationEntryPoint.setExceptionRenderer(exceptionRenderer);
configurer.authenticationEntryPoint(authenticationEntryPoint);
OAuth2AccessDeniedHandler accessDeniedHandler = new OAuth2AccessDeniedHandler();
accessDeniedHandler.setExceptionRenderer(exceptionRenderer);
configurer.accessDeniedHandler(accessDeniedHandler);
configurer.configure(http);
}
示例2: oauth2AuthenticationEntryPoint
import org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint; //导入方法依赖的package包/类
@Bean
public OAuth2AuthenticationEntryPoint oauth2AuthenticationEntryPoint(){
OAuth2AuthenticationEntryPoint ep = new OAuth2AuthenticationEntryPoint();
ep.setExceptionRenderer(oauth2ExceptionRenderer());
return ep;
}