CGI-Session-Auth

 view release on metacpan or  search on metacpan

Auth.pm  view on Meta::CPAN

            $self->_session->param("~userid", $self->{userid});
            $self->_session->clear(["~login-trials"]);
            return 1;
        }
    }
    
}

###########################################################

sub sessionCookie {
    
    ##
    ## make cookie with session id
    ##
    
    my $self = shift;
    
    my $cookie = $self->_cgi->cookie($self->_session->name() => $self->_session->id );
    return $cookie;
}

Auth.pm  view on Meta::CPAN


This virtual method performs the actual login attempt by comparing the login
form data the visitor sent with some local user database. The _login method of
the base class CGI::Session::Auth only knows the user 'guest' with password
'guest'.

To access a real user database, you have to use a subclass that modifies the
_login method appropriately. See the modules in the Auth/ subdirectory.


=head2 sessionCookie()

For the session to be persistent across page requests, its session ID has to be
stored in a cookie. This method returns the correct cookie (as generated by CGI::cookie()),
but it remains the duty of the CGI application to send it.


=head2 loggedIn()

Returns a boolean value representing the current visitors authentication
status.

Changes  view on Meta::CPAN

0.12
	Changes:
	- Auth.pm: renamed constructor parameter 'DoIPAuth' to 'IPAuth'
	- Auth.pm: made logging optional by new constructor parameter 'Log'
	Fixes:
	- Makefile.PM: added prerequisites
	- DBI.pm: fixed call of missing _getProfile(), replaced by _extractProfile()
		
0.11 
	- Changes:
		- Auth.pm: replaced _sendSessionCookie() with sessionCookie()
			for it can't be the job of the module to send the cookie, 
			the application has to take care of that.
		
0.10  2003-09-16 23:52:12
	- alpha version of CGI::Session::Auth
		- fake class, works with only one user account: guest/guest
		- authentication by login (username/password)
		- minimum documentation
	- alpha version of CGI::Session::Auth::DBI
		- configurable database backend

examples/testapp-dbi.pl  view on Meta::CPAN

	my $auth = new CGI::Session::Auth::DBI({
		CGI => $self->query,
		Session => $self->param('_session'),
		DSN => "dbi:mysql:host=localhost;database=cgiauth",
		DoIPAuth => 1,
	});
	$self->param('_auth' => $auth);
	$auth->authenticate();

	# send session cookie	
	$self->header_props( -cookie => $auth->sessionCookie() );
}

sub _auth {
	my $self = shift;
	
	return $self->param('_auth');
}

sub showFreePage {
	my $self = shift;

examples/testapp.pl  view on Meta::CPAN

	
	# new authentication object
	my $auth = new CGI::Session::Auth({
		CGI => $self->query,
		Session => $session
	});
	$self->param('_auth' => $auth);
	$auth->authenticate();
	
	# send session cookie	
	$self->header_props( -cookie => $auth->sessionCookie() );
}

sub _auth {
	my $self = shift;
	
	return $self->param('_auth');
}

sub showFreePage {
	my $self = shift;



( run in 0.485 second using v1.01-cache-2.11-cpan-e9199f4ba4c )