Hi !

  I'am trying test authkit loggin process. I use follow configuration.
This is my authkit configuration


--------- authkit configuration ---------
authkit.setup.enable = true
authkit.signin = /account/signin
authkit.setup.method = redirect, cookie
authkit.redirect.url = /account/signin

authkit.cookie.name = app2cookie
authkit.cookie.secret = some_secret
authkit.cookie.signoutpath = /account/logout
authkit.cookie.params.expires = 1800
authkit.cookie.params.secure = false
authkit.cookie.enforce = true
authkit.cookie.includeip = true
--------- authkit configuration ---------

I use my own login/logout process in controller:

--------- login actions ---------
    def signin(self):

        return render('/account/signin.mako')

    @authenticate_form
    def login(self):
        [...]
        # WebTest doesn't set REMOTE_ADDR so we do that
        if not request.environ.has_key('REMOTE_ADDR'):
            request.environ['REMOTE_ADDR'] = '127.0.0.1'

        request.environ['paste.auth_tkt.set_user'](request.POST
['username'])
        [...]

    @authorize(RemoteUser())
    def logout(self):

        if request.environ.has_key('REMOTE_USER'):
            return redirect_to(action='logout')

        return redirect_to(controller='account', action='signin')

--------- login actions ---------

and my test case looks like:

--------- test case ---------
    def test_login_success(self):

        """Sukcesywne logowanie"""

        username = 'login_success'
        password = 'nomatter'
        environ = dict(
            BROKER_SIMULATION_RESULT = 'success',
            GETUID_SIMULATION_RESULT = UID_SIMULATION_RESULT
        )

        response = self.app.get(url(controller='account',
action='signin'), extra_environ=environ)

        response.form['username'] = username
        response.form['password'] = password
        response.form['login_security'] = ''
        response = response.form.submit(extra_environ=environ)
        response = response.follow()
        # HERE IS THE PROBLEM #

        [...]

--------- test case ---------

In place # HERE IS THE PROBLEM # i get response

--------- bad cookie response ---------
Response: 200 OK
Content-Type: text/html
Set-Cookie: app2cookie=""; Path=/
<html><head><title></title></head>
<body><h1>Bad Cookie</h1>
<p>You have been signed out. If this problem persists
please clear your browser's cookies.</p>
</body></html>
--------- bad cookie response ---------

I guess there is some cookie "missed" while all of this process. I
don't know what I sholud do now. I also think about use
authkit.cookie.nouserincookie = true
But I red that this option break compatible with paste - so I don't
know how i could set value of "REMOTE_USER" by my own :D when
request.environ['paste.auth_tkt.set_user'] doesn't exist.

Greetings from Poland
--
Jan Koprowski
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to