Per view authentication policy

35 views
Skip to first unread message

David Libault

unread,
Mar 2, 2012, 8:29:05 AM3/2/12
to pylons...@googlegroups.com
Hi there,

I am looking for a clean way of implementing two or more different
authentication policies inside a pyramid application, and select the
policy a per view basis, maybe with an overload of the view_config
decorator.

From the little I understand, there is only one authentication policy
in the "registry", so it looks like the best way to go would be to :

- create an authentication policy "implementing" the
IAuthenticationPolicy interface
- "mark" view functions
- find the way from the request passed to the authentication
policy methods to the corresponding view
- inside the authentication policy, call authentication methods
based on the view "mark"
- set the new authentication policy as usual with
config.set_authentication_policy

Do you think this is possible ? Is there a better way ?

Regards,

David.

Chris McDonough

unread,
Mar 2, 2012, 12:17:07 PM3/2/12
to pylons...@googlegroups.com

Seems possible. You might also check out;

http://pypi.python.org/pypi/pyramid_multiauth/0.1.2

>
> Regards,
>
> David.
>


Reply all
Reply to author
Forward
0 new messages