CGI Application Authentication Using Multiple Drivers

I tried to authenticate my CGI application through 2 drivers, one of which uses the username / password stored in the database, and the other using the active ldap directory.

Below is the code

$self->authen->config( 
DRIVER => [ 'DBI',
  DBH         => $self->dbh,
  TABLE       => 'user',
  CONSTRAINTS => {
    'user.username'     => '__CREDENTIAL_1__',
    'MD5:user.password' => '__CREDENTIAL_2__'
  },
],

DRIVER => [ 'Authen::Simple::LDAP',
     host   => 'ldapad.company.com',
     basedn => 'OU=XXX,OU=XX,DC=XXX,DC=XXX', 
binddn => 'CN=usename,OU=Users,OU=XXX,OU=AD,DC=XXX,DC=xxx',
bindpw => 'secret',
filter => '(cn=%s)',   
],


CREDENTIALS    => [ 'authen_username', 'authen_password' ],
STORE                => 'Session',
LOGOUT_RUNMODE       => 'logout',
LOGIN_RUNMODE        => 'login',
POST_LOGIN_RUNMODE   => 'okay',
RENDER_LOGIN         => \&my_login_form,
);

How to make an application verify that another driver is not authenticated with one. Right now, as expected, its driver, listed below, works, and both of them do, depending on which one was last assigned.

+5
source share
2 answers

, CGI::Application::Plugin::Authentication. , , , .

:

$self->authen->config( 
  DRIVER => [ 'DBI', ... ],
  DRIVER => [ 'Authen::Simple::LDAP', ... ],
  CREDENTIALS => [ 'authen_username', 'authen_password' ],
  STORE  => 'Session',
  # ...
);

$self->authen->config() . , C:: A:: P:: Authentication.

, , DRIVER . , :

$self->authen->config( 
  DRIVER => [
       [ 'DBI', ... ],
       [ 'Authen::Simple::LDAP', ... ],
  ],
  CREDENTIALS => [ 'authen_username', 'authen_password' ],
  STORE  => 'Session',
  # ...
);

:

http://search.cpan.org/~silasmonk/CGI-Application-Plugin-Authentication/lib/CGI/Application/Plugin/Authentication.pm#config

+2

, .

, , , , . 3 $self- > authen- > config() 3 ? .

0

All Articles