gpt4 book ai didi

java - Keycloak SAML 重定向在登录后卡在循环中

转载 作者:行者123 更新时间:2023-11-28 22:16:08 26 4
gpt4 key购买 nike

我正在尝试使用 SAML 使用 Keycloak 保护 url:/monitoring

我修改了我的 web.xml :

<web-app>

<!-- Javamelody Access check -->
<login-config>
<auth-method>KEYCLOAK-SAML</auth-method>
<realm-name>this is ignored currently</realm-name>
</login-config>
<security-role>
<role-name>monitoringrole</role-name>
</security-role>
<security-constraint>
<web-resource-collection>
<web-resource-name>Monitoring</web-resource-name>
<url-pattern>/monitoring</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>monitoringrole</role-name>
</auth-constraint>
</security-constraint>

<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
</web-app>

我还使用正确的 Valve 修改了我的 tomcat7 的 context.xml 文件,并在 /WEB-INF 中添加了 keycloak-saml.xml。我已正确重定向到 IdP,但即使在成功登录后,我仍不断收到此消息:您已登录

我想我正在重定向到我正在保护的同一个 url,但是 keycloak 不应该授予我访问该页面的权限吗? Keycloak screen after successfully logging in

这是我在 keycloak 服务器上的配置: enter image description here

我是否遗漏了配置方面的内容?

最佳答案

面对同样的issue .通过 Keycloak 日志查找 Info: Assertion expired。在我的例子中,KeycloakService Provider (client) 在不同的机器上。错误的区别是他们的系统时间在不同的时区。

SP 根据其时区在 UTC 中创建 SAMLRequest,并且根据不同的时区在 UTC 中发送 SAMLResponse

因此,保持相同的时区解决了这个问题。

关于java - Keycloak SAML 重定向在登录后卡在循环中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50681822/

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