本文整理汇总了Python中oic.utils.authn.user.UserAuthnMethod.authenticated_as方法的典型用法代码示例。如果您正苦于以下问题:Python UserAuthnMethod.authenticated_as方法的具体用法?Python UserAuthnMethod.authenticated_as怎么用?Python UserAuthnMethod.authenticated_as使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oic.utils.authn.user.UserAuthnMethod
的用法示例。
在下文中一共展示了UserAuthnMethod.authenticated_as方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _UserAuthnMethod
# 需要导入模块: from oic.utils.authn.user import UserAuthnMethod [as 别名]
# 或者: from oic.utils.authn.user.UserAuthnMethod import authenticated_as [as 别名]
class _UserAuthnMethod(UserAuthnMethod):
def __init__(self, srv, ttl=5, authn_helper=None):
UserAuthnMethod.__init__(self, srv, ttl)
self.query_param = "upm_answer"
self.authn_helper = authn_helper
self.userauthnmethod = UserAuthnMethod(srv, ttl)
def __call__(self, *args, **kwargs):
raise NotImplemented
def __setattr__(self, name, value):
if name == "srv":
try:
self.authn_helper.__setattr__(name, value)
except Exception:
pass
try:
self.userauthnmethod.__setattr__(name, value)
except Exception:
pass
super(_UserAuthnMethod, self).__setattr__(name, value)
def set_srv(self, srv):
self.srv = srv
if self.authn_helper is not None:
self.authn_helper.srv = srv
def authenticated_as(self, cookie=None, **kwargs):
if self.authn_helper is not None:
return self.authn_helper.authenticated_as(cookie, **kwargs)
return self.userauthnmethod.authenticated_as(cookie, **kwargs)
def generateReturnUrl(self, return_to, uid):
return create_return_url(return_to, uid, **{self.query_param: "true"})