本文整理汇总了Python中oic.utils.authn.user.UserAuthnMethod类的典型用法代码示例。如果您正苦于以下问题:Python UserAuthnMethod类的具体用法?Python UserAuthnMethod怎么用?Python UserAuthnMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserAuthnMethod类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _UserAuthnMethod
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"})
示例2: __init__
def __init__(self, srv, lookup, userdb, spconf, url, return_to, verification_endpoint="verify", cache=None, bindings=None):
"""
Constructor for the class.
:param srv: Usually none, but otherwise the oic server.
:param return_to: The URL to return to after a successful
authentication.
"""
self.userdb = userdb
if cache is None:
self.cache_outstanding_queries = {}
else:
self.cache_outstanding_queries = cache
UserAuthnMethod.__init__(self, srv)
self.return_to = return_to
self.idp_query_param = "IdpQuery"
if bindings:
self.bindings = bindings
else:
self.bindings = [BINDING_HTTP_REDIRECT, BINDING_HTTP_POST,
BINDING_HTTP_ARTIFACT]
self.verification_endpoint = verification_endpoint
#Configurations for the SP handler. (pyOpSamlProxy.client.sp.conf)
self.sp_conf = importlib.import_module(spconf)
#self.sp_conf.BASE = self.sp_conf.BASE % url
ntf = NamedTemporaryFile(suffix="pyoidc.py", delete=True)
ntf.write("CONFIG = " + str(self.sp_conf.CONFIG).replace("%s", url))
ntf.seek(0)
self.sp = Saml2Client(config_file="%s" % ntf.name)
mte = lookup.get_template("unauthorized.mako")
argv = {
"message": "You are not authorized!",
}
self.not_authorized = mte.render(**argv)
示例3: __init__
def __init__(self, auth_handler_list):
"""
Constructor.
:param auth_handler_list: An ordered list of authentication classes (implementations of UserAuthnMethod).
"""
UserAuthnMethod.__init__(self, "")
self.auth_handler_list = auth_handler_list
#Amount of authentications that has to be performed.
self.steps = len(auth_handler_list) - 1
#Must be updated on the side.
self.ophandler = None
示例4: __init__
def __init__(self, srv, redirect_url, return_to):
"""
Constructor for the class.
:param srv: Provider for the oic server. If None then it is set by the baseclass. (oic.oic.provider.Provider)
:param redirect_url: URL that matches the method in the SpHandler class that performs authentication against
an IdP.
:param return_to: The URL to return to after a successful authentication. Generally the OP servers
authorization endpoint.
"""
UserAuthnMethod.__init__(self, srv)
self.redirect_url = redirect_url
self.return_to = return_to
示例5: __init__
def __init__(self, srv, cas_server, service_url, return_to, extra_validation = None):
"""
Constructor for the class.
:param srv: Usually none, but otherwise the oic server.
:param cas_server: Base URL to the cas server.
:param service_url: BASE url to the service that will use CAS. In this case the oic server's verify URL.
:param return_to: The URL to return to after a successful authentication.
"""
UserAuthnMethod.__init__(self, srv)
self.cas_server = cas_server
self.service_url = service_url
self.return_to = return_to
self.extra_validation = extra_validation
示例6: __init__
def __init__(self, srv, lookup, userdb, spconf, url, return_to,
cache=None,
bindings=None, userinfo=None, samlcache=None):
"""
Constructor for the class.
:param srv: Usually none, but otherwise the oic server.
:param return_to: The URL to return to after a successful
authentication.
"""
self.userdb = userdb
self.userinfo = userinfo
if cache is None:
self.cache_outstanding_queries = {}
else:
self.cache_outstanding_queries = cache
UserAuthnMethod.__init__(self, srv)
self.return_to = return_to
self.idp_query_param = "IdpQuery"
if bindings:
self.bindings = bindings
else:
self.bindings = [BINDING_HTTP_REDIRECT, BINDING_HTTP_POST,
BINDING_HTTP_ARTIFACT]
# TODO Why does this exist?
self.verification_endpoint = ""
# Configurations for the SP handler.
self.sp_conf = importlib.import_module(spconf)
config = SPConfig().load(self.sp_conf.CONFIG)
self.sp = Saml2Client(config=config)
mte = lookup.get_template("unauthorized.mako")
argv = {
"message": "You are not authorized!",
}
self.not_authorized = mte.render(**argv)
self.samlcache = self.sp_conf.SAML_CACHE
示例7: __init__
def __init__(self, srv, user):
UserAuthnMethod.__init__(self, srv)
self.user = user
示例8: __init__
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)
示例9: __init__
def __init__(self, authn_instance, end_point_index):
# Must be initiated before super constructor is called
self.authn_instance = authn_instance
UserAuthnMethod.__init__(self, None)
self.end_point_index = end_point_index
示例10: __init__
def __init__(self, srv, uid="Linda"):
UserAuthnMethod.__init__(self, srv)
self.user = uid
示例11: __init__
def __init__(self, authn_instance, end_point_index):
UserAuthnMethod.__init__(self, None)
self.authn_instance = authn_instance
self.end_point_index = end_point_index