【问题标题】:Where to define user roles in a spring protlet application?在 spring protlet 应用程序中在哪里定义用户角色?
【发布时间】:2012-12-24 03:30:29
【问题描述】:

在我的 Spring portlet 控制器中,我有一个这样注释的方法:

@PreAuthorize("hasRole('ROLE_BankUser') 

现在,当用户登录到门户并尝试访问 portlet 时,该方法从哪里知道用户是否具有“ROLE_BankUser”角色?是否会在用户拥有所有其他凭据(如登录名和密码)的 LDAP 中定义?

【问题讨论】:

    标签: spring-mvc spring-security websphere-portal user-roles


    【解决方案1】:

    检查您的 SpringSecurity 配置。您使用哪种 AuthenticationProvider 实现?在 LDAP 的情况下,它可能是 LdapAuthenticationProvider。如果是真的,那么您可以检查 LdapAuthenticationProvider.authenticate(Authentication authentication) 方法是如何实现的。它将通过一些 LdapAuthoritiesPopulator 实现从 LDAP 加载角色(取决于您的配置)

    【讨论】:

    • 我们正在使用 AuthenticationUserDetailsS​​ervice.loadUserDetails 方法
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-04-04
    • 1970-01-01
    • 2011-07-21
    • 2019-07-18
    • 2018-11-06
    • 2018-08-17
    • 2011-02-10
    相关资源
    最近更新 更多