use*_*657 1 spring-security spring-ldap
可能重复:
使用Spring Security时,获取bean中当前用户名(即SecurityContext)信息的正确方法是什么?
spring security如何检索用户名
我使用spring ldap来验证我的网络应用程序,
<ldap-server id="sss" port="389"
url="ldap://ldap.example.com:389/ou=active,ou=employees,ou=people,o=example.com?uid?sub"/>
<authentication-manager alias="authenticationManager">
<ldap-authentication-provider
server-ref="sss"
role-prefix="ROLE_">
</ldap-authentication-provider>
</authentication-manager>
Run Code Online (Sandbox Code Playgroud)
它工作,但我不知道如何在登录页面填写用户名,因为我想在我的页面顶部显示它.
谢谢.
我找到了这个:
SecurityContextHolder.getContext().getAuthentication().getPrincipal()
Run Code Online (Sandbox Code Playgroud)
返回搜索条目.
| 归档时间: |
|
| 查看次数: |
1198 次 |
| 最近记录: |