All authentication can be handled transparently by a middleware component so
that your application doesn't need to worry about how to sign users in. This
means you can change how your users are authenticated without changing any
of your application code.
The authentication middleware can intercept 401 and 403 responses so that
the rest of you application doesn't even need to use AuthKit in order for
the authenticate part to work.
In a WSGI application it is as simple as:
1 | start_response('403 Access denied', [])
|
In Pylons this is as simple as writing:
The authenticate middleware supports the methods HTTP basic, HTTP digest,
form and cookie (with sign out), OpenID passurl or internal forward to
application. The middleware is either configured directly, from a generic
config file or a paste deploy setup.
If you are using paste deploy you can add the middleware and set:
authkit.enable = false
in your config to disable it. One way of enabling it is to do something
like this:
authkit.enable = true
authkit.method = basic
authkit.users = james:bananas
ben:apples
Any 401 status will now be handled and james can sign in with password
bananas and ben with apples. Nice and easy eh?
Of course there is a lot more to AuthKit. All the options are described
in this manual.