Keedi Kim > Catalyst-Authentication-Store-Fey-ORM > Catalyst::Authentication::Store::Fey::ORM

Download:
Catalyst-Authentication-Store-Fey-ORM-0.001.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.001   Source  

NAME ^

Catalyst::Authentication::Store::Fey::ORM - A storage class for Catalyst Authentication using Fey::ORM

VERSION ^

version 0.001

SYNOPSIS ^

    use Catalyst qw(
        Authentication
        Authorization::Roles
    );
    
    __PACKAGE__->config->{authentication} = {
        default_realm => 'members',
        realms => {
            members => {
                credential => {
                    class => 'Password',
                    password_field => 'password',
                    password_type => 'clear'
                },
                store => {
                    class => 'Fey::ORM',
                    user_model => 'MyApp::User',
                    role_relation => 'roles',
                    role_field => 'rolename',
                }
            }
        }
    };
    
    # Log a user in:
    
    sub login : Global {
        my ( $self, $c ) = @_;
    
        $c->authenticate(
            {
                user_name => $c->req->params->{username},
                password  => $c->req->params->{password},
            }
        );
    }
    
    # verify a role
    
    if ( $c->check_user_roles( 'editor' ) ) {
        # do editor stuff
    }

DESCRIPTION ^

The Catalyst::Authentication::Store::Fey::ORM class provides access to authentication information stored in a database via Fey::ORM.

METHODS ^

new ( $config, $app )

Constructs a new store object.

from_session ( $c, $frozenuser )

Revives a user from the session based on the info provided in $frozenuser. Currently treats $frozenuser as an id and retrieves a user with a matching id.

for_session ( $c, $user )

Prepares a user to be stored in the session. Currently returns the value of the user's id field (as indicated by the 'id_field' config element).

find_user ( $authinfo, $c )

Finds a user using the information provided in the $authinfo hashref and returns the user, or undef on failure. This is usually called from the Credential. This translates directly to a call to Catalyst::Authentication::Store::Fey::ORM::User's load() method.

CONFIGURATION ^

The Fey::ORM storage module has several configuration options.

class
user_model
id_field
role_column
role_field
role_relation
use_userdata_from_session

AUTHOR ^

Keedi Kim - 김도형 <keedi@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2011 by Keedi Kim.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: