本文整理匯總了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