本文整理汇总了Python中MaKaC.authentication.AuthenticatorMgr.isSSOLoginActive方法的典型用法代码示例。如果您正苦于以下问题:Python AuthenticatorMgr.isSSOLoginActive方法的具体用法?Python AuthenticatorMgr.isSSOLoginActive怎么用?Python AuthenticatorMgr.isSSOLoginActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.authentication.AuthenticatorMgr
的用法示例。
在下文中一共展示了AuthenticatorMgr.isSSOLoginActive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _makeLoginProcess
# 需要导入模块: from MaKaC.authentication import AuthenticatorMgr [as 别名]
# 或者: from MaKaC.authentication.AuthenticatorMgr import isSSOLoginActive [as 别名]
def _makeLoginProcess(self):
# Check for automatic login
authManager = AuthenticatorMgr()
if (
authManager.isSSOLoginActive()
and len(authManager.getList()) == 1
and not Config.getInstance().getDisplayLoginPage()
):
self._redirect(urlHandlers.UHSignInSSO.getURL(authId=authManager.getDefaultAuthenticator().getId()))
return
if request.method != "POST":
return self._signInPage.display(returnURL=self._returnURL)
else:
li = LoginInfo(self._login, self._password)
av = authManager.getAvatar(li)
if not av:
return self._signInPageFailed.display(returnURL=self._returnURL)
elif not av.isActivated():
if av.isDisabled():
self._redirect(self._disabledAccountURL(av))
else:
self._redirect(self._unactivatedAccountURL(av))
return _("Your account is not active\nPlease activate it and try again")
else:
self._setSessionVars(av)
self._addExtraParamsToURL()
self._redirect(self._url)
示例2: _process
# 需要导入模块: from MaKaC.authentication import AuthenticatorMgr [as 别名]
# 或者: from MaKaC.authentication.AuthenticatorMgr import isSSOLoginActive [as 别名]
def _process(self):
authManager = AuthenticatorMgr()
if (authManager.isSSOLoginActive() and len(authManager.getList()) == 1 and
not Config.getInstance().getDisplayLoginPage()):
self._redirect(urlHandlers.UHSignInSSO.getURL(authId=authManager.getDefaultAuthenticator().getId()))
return
av = authManager.getAvatarByLogin(self._login).values()[0]
self._responseUtil.content_type='application/json'
if not av:
return '{"success":false,"message":"User not found"}'
elif not av.isActivated():
return '{"success":false,"message":"User not activated"}'
else:
return '{"success":true}'
示例3: _process
# 需要导入模块: from MaKaC.authentication import AuthenticatorMgr [as 别名]
# 或者: from MaKaC.authentication.AuthenticatorMgr import isSSOLoginActive [as 别名]
def _process(self):
authenticator = session.pop('Authenticator', None)
if authenticator is not None:
authManager = AuthenticatorMgr()
if not authManager.isSSOLoginActive():
raise MaKaCError(_("SSO Login is not active."))
av = authManager.SSOLogin(self, authenticator)
if not av:
raise MaKaCError(_("You could not login through SSO."))
self._setSessionVars(av)
self._redirect(self._url)
elif self._authId:
session['Authenticator'] = self._authId
if self._returnURL:
session['loginReturnURL'] = self._returnURL
self._redirect(str(urlHandlers.UHSignInSSO.getURL(authId=self._authId)))
else:
raise MaKaCError(_("You did not pass the authenticator"))