How should environ['authkit.users'] be set in 'forward' method?

9 views
Skip to first unread message

zefciu

unread,
Mar 10, 2010, 5:45:24 PM3/10/10
to AuthKit
Hello!

I am trying to set up an application with custom login form, so I am
using forward method. However when authorizing an action with
'ValidAuthKitUser' permission I get 'no_authkit_users_in_environ'
exception. I see in the code, that this field in environ is
automatically set up in some other methods but not in forward. Where
should I set it up?

Best regards,
zefciu

James Gardner

unread,
Mar 11, 2010, 5:41:22 AM3/11/10
to AuthKit
It is set up in the AuthKit middleware. If you set up AuthKit as usual
and just specify the forward method in the config file it should all
work. What do your middleware stack and config file look like?

James

Szymon Pyżalski

unread,
Mar 11, 2010, 2:35:45 PM3/11/10
to aut...@googlegroups.com
Thanks for your quick reply. The part of my config about authkit looks like:

authkit.enable = true
authkit.setup.method = forward,cookie
authkit.forward.authenticate.user.type = maniabiegania.lib.users:Users
authkit.form.signinpath = /login
authkit.cookie.signoutpath = /logout
authkit.cookie.secret = GagsUbwodek8
authkit.cookie.name = authkit

My make_app in middleware.py is:
def make_app(global_conf, full_stack=True, static_files=True, **app_conf):
# Configure the Pylons environment
load_environment(global_conf, app_conf)

# The Pylons WSGI app
app = PylonsApp()

# Routing/Session/Cache Middleware
app = RoutesMiddleware(app, config['routes.map'])
app = SessionMiddleware(app, config)
app = CacheMiddleware(app, config)

# CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)

app = authkit.authenticate.middleware(app, app_conf)
if asbool(full_stack):
# Handle Python exceptions
app = ErrorHandler(app, global_conf, **config['pylons.errorware'])

# Display error documents for 401, 403, 404 status codes (and
# 500 when debug is disabled)
if asbool(config['debug']):
app = StatusCodeRedirect(app)
else:
app = StatusCodeRedirect(app, [400, 401, 403, 404, 500])

# Establish the Registry for this application
app = RegistryManager(app)

if asbool(static_files):
# Serve static files
static_app = StaticURLParser(config['pylons.paths']['static_files'])
app = Cascade([static_app, app])

return app

2010/3/11 James Gardner <ja...@pythonweb.org>:

> --
> You received this message because you are subscribed to the Google Groups "AuthKit" group.
> To post to this group, send email to aut...@googlegroups.com.
> To unsubscribe from this group, send email to authkit+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/authkit?hl=en.
>
>

--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/S d+(-)>- s+++:-- a- C++(+) UL P--- L+++(++) E--- W++(+)$ N+ o K--
w-- !O M- V- PS-- PE++ Y+ PGP+ t 5 X R(-) tv b+ DI+() D- G e+++
h!>---- r++>+++ y?
------END GEEK CODE BLOCK------

Szymon Pyżalski

unread,
Mar 12, 2010, 2:12:09 AM3/12/10
to aut...@googlegroups.com
Sorry. I posted it wrong. The config is in fact:

authkit.enable = true
authkit.setup.method = forward,cookie

authkit.form.authenticate.user.type = maniabiegania.lib.users:Users
authkit.forward.signinpath = /login
authkit.cookie.signoutpath = /logout
authkit.cookie.secret = CaxeatUfwondAgUgOcHesjabPijNeShnevAwcycs
authkit.cookie.name = authkit

zefciu

Reply all
Reply to author
Forward
0 new messages