gpt4 book ai didi

spring - Ldap 用户授权失败 - 未处理的 Spring 身份验证 "Access is denied"

转载 作者:行者123 更新时间:2023-11-28 22:01:05 25 4
gpt4 key购买 nike

问题: Ldap 用户授权失败 - 未处理的 Spring 身份验证“访问被拒绝”

我们有 REST 服务,我们将通过 ldap 进行身份验证。
没有 ldap 安全性的 REST 服务按预期工作正常。
REST 服务在 PAS 实例上运行(Progress Technology)

当我按下登录按钮时,我们使用了表单并填写了我们的凭据,然后我收到了错误消息。当我阅读日志文件时,我可以看到:登录 LDAP 服务器没问题,但当它尝试对用户进行身份验证时,我是个异常(exception)。

我们使用tomcat 8.5.23版本

编辑 16/01/2018 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]

我的配置:(WEB-INF文件夹中的oeablSecurity.properties)

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 文件。您需要在那里放置正确的角色。例如"网络/测试/","","hasAnyRole('rol1', 'rol2')"

关于spring - Ldap 用户授权失败 - 未处理的 Spring 身份验证 "Access is denied",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48263007/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com