我正在尝试lua-resty-openidc
在NGINX服务器上进行配置。用户通过身份验证后,如何重定向回主页?当用户通过身份验证时,回调 url 会从服务器获取代码、session_state 和其他参数。一旦用户通过身份验证,这会导致加载问题。用户返回的网址类似于http://xyz.abc.com:8080/secured?code=32edkew2kjjjdf
https://github.com/pingidentity/lua-resty-openidc
我的配置如下所示。我想让用户回到http://xyz.abc.com:8080
. redirect_uri 应该是什么?
local opts = {
-- the full redirect URI must be protected by this script and becomes:
-- ngx.var.scheme.."://"..ngx.var.http_host..opts.redirect_uri_path
redirect_uri_path = "/secured",
discovery = "https://accounts.google.com/.well-known/openid-configuration",
client_id = "<client_id",
client_secret = "<client_secret"
--authorization_params = { hd="pingidentity.com" },
--scope = "openid email profile",
--iat_slack = 600,
}
lua-resty-openidc
本身处理重定向回您试图访问的原始页面。您不需要为此做任何特定的事情,它会在触发身份验证时找出该 URL,请参阅:https : //github.com/pingidentity/lua-resty-openidc/blob/master/lib/resty /openidc.lua#L539并将其存储在会话中。
它将拦截重定向回重定向 URI,请参阅:https : //github.com/pingidentity/lua-resty-openidc/blob/master/lib/resty/openidc.lua#L557并最终重定向回原始 URL ,见https://github.com/pingidentity/lua-resty-openidc/blob/master/lib/resty/openidc.lua#L350
重定向 URI 本身可以是任何路径,只要它不需要提供内容,因为 lua-resty-openidc 会拦截它并做自己的事情。它确实需要在提供者处注册。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句