本文整理汇总了Python中tg.configuration.AppConfig.ldap方法的典型用法代码示例。如果您正苦于以下问题:Python AppConfig.ldap方法的具体用法?Python AppConfig.ldap怎么用?Python AppConfig.ldap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tg.configuration.AppConfig
的用法示例。
在下文中一共展示了AppConfig.ldap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FriendlyTimeoutPlugin
# 需要导入模块: from tg.configuration import AppConfig [as 别名]
# 或者: from tg.configuration.AppConfig import ldap [as 别名]
base_config.sa_auth.permission_class = model.Permission
# override this if you would like to provide a different who plugin for
# managing login and logout of your application
base_config.sa_auth.form_plugin = FriendlyTimeoutPlugin('/login', '/login_handler', '/post_login', '/logout_handler', '/post_logout', 'cookie')
myPlugin = MySQLAlchemyAuthenticatorPlugin(model.User, model.DBSession)
base_config.sa_auth.authenticators = [("MySQLAlchemyAuthenticatorPlugin", myPlugin)]
# You may optionally define a page where you want users to be redirected to
# on login:
base_config.sa_auth.post_login_url = '/post_login'
# You may optionally define a page where you want users to be redirected to
# on logout:
base_config.sa_auth.post_logout_url = '/post_logout'
base_config.ldap = Bunch()
base_config.ldap.host = '192.168.42.167'
base_config.ldap.port = 389
base_config.ldap.basedn = ['ou=sz,dc=r-pac,dc=local', 'ou=hk,dc=r-pac,dc=local','ou=sh,dc=r-pac,dc=local']
base_config.ldap.initdn = 'CN=adAuth,OU=System Account,DC=r-pac,DC=local'
base_config.ldap.initpw = 'ky2379ck$'
#===============================================================================
# add the cron job
#===============================================================================
base_config.call_on_startup=[]