NAME

Dancer::Plugin::Auth::RBAC::Credentials::SQLite - Dancer::Plugin::Auth::RBAC authentication via SQLite!

VERSION

version 1.110720

SYNOPSIS

    # in your app code
    my $auth = auth($login, $password);
    if ($auth) {
        # login successful
    }
    
    # use your own encryption (if the user account password is encrypted)
    my $auth = auth($login, encrypt($password));
    if ($auth) {
        # login successful
    }

DESCRIPTION

Dancer::Plugin::Auth::RBAC::Credentials::SQLite uses your SQLite database connection as the application's user management system.

METHODS

authorize

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

CONFIGURATION

    plugins:
      Database:
        driver: 'sqlite'
        database: 'example.db'
      Auth::RBAC:
        credentials:
          class: SQLite

Sometime you might define multiple connections for the Database plugin, make sure you tell the Auth::RBAC plugin about it... e.g.

    plugins:
      Database:
        foo:
          driver: 'sqlite'
          database: 'example1.db'
        bar:
          driver: 'sqlite'
          database: 'example2.db'
      Auth::RBAC:
        credentials:
          class: SQLite
          options:
            handle: foo

Please see Dancer::Plugin::Database for a list of all available connection options and arguments.

DATABASE SETUP

    # users table (feel free to add more columns as you see fit)
    
    CREATE TABLE users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(255) DEFAULT NULL,
    login VARCHAR(255) NOT NULL,
    password TEXT NOT NULL,
    roles TEXT
    );
    
    # create an initial adminstrative user (should probably encrypt the password)
    # Note! this module is not responsible for creating user accounts, it simply
    # provides a consistant authentication framework
    
    INSERT INTO users (name, login, password, roles)
    VALUES ('Administrator', 'admin', '*****', 'guest, user, admin');

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.