NAME

Dancer::Plugin::Authorize::Credentials::Database - Dancer::Plugin::Authorize authentication via the Dancer::Plugin::Database!

VERSION

version 0.04

SYNOPSIS

plugins:
  Authorize:
    auth: # keyword allows one to setup multiple authentication schemes
      credentials:
        class: Database
        options:
          user:
            query: select * from users where user_username = ? and user_password = PASSWORD(?)
            id: user_id               # user account identifier (usually the pkey)
            name: user_name           # user's full name, use array if name is split between fields
            login: user_username      # login database field
          roles:
            query: select * from user_roles where user_id = ?
            role: role_name           # role name database field

DESCRIPTION

Dancer::Plugin::Authorize::Credentials::Database uses your Dancer::Plugin::Database plugin to retrieved and authenticate user account information in the database.

** Note! This authentication class sets the user's roles automatically, if defined. **

If you intend to establish a role-based system within your database and would like to provide a fine level of ganularity, please consider the following:

# database RBAC (role-based access control) schema

users
    user_id, user_name, user_login, user_password, ...
    
roles
    role_id, role_name, ...
    
user_roles
    user_role_id, user_id, role_id, ...
    
role_operations
    role_operation_id, role_id, operation_name, ...
    
role_operation_actions
    role_action_id, role_id, role_operation_id, action_name, ...

METHODS

authorize

The authorize method (found in every authentication class) validates a user against the defined database, tables and column using the supplied arguments and configuration file options.

METHODS

AUTHOR

Al Newkirk <awncorp@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by awncorp.

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