Authentication in pyramid
Question: I am trying to set up a basic navigation in pyramid (1.4a1). According to the
tutorial given at
[tutorial](http://sluggo.scrapping.cc/python/Akhet/auth.html) _groupfinder_ is
called once we remember after login is successful. This works on my local but
when I try the same on a server it doesn't call groupfinder at all and keeps
looping between the two routes. Here's my code snippet:

    
    
    from pyramid.security import remember, forget, authenticated_userid
    from pyramid.httpexceptions import HTTPFound, HTTPForbidden
    from pyramid.threadlocal import get_current_registry
    from pyramid.url import route_url
    from pyramid.view import view_config, forbidden_view_config
    
    
    @view_config(route_name='index',
        renderer='templates:templates/index.pt',
        permission='Authenticated')
    def index_view(request):
        try:
            full_name = (request.user.first_name + ' ' + request.user.last_name)
        except:
            full_name = "Anonymous"
        return {"label": label, "user_name": full_name}
    
    @forbidden_view_config()
    def forbidden(request):
    
        if authenticated_userid(request):
            return HTTPForbidden()
    
        loc = request.route_url('login.view', _query=(('next', request.path),))
        return HTTPFound(location=loc)
    
    @view_config(route_name='login.view')
    def login_view(request):
    
        came_from =  request.route_url('index')
    
        #perform some authentication
        username = 'xyz'
        if authenticate(username):
            headers = remember(request, username)
            #user was authenticated. Must call groupfinder internally and set principal as authenticated.
            return HTTPFound(location=came_from, headers=headers)
        else:
            return HTTPForbidden('Could not authenticate.')
    
        return HTTPForbidden('Could not authenticate.')
    

Also, my ACL looks like: `__acl__ = [(Allow, Authenticated, 'Authenticated'),
DENY_ALL]`.

Can someone tell my why groupfinder is not being called? Is the request
routing happening properly? Also, the same code works on my local setup fine.
So there is no problem in groupfinder or ACL authorization settings.

Thanks much!


Answer: After lot of debugging and digging up I found out that the issue was very
simple. Don't know the reason for the behavior but I had added `secure = True`
attribute when calling `AuthTktAuthenticationPolicy()`. When I removed this
attribute, it started working.

