Bar*_*oss 13 spring-security spring-security-oauth2
建议自定义页面OAuth审批页面的建议方法是:

我必须完全覆盖页面上的内容,需要添加样式,品牌等.实现这一目标的正确方法是什么?我在哪里可以看到默认页面的来源将其用作起点?
我还需要覆盖/ login页面,但我认为覆盖它的方法几乎是一样的.
Dav*_*yer 13
建议的方法是@RequestMapping为"/ oauth/confirm_access" 提供正常的Spring MVC .您可以查看WhitelabelApprovalEndpoint默认实现.别忘了使用@SessionAttributes("authorizationRequest").
除了@ DaveSyer的回答,这应该适用于大多数情况.有时基于配置和自定义,上述方法可能无效,如果Framew?orkEndpointHandlerMa?pping来自Spring Security OAuth包的顺序高于RequestMappingHandlerMapping您的应用程序.如果是这种情况,那么servlet调度程序将永远不会到达您的映射,并始终显示默认页面.
修复它的一种方法是改变映射器的顺序,假设Framew?orkEndpointHandlerMa?pping顺序是Order.LOWEST_PRECEDENCE - 2.
另一种方法是将批准页面设置为自定义URL,而不是映射Framew?orkEndpointHandlerMa?pping,因此servlet调度程序将到达应用程序的映射
@Configuration
@EnableAuthorizationServer
protected static class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {
@Autowired
private AuthorizationEndpoint authorizationEndpoint;
@PostConstruct
public void init() {
authorizationEndpoint.setUserApprovalPage("forward:/oauth/custom_confirm_access");
authorizationEndpoint.setErrorPage("forward:/oauth/custom_error");
}
}
Run Code Online (Sandbox Code Playgroud)
随着这样的结构映射/oauth/custom_confirm_access和/oauth/custom_error将被分别用作一个确认页面和一个错误页面.
| 归档时间: |
|
| 查看次数: |
7028 次 |
| 最近记录: |