登录后如何在flask oidc应用程序中重定向并重定向登录用户?

问题描述

重定向到其他uri后,如何访问登录用户属性我有此路径/ myapp,可以在成功登录后将用户重定向到/ myapp / index,但是我不确定重定向后如何在函数中访问用户。 我正在使用OpenId connect,并且在映射到/ myapp / index的函数中无法再次登录用户,因为它将最终在SSO重定向循环中出现。

这是用户访问的网址,它将把他们重定向到SSO:

@app.route("/myapp")
@oidc.require_login
def main():
    try:
        if oidc is None and  oidc.user_loggedin is None:
            oidc.require_login
              
    except Exception as err:
        log.error("Could not authenticate user " + str(err))
        return render_template("unauthorized.html")

成功登录后,我提供的重定向uri映射如下:

@app.route("/myapp/index",methods=['GET'])
def index():
        #This is always None here
        if oidc is not None and oidc.user_loggedin is not None:
              print(g.oidc_id_token[ATTRIBUTE])
              #rest of the logic

              


我需要处理重定向URL中收到的代码以验证用户会话吗?

谢谢 凯

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...