当前位置: 首页>>代码示例>>Python>>正文


Python user.UserAuthnMethod类代码示例

本文整理汇总了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"})
开发者ID:its-dirg,项目名称:dirg-util,代码行数:34,代码来源:user.py

示例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)
开发者ID:devel-linotp,项目名称:pyoidc,代码行数:33,代码来源:saml.py

示例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
开发者ID:biancini,项目名称:IdProxy,代码行数:11,代码来源:util.py

示例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
开发者ID:biancini,项目名称:IdProxy,代码行数:12,代码来源:handler.py

示例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
开发者ID:hdknr,项目名称:pyoidc,代码行数:13,代码来源:user_cas.py

示例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
开发者ID:Omosofe,项目名称:pyoidc,代码行数:36,代码来源:saml.py

示例7: __init__

 def __init__(self, srv, user):
     UserAuthnMethod.__init__(self, srv)
     self.user = user
开发者ID:dash-dash,项目名称:pyoidc,代码行数:3,代码来源:test_oauth2_provider.py

示例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)
开发者ID:its-dirg,项目名称:dirg-util,代码行数:5,代码来源:user.py

示例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
开发者ID:Omosofe,项目名称:pyoidc,代码行数:5,代码来源:multi_auth.py

示例10: __init__

 def __init__(self, srv, uid="Linda"):
     UserAuthnMethod.__init__(self, srv)
     self.user = uid
开发者ID:dallerbarn,项目名称:oictest,代码行数:3,代码来源:cas.py

示例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
开发者ID:takehikokodama,项目名称:pyoidc,代码行数:5,代码来源:multi_auth.py


注:本文中的oic.utils.authn.user.UserAuthnMethod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。