I think I figured out a two ways to do this. I can use
the Generic driver and simply do some things after the driver authenticates if I write a custom sub... HOWEVER: I just looked at the code for CGIapp::Plugin::Authentication and noticed that it does not pass the authentication instance object to the driver.
This means that the generic driver cannot manipulate that object in the authentication process or in a post-authentication process.
Here is the line in CGI::Application::Plugin::Authentication in which the driver is called:
foreach my $driver ($self->drivers) {
if (my $username = $driver->verify_credentials(@credential
+s)) {
I would like to see the call to verify_credentials provide the authentication object as well the cgiapp object.
Then it will be easy for me to store the user id in a subroutine written using the generic driver.
in the meantime
What I can do is subclass CGI::Application::Plugin::Authentication and add a userid method similar to the username method:
sub username {
my $self = shift;
$self->initialize;
my $u = $self->store->fetch('username');
return $u;
}