gpt4 book ai didi

keycloak - 如何在使用 Keycloak 为 Ambassador OAuth2 过滤器注销后指定 redirectUrl?

转载 作者:行者123 更新时间:2023-12-05 07:03:31 24 4
gpt4 key购买 nike

我正在使用 Ambassador OAuth2 过滤器对 Keycloak 执行 OAuth2 授权。对于注销,我使用 RP 启动的注销,如 Docs of Ambassador 中所述。注销工作正常。但是我无法弄清楚如何提供Keycloak在成功注销后重定向到登录页面所需的重定向URL。结果,用户停留在 keycloak 的空白注销页面上。

RP 发起的注销如下所示

 const form = document.createElement('form');
form.method = 'post';
form.action = '/.ambassador/oauth2/logout?realm='+realm;
const xsrfInput = document.createElement('input');
xsrfInput.type = 'hidden';
xsrfInput.name = '_xsrf';
xsrfInput.value = getCookie("ambassador_xsrf."+realm);
form.appendChild(xsrfInput);
document.body.appendChild(form);
form.submit();

我希望 Ambassador 提供一种方法来将重定向 url 添加为查询参数或其他东西,但我找不到解决方案。有任何建议或解决方法吗?

最佳答案

我在 Ambassador 文档中发现了这一点,因为我做过几次,所以可能会被忽略:

Ambassador OAuth2 Settings

protectedOrigins: (You determine these, and must register them with your identity provider) Identifies hostnames that can appropriately set cookies for the application. Only the scheme (https://) and authority (example.com:1234) parts are used; the path part of the URL is ignored.

You will need to register each origin in protectedOrigins as an authorized callback endpoint with your identity provider. The URL will look like {{ORIGIN}}/.ambassador/oauth2/redirection-endpoint.

所以看起来大使硬编码了您需要在 Keycloak 中添加到 OAuth2 客户端的重定向端点 (redirect_uri)。

关于keycloak - 如何在使用 Keycloak 为 Ambassador OAuth2 过滤器注销后指定 redirectUrl?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63173573/

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