Quoting Bill McCormick <suppressed>:
> Ok I see.
>
> # allow only the guest user, for real applications use a subclass
>
> meaning override the _login sub? I don't think I like that. I think I'll
> build a feature that allows you to pass in a hash of user/passwd values.
> Thoughts?
What you are looking at is the source for the main Auth.pm module. The way it
actually works is through the use of a Driver module that inherits from this
base module. Look at CGI::Session::Auth::DBI for an example of a subclassed
'real' application of the CGI::Session::Auth framework.
So in your code you would actually use the CGI::Session::Auth::DBI module for
authentication if you wanted to use a database backend. Since this module is in
early development, that is the only working driver module currently available.
I would guess in the near future, there will be a File based module, and
probably a DBM and LDAP module as well. But in the meantime, you can easily
write your own.
A stubb file for doing a File based user database is also in the distribution,
but it is not complete.
If all you wanted to do is authenticate a user where the username and passwords
are listed in a file, then all you would need to write is the _login function
and the _loadProfile function in the C:S:A:File stubb that came in the
distribution. Here is some pseudo code that might help:
sub _login {
my $self = shift;
my $username = shift;
my $password = shift;
# open the file and search for $username
...
if ($password eq $password_from_file) {
$self->_loadProfile($username, $password);
return 1;
}
return;
}
sub _loadProfile {
my $self = shift;
my $userid = shift;
# store the user profile in $self->{profile}
# if you aren't using the profile features, just store the username
$self->{userid} = $userid;
$self->{profile}->{username} = $userid;
}
I appologize for showing you a module that isn't quite complete, but I think it
will be a very nice fit for what you are looking to do. If you are willing to
wait a couple of weeks, or contact the author, you might get some more movement
on the development of this module.
by the way, this list will not accept file attachments, so no one would have
received a copy of your code. But since you also sent it directly to me, I did
get a copy. I will have a quick browse though it now...
Cheers,
Cees
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.