NAME
Catalyst::Authentication::Store::Proxy - Delegates authentication logic to the user object
VERSION
version 0.0.1
SYNOPSIS
package MyApp::User;
use Moose;
extends 'Catalyst::Authentication::User';
sub from_session {
my ($self, $c, $id) = @_;
}
sub for_session {
my ($self, $c) = @_;
}
sub find_user {
my ($self, $authinfo, $c) = @_;
}
...
MyApp->config(
'Plugin::Authentication' => {
default => {
credential => {
class => 'Password',
password_type => 'none',
},
store => { class => 'Proxy' }
}
}
);
DESCRIPTION
This module makes it much easier to implement a custom authenication store. It delegates all the necessary method for user retrieval and session storage to a custom user class.
CONFIGURATION
user_class
Methods are delegated to this user class. It defaults to MyApp::User
, where MyApp
is the name of you application. The follwing methods have to be implemented in that class additionally to those mentioned in Catalyst::Authentication::User:
find_user ($c, $authinfo)
-
The second argument
$authinfo
is whatever was passed to$c->authenticate
. If the user can be authenticated using$authinfo
it has to return a new object of typeMyApp::User
orundef
. from_session ($c, $id)
-
Given a session
id
, this method returns an instance of the matchingMyApp::User
. for_session ($c)
-
This has to return a unique identifier of the user object which will be used as second parameter to "from_session".
handles
MyApp->config(
'Plugin::Authentication' => {
default => {
credential => { ... },
store => {
class => 'Proxy',
handles => {
find_user => 'find',
},
}
}
}
);
Change the name of the authentication methods to something else.
SEE ALSO
- Catalyst::Authentication::Store::DBIx::Class operates in the same way.
- Catalyst::Authentication::User explains what a user class should look like.
- Catalyst::Plugin::Authentication::Internals gives a good introduction into the authentication internals.
AUTHOR
Moritz Onken
COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 by Moritz Onken.
This is free software, licensed under:
The (three-clause) BSD License