本文整理汇总了Python中service_api.ServiceApi.signon_user方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceApi.signon_user方法的具体用法?Python ServiceApi.signon_user怎么用?Python ServiceApi.signon_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类service_api.ServiceApi
的用法示例。
在下文中一共展示了ServiceApi.signon_user方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: signon
# 需要导入模块: from service_api import ServiceApi [as 别名]
# 或者: from service_api.ServiceApi import signon_user [as 别名]
def signon():
def nav():
if 'login_redir' in session:
return redirect(session.pop('login_redir'))
return redirect('/')
user_name = request.args.get('user')
if user_name:
if not PRODUCTION:
ServiceApi.signon_user_testmode(user_name)
return nav()
# carriage returns were removed on the cilogon portal side,
# restore them before processing
raw_cert = request.args.get('cert')
if not raw_cert:
return nav()
certificate = base64.b64decode(raw_cert)
# call backend to signon user
# will stash user id, expiry, is_registered and roles in session
ServiceApi.signon_user(certificate)
return nav()
示例2: signon
# 需要导入模块: from service_api import ServiceApi [as 别名]
# 或者: from service_api.ServiceApi import signon_user [as 别名]
def signon():
user_name = request.args.get('user')
if user_name:
ServiceApi.signon_user_testmode(user_name)
return redirect('/')
# carriage returns were removed on the cilogon portal side,
# restore them before processing
raw_cert = request.args.get('cert')
if not raw_cert:
return redirect('/')
certificate = base64.b64decode(raw_cert)
# call backend to signon user
# will stash user id, expiry, is_registered and roles in session
ServiceApi.signon_user(certificate)
if session['is_registered'] == False:
# redirect to registration screen
return redirect('/userprofile')
else:
return redirect('/')