[Catalyst] Using Progressive realms when username and password
fields are all different
Gavin Henry
gavin.henry at gmail.com
Thu Jun 28 21:51:01 GMT 2012
On 28 June 2012 21:50, Tim Anderson <tja824 at gmail.com> wrote:
> Gavin,
>
> Assuming you are using the Authentication plugin, you can define multiple
> realm objects, each of which allows you to specify the columns to be used
> for username and password. The documentation is pretty good on this one,
> and it's working well for me.
>
> http://search.cpan.org/~bobtfish/Catalyst-Plugin-Authentication-0.10020/lib/Catalyst/Plugin/Authentication.pm#CONFIGURATION
>
> Does that help?
Hi Tim,
That's what I already have. I have 3 realms defined and then a
Progressive realm listing them:
<progressive_oauth>
class Progressive
realms customers_oauth
realms partners_oauth
realms admins_oauth
<authinfo_munge>
<customers_oauth>
type customer
</customers_oauth>
<partners_oauth>
type partner
</partners_oauth>
<admins_oauth>
type admin
</admins_oauth>
</authinfo_munge>
</progressive_oauth>
<customers_oauth>
<credential>
class Password
password_type clear
username_field useralias
password_field uipass
</credential>
<store>
class DBIx::Class
user_model A2BillingDB::CcCard
</store>
</customers_oauth>
<partners_oauth>
<credential>
class Password
password_type clear
username_field login
password_field passwd
</credential>
<store>
class DBIx::Class
user_model A2BillingDB::CcAgent
</store>
</partners_oauth>
<admins_oauth>
<credential>
class Password
password_type hashed
password_hash_type Whirlpool
username_field login
password_field pwd_encoded
</credential>
<store>
class DBIx::Class
user_model A2BillingDB::CcUiAuthen
</store>
</admins_oauth>
So I do:
# Get the username and password from form
my $username = $c->request->params->{username};
my $password = $c->request->params->{password};
my $signin = $c->request->params->{signin};
if ($signin) {
# If the username and password values were found in form
if ( $username && $password ) {
# Attempt to log the user in
if (
$c->authenticate(
{
username => $username,
password => $password
},
'progressive_oauth'
)
)
{
I would expect me passing in username and password like above to then
map that to the config that defines username_field and password_field
but instead I get:
Thu Jun 28 22:50:22 2012] [error] Failed to load user data. You
passed [password,realm,type,username] to authenticate() but your user
source (A2BillingDB::CcAgent) only has these columns:
[id,datecreation,active,login,passwd,location,language,id_tariffgroup,options,credit,currency,locale,commission,vat,banner,perms,lastname,firstname,address,city,state,country,zipcode,phone,email,fax,company,com_balance,threshold_remittance,bank_info]
Check your authenticate() call.
Thanks.
--
http://www.suretecsystems.com/services/openldap/
http://www.surevoip.co.uk
More information about the Catalyst
mailing list