我想了个办法,在某个auth type的属性里加一个authenticate用于注册此auth type的authenticate函数
[AUTH]
#user from ldap
AUTH_TYPE_LDAP = 100
AUTH_TYPE = [(100, {'type':'ldap','authenticate':'shapps.auth.ldap.authenticate'}})]
之后再写一个 get_authenticate 供调用,可以从auth_type查到authenticate函数