Created
January 28, 2016 11:25
-
-
Save SlyDen/7965394a9674af2fb5a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyramid.authentication import AuthTktAuthenticationPolicy | |
class MyAuthenticationPolicy(AuthTktAuthenticationPolicy): | |
def authenticated_userid(self, request): | |
userid = self.unauthenticated_userid(request) | |
if userid: | |
if request.verify_userid_is_still_valid(userid): | |
return userid | |
def effective_principals(self, request): | |
principals = [Everyone] | |
userid = self.authenticated_userid(request) | |
if userid: | |
principals += [Authenticated, str(userid)] | |
return principals | |
authn_policy = MyAuthenticationPolicy() | |
config.set_authentication_policy(authn_policy) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment