Ldap 用户授权失败 - 未处理 Spring 身份验证 "Access is denied"
Ldap user authorization failed - Unhandled Spring authentication "Access is denied"
问题: Ldap 用户授权失败 - 未处理 Spring 身份验证 "Access is denied"
我们有 REST 服务,我们将通过 ldap 进行身份验证。
没有 ldap 安全性的 REST 服务按预期工作正常。
REST 服务 运行 在 PAS 实例上(Progress Technology)
当我按下登录按钮然后收到错误消息时,我们使用表单并填写了我们的凭据。当我阅读日志文件时,我可以看到:
登录 LDAP 服务器没问题,但当它尝试对用户进行身份验证时,我是个例外。
我们使用tomcat版本8.5.23
编辑 2018 年 1 月 16 日 09:24:
我已经用最新信息更新了整个问题。
如果我将此 grouprole 属性设置为 cn:
ldap.grouprole.attribute=cn
我在日志记录中看到我们取得了进展,但现在我们得到了另一个错误。
错误信息:
Access is denied - 403 status code
没有设置 ldap grouprole 属性的先前错误消息(供更多读者参考):
java.lang.IllegalArgumentException: Name must not be empty => initial error message
记录消息:
The oepas1.DATE.log shows the following:
09:04:40.550/20215 [catalina-exec-5] DEBUG o.s.l.c.s.AbstractContextSource - Got Ldap context on server 'our internal ip'
09:04:40.553/20218 [catalina-exec-5] DEBUG o.s.s.l.u.DefaultLdapAuthoritiesPopulator - Roles from search: [Makelaars]
09:04:40.560/20225 [catalina-exec-5] WARN c.p.a.s.s.OEAuthenticationLogger - Unhandled Spring authentication event: org.springframework.security.web.authentication.session.SessionFixationProtectionEvent[source=org.springframework.security.authentication.UsernamePasswordAuthenticationToken@5d0c4105: Principal: org.springframework.security.ldap.userdetails.InetOrgPerson@aa53233b: Dn: cn=Test C&C,ou=Users,ou=Domain BPB,dc=bpb,dc=be; Username: tc; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; CredentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_MAKELAARS; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@fffc7f0c: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 991C2EE38AA27E364FFB812CD6BFC9ABDD85795BF2F8.oepas1; Granted Authorities: ROLE_MAKELAARS]
我的配置:(oeablSecurity.properties在WEB-INF文件夹中)
http.all.authmanager=ldap
client.login.model=form
ldap.url="internal ldap url"
ldap.manager-dn=cn=Ad Reader,ou=Special Users,ou=Domain
BPB,dc=bpb,dc=be
ldap.manager-password=topsecret
ldap.root.dn=
ldap.grouprole.attribute= tc
ldap.groupsearch.filter=(member={0})
ldap.groupsearch.base=cn=Makelaars,ou=Groups,ou=Domain
BPB,dc=bpb,dc=be
ldap.usersearch.base=ou=Users,ou=Domain BPB,dc=bpb,dc=be
ldap.usersearch.filter=(sAMAccountName={0})
预期解:
我希望在我按下登录按钮并看到来自 REST 服务的响应 JSON 后,用户得到了正确的身份验证。 (使用 ldap 验证后)
您可以查看 oeablSecurity.csv 文件。
您需要在那里放置正确的角色。
例如
"web/test/","","hasAnyRole('rol1', 'rol2')"
问题: Ldap 用户授权失败 - 未处理 Spring 身份验证 "Access is denied"
我们有 REST 服务,我们将通过 ldap 进行身份验证。
没有 ldap 安全性的 REST 服务按预期工作正常。
REST 服务 运行 在 PAS 实例上(Progress Technology)
当我按下登录按钮然后收到错误消息时,我们使用表单并填写了我们的凭据。当我阅读日志文件时,我可以看到: 登录 LDAP 服务器没问题,但当它尝试对用户进行身份验证时,我是个例外。
我们使用tomcat版本8.5.23
编辑 2018 年 1 月 16 日 09:24:
我已经用最新信息更新了整个问题。
如果我将此 grouprole 属性设置为 cn:
ldap.grouprole.attribute=cn
我在日志记录中看到我们取得了进展,但现在我们得到了另一个错误。
错误信息:
Access is denied - 403 status code
没有设置 ldap grouprole 属性的先前错误消息(供更多读者参考):
java.lang.IllegalArgumentException: Name must not be empty => initial error message
记录消息:
The oepas1.DATE.log shows the following:
09:04:40.550/20215 [catalina-exec-5] DEBUG o.s.l.c.s.AbstractContextSource - Got Ldap context on server 'our internal ip'
09:04:40.553/20218 [catalina-exec-5] DEBUG o.s.s.l.u.DefaultLdapAuthoritiesPopulator - Roles from search: [Makelaars]
09:04:40.560/20225 [catalina-exec-5] WARN c.p.a.s.s.OEAuthenticationLogger - Unhandled Spring authentication event: org.springframework.security.web.authentication.session.SessionFixationProtectionEvent[source=org.springframework.security.authentication.UsernamePasswordAuthenticationToken@5d0c4105: Principal: org.springframework.security.ldap.userdetails.InetOrgPerson@aa53233b: Dn: cn=Test C&C,ou=Users,ou=Domain BPB,dc=bpb,dc=be; Username: tc; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; CredentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_MAKELAARS; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@fffc7f0c: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: 991C2EE38AA27E364FFB812CD6BFC9ABDD85795BF2F8.oepas1; Granted Authorities: ROLE_MAKELAARS]
我的配置:(oeablSecurity.properties在WEB-INF文件夹中)
http.all.authmanager=ldap
client.login.model=form
ldap.url="internal ldap url"
ldap.manager-dn=cn=Ad Reader,ou=Special Users,ou=Domain BPB,dc=bpb,dc=be
ldap.manager-password=topsecret
ldap.root.dn=
ldap.grouprole.attribute= tc
ldap.groupsearch.filter=(member={0})
ldap.groupsearch.base=cn=Makelaars,ou=Groups,ou=Domain BPB,dc=bpb,dc=be
ldap.usersearch.base=ou=Users,ou=Domain BPB,dc=bpb,dc=be
ldap.usersearch.filter=(sAMAccountName={0})
预期解:
我希望在我按下登录按钮并看到来自 REST 服务的响应 JSON 后,用户得到了正确的身份验证。 (使用 ldap 验证后)
您可以查看 oeablSecurity.csv 文件。 您需要在那里放置正确的角色。 例如 "web/test/","","hasAnyRole('rol1', 'rol2')"