Catalyst-Authentication-Realm-Adaptor
view release on metacpan or search on metacpan
NAME
Catalyst::Authentication::Realm::Adaptor - Adjust parameters of
authentication processes on the fly
VERSION
Version 0.02
SYNOPSIS
The Catalyst::Authentication::Realm::Adaptor allows for modification of
authentication parameters within the catalyst application. It's
basically a filter used to adjust authentication parameters globally
within the application or to adjust user retrieval parameters provided
by the credential in order to be compatible with a different store. It
provides for better control over interaction between credentials and
stores. This is particularly useful when working with external
authentication such as OpenID or OAuth.
__PACKAGE__->config(
'Plugin::Authentication' => {
'default' => {
class => 'Adaptor'
credential => {
class => 'Password',
password_field => 'secret',
password_type => 'hashed',
password_hash_type => 'SHA-1',
},
store => {
class => 'DBIx::Class',
user_class => 'Schema::Person',
},
store_adaptor => {
method => 'merge_hash',
merge_hash => {
status => [ 'temporary', 'active' ]
}
}
},
}
}
);
The above example ensures that no matter how $c->authenticate() is
called within your application, the key 'status' is added to the
authentication hash. This allows you to, among other things, set
parameters that should always be applied to your authentication process
or modify the parameters to better connect a credential and a store that
were not built to work together. In the above example, we are making
sure that the user search is restricted to those with a status of either
'temporary' or 'active.'
This realm works by intercepting the original authentication information
between the time "$c->authenticate($authinfo)" is called and the time
the realm's "$realm->authenticate($c,$authinfo)" method is called,
allowing for the $authinfo parameter to be modified or replaced as your
application requires. It can also operate after the call to the
credential's "authenticate()" method but before the call to the store's
"find_user" method.
If you don't know what the above means, you probably do not need this
module.
CONFIGURATION
The configuration for this module goes within your realm configuration
alongside your credential and store options.
This module can operate in two points during authentication processing.
The first is prior the realm's "authenticate" call (immediately after
the call to "$c->authenticate()".) To operate here, your filter options
should go in a hash under the key "credential_adaptor".
The second point is after the call to credential's "authenticate" method
but immediately before the call to the user store's "find_user" method.
To operate prior to "find_user", your filter options should go in a hash
( run in 0.984 second using v1.01-cache-2.11-cpan-39bf76dae61 )