NAME

Aut - Autorization framework for Wx::Perl.

SYNOPSIS

use Aut::Backend::SQL;
use Aut;
use Aut::Login;
use DBI;
use Lang::SQL;
use Lang;

package testApp;

use base 'Wx::App';

sub OnInit {
  my $dbname="zclass";
  my $host="localhost";
  my $user="zclass";
  my $pass="";
  my $dsn="dbi:Pg:dbname=$dbname;host=$host";

  Lang::init(new Lang::SQL("dbi:Pg:dbname=$dbname;host=$host",$user,$pass));

  my $backend=Aut::Backend::SQL->new($dsn,$user,$pass);
  my $auth=Aut->new($backend);

  my $login=Aut::Login->new($auth,"test application");

  my $ticket=$login->login();
  $ticket->log();

  $ticket=Aut::Ticket->new(ADMIN => 1);
  $ticket->log();
  $auth->create_account("admin","test",$ticket);

  print "login with admin, pass=test\n";

  $ticket=$login->login();

  $ticket->log();

  $login->Destroy;

  return 0;
}

package main;

my $a= new testApp;
$a->MainLoop();

ABSTRACT

'Aut' is an authorization framework that can be used in conjunction with wxPerl. It provides a simple login system with flexible login backends and a very simple ticket system, that has three levels of authorization.

DESCRIPTION

Autorization levels

The Aut authorization framework has three levels of authorization:

administrator

This level of authorization should be used for users that are 'superuser' for a program.

mutate

This level of authorization should be used for users that can modify data.

view

This level of authorization should be used for users that can only view information.

new(backend) --> Aut

The new method instantiates an Aut object with a given backend. The backend has to be preinitialized.

Returns the Aut object.

has_accounts() --> boolean

This method returns if the backend has any accounts in the store.

admin_ticket() --> Aut::Ticket

This method returns a ticket object with administrator authorization level.

check_login(account,pass) --> Aut::Ticket

This method checks with the backend if a (account,password) combination is valid. If it is, it will return a ticket with the registered authorization level.

Otherwise, it will return a ticket that has property 'invalid'.

create_account(account,pass,ticket) --> void

This method creates a (new) account. It should be passed a valid ticket. Account and Pass must not be empty.

The backend will create the new account in the store. If the account already exists, the backend must overwrite the existing account.

update_pass_ticket(account,pass,ticket) --> void

This method updates the password and ticket of an existing account in the store of the backend. If the account doesn't exist, the backend will create it with the given password and ticket.

SEE ALSO

http://wxperl.sf.net, , , .

AUTHOR

Hans Oesterholt-Dijkema <oesterhol@cpan.org>

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under LGPL terms.