pyramid_who is an extension for the pyramid web framework, providing an authentication policy based on the “new” repoze.who API, as found in version 2.0 and greater.
Configure the WhoV2AuthenticationPolicy into your pyramid application via imperative Python code:
import os
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.config import Configurator
from pyramid_who.whov2 import WhoV2AuthenticationPolicy
from my_package.users import verify_user
config_file = '/path/to/who.ini'
identifier_id = 'auth_tkt'
authentication_policy = WhoV2AuthenticationPolicy(config_file,
identifier_id,
callback=verify_user)
authorization_policy = ACLAuthorizationPolicy()
config = Configurator(authentication_policy=authentication_policy,
authorization_policy=authorization_policy)
or via ZCML:
1 2 3 4 5 6 7 8 9 10 | <include
package="pyramid_who"
file="meta.zcml"
/>
<whov2authenticatonpolicy
config_file="/path/to/who.ini"
identifier_id="auth_tkt"
callback="my_package.users.verify_user"
/>
|
If your application is deployed with the middleware from repoze.who active, the plugin will use the identity and API objects which the middleware injects into the WSGI environment. Otherwise, it will use the supplied configuration file to create a repoze.who API instance when needed.
Visit https://github.com/Pylons/pyramid_who/issues to report bugs. Visit https://github.com/Pylons/pyramid_who to download development or tagged versions.