使用 LTPA 令牌进行预身份验证
通过 Websphere LTPA SSO 令牌进行预身份验证来初始化 Spring 上下文的最佳方法是什么?现在我有一个自定义过滤器,它向 Spring Security 上下文提供 PreAuthorizedAuthenticationToken。是否有现有的过滤器可以自动为我执行此操作?当我尝试使用 PreAuth 类时,我总是遇到 GrantedAuthorities 的问题。
干杯
What is the best way to initialize a Spring context given pre-authentication through Websphere LTPA SSO token? Right now I have a custom filter that provides a PreAuthorizedAuthenticationToken to the Spring Security context. Is there an existing filter that would do this for me automatically? I have always run into trouble with GrantedAuthorities when I've tried to use the PreAuth classes.
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好的选择是通过扩展 AbstractPreAuthenticatedProcessingFilter 来拥有自定义预身份验证过滤器。
您可以从请求中获取令牌并在 getPreAuthenticatedCredentials() 方法中返回它。
您可以定义自己的 AuthenticationUserDetailsService 并将其传递给 PreAuthenticatedAuthenticationProvider,在这里您可以获取授予的权限并在 UserDetails 对象中返回它们
如果您已授予身份验证,不以默认前缀 ROLE 开头,您可以定义自定义前缀
Best option is to have a custom preauthentication filter by extending AbstractPreAuthenticatedProcessingFilter.
You can fetch the token from request and return it in getPreAuthenticatedCredentials() method.
You can define your own AuthenticationUserDetailsService and pass it to PreAuthenticatedAuthenticationProvider, here you can fetch the granted authorities and return them in UserDetails Object
If you have granted auth, not starting with default prefix ROLE, you can define your custom prefix