NAME
Auth::Login - Authorization Framework for wxPerl - Tickets
SYNOPSIS
use Auth::Backend::SQL;
use Auth;
use Auth::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=Auth::Backend::SQL->new($dsn,$user,$pass);
my $auth=Auth->new($backend);
my $login=Auth::Login->new($auth,"test application");
my $ticket=$login->login();
$ticket->log();
$ticket=Auth::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
'Auth::Ticket' is part of the authorization framework that can be used in conjunction with wxPerl. It provides the ticket authorization system.
DESCRIPTION
new(ADMIN =
0/1, MUTATE => 0/1, VIEW => 0/1, VALID => 0/1, FROM => string)> --> Auth::Ticket
This method initializes a ticket with given values for ADMIN, MUTATE, VIEW and VALID; or let's it initialize from the 'FROM' argument, that has earlier been created with the to_string
function.
invalidate()
--> void
This method invalidates the ticket it's called on, e.g:
my $ticket=new Auth::Ticket(ADMIN => 1);
(...)
$ticket->invalidate();
valid()
--> boolean
This method returns 'true' for a valid ticket and 'false' for an invalid one.
admin()
--> boolean
This method returns true if the ticket it's called on has ADMIN => 1.
mutate()
--> boolean
This method returns true if the ticket it's called on has MUTATE => 1.
view()
--> boolean
This method returns true if the ticket it's called on has VIEW => 1.
log()
--> void
This method prints the internals of an Auth::Ticket object (with function 'print').
to_string()
--> string
This method converts an Auth::Ticket object to a string. The Auth::Ticket class provides a way to instantiate a new Auth::Ticket object from such a string (using the 'FROM' keyword with method 'new').
SEE ALSO
http://wxperl.sf.net, Lang framework, Auth framework, Auth::Login, Auth::Backend::SQL.
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.