Catalyst::Plugin::Authenticationが変わってたメモ
結構前からかも
追記:LAPさんところが詳しい
http://catalyst.g.hatena.ne.jp/lapis25/20070806/p1
以下自分用メモ
__PACKAGE__->config->{authentication} = { default_realm => 'members', realms => { members => { credential => { class => 'Password', password_field => 'password', password_type => 'clear' }, store => { class => 'Minimal', users = { bob => { password => "s00p3r", editor => 'yes', roles => [qw/edit delete/], }, william => { password => "s3cr3t", roles => [qw/comment/], } } } } } };
Catalyst::Manual::Tutorial::Authenticationには
name: MyApp authentication: dbic: # Note this first definition would be the same as setting # __PACKAGE__->config->{authentication}->{dbic}->{user_class} = 'MyAppDB::User' # in lib/MyApp.pm (IOW, each hash key becomes a "name:" in the YAML file). # # This is the model object created by Catalyst::Model::DBIC from your # schema (you created 'MyAppDB::User' but as the Catalyst startup # debug messages show, it was loaded as 'MyApp::Model::MyAppDB::User'). # NOTE: Omit 'MyApp::Model' to avoid a component lookup issue in Catalyst 5.66 user_class: MyAppDB::User # This is the name of the field in your 'users' table that contains the user's name user_field: username # This is the name of the field in your 'users' table that contains the password password_field: password # Other options can go here for hashed passwords
とある
自分はいつものようにこんな感じで
authentication => { dbic => { user_class => 'DBIC::Userdata', user_field => 'account', password_field => 'password', password_type => 'hashed', password_hash_type => 'SHA-1', }, },
password_typeとpassword_hash_typeが追加されてた。
password_type はいろいろ
password_type This sets the password type. Often passwords are stored in crypted or hashed formats. In order for the password module to verify the plaintext password passed in, it must be told what format the password will be in when it is retreived from the user object. The supported options are: none No password check is done. An attempt is made to retrieve the user based on the information provided in the $c->authenticate() call. If a user is found, authentication is considered to be successful. clear The password in user is in clear text and will be compared directly. self_check This option indicates that the password should be passed to the check_password() routine on the user object returned from the store. crypted The password in user is in UNIX crypt hashed format. salted_hash The password in user is in salted hash format, and will be validated using Crypt::SaltedHash. If this password type is selected, you should also provide the password_salt_len config element to define the salt length. hashed If the user object supports hashed passwords, they will be used in conjunction with Digest. The following config elements affect the hashed configuration: password_hash_type The hash type used, passed directly to "new" in Digest. password_pre_salt Any pre-salt data to be passed to "add" in Digest before processing the password. password_post_salt Any post-salt data to be passed to "add" in Digest after processing the password.
auto_update_userとauto_create_userが増えてた
Catalyst::Authentication::Store::DBIx::Classで使える
auto_update_user( $authinfo, $c, $res ) This method is called if the realm's auto_update_user setting is true. It will delegate to the user object's auto_update method. auto_create_user( $authinfo, $c ) This method is called if the realm's auto_create_user setting is true. It will delegate to the user class' (resultset) auto_create method.