【发布时间】:2018-03-02 07:30:05
【问题描述】:
我有一个带有 spring security LDAP auth 3.0.2 的 grails 3.2.5 应用程序。我需要从 LDAP Base 获取角色。
application.yml
plugin:
springsecurity:
#LDAP configuration
logout.postOnly: false
securityConfigType: 'InterceptUrlMap'
debug:
useFilter: true
#useBasicAuth: true
providerNames: ['ldapAuthProvider', 'anonymousAuthenticationProvider']
ldap:
context:
managerDn: '****'
managerPassword: '**password**'
server: 'ldap://**my server**'
authorities:
ignorePartialResultException: true # typically needed for Active Directory
groupSearchFilter: 'member={0}' # Active Directory specific - the example settings will
retrieveGroupRoles: true # to get Roles from LDAP
groupRoleAttribute: 'cn'
search:
base: DC=HQ,DC=ROOT,DC=AD
filter: 'sAMAccountName={0}' # for Active Directory you need this
searchSubtree: true
attributesToReturn: ['mailNickName','name','mail','extensionAttribute13','extensionAttribute14','extensionAttribute15','company'] # extra attributes you want returned
auth:
hideUserNotFoundExceptions: false
在文档中我发现我需要在application.yml 中设置“retrieveGroupRoles: true”,但是如何查看用户的角色?
您能告诉我如何在控制台或视图中显示用户角色以进行测试吗?我可以通过从 LDAP 中的用户列获取用户角色来重新定义(默认角色从 ldap 'cn' 获取)用户角色吗?
谢谢。
【问题讨论】:
标签: authentication grails spring-security active-directory ldap