本文整理汇总了Python中oic.utils.authn.user.UsernamePasswordMako.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python UsernamePasswordMako.__init__方法的具体用法?Python UsernamePasswordMako.__init__怎么用?Python UsernamePasswordMako.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oic.utils.authn.user.UsernamePasswordMako
的用法示例。
在下文中一共展示了UsernamePasswordMako.__init__方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from oic.utils.authn.user import UsernamePasswordMako [as 别名]
# 或者: from oic.utils.authn.user.UsernamePasswordMako import __init__ [as 别名]
def __init__(self, srv, ldapsrv, return_to, pattern, mako_template,
template_lookup, ldap_user="", ldap_pwd="",
verification_endpoints=["verify"]):
"""
:param srv: The server instance
:param ldapsrv: Which LDAP server to us
:param return_to: Where to send the user after authentication
:param pattern: How to find the entry to log in to.
Expected to be a dictionary where key is one of "dn" or "search".
And the value a dictionary with values depends on the key:
If "dn" only "pattern".
If "search": "base", "filterstr", "scope"
"base" and "filterstr" MUST be present
:param ldap_user: If a search has to be done first which user to do
that as. "" is a anonymous user
:param ldap_pwd: The password for the ldap_user
"""
UsernamePasswordMako.__init__(
self, srv, mako_template, template_lookup, None, return_to,
verification_endpoints=verification_endpoints)
self.ldap = ldap.initialize(ldapsrv)
self.ldap.protocol_version = 3
self.ldap.set_option(ldap.OPT_REFERRALS, 0)
self.pattern = pattern
self.ldap_user = ldap_user
self.ldap_pwd = ldap_pwd