The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MKDoc::Auth::Handler::AuthenticateOpt - MKDoc::Auth apache optional authentication handler

OVERVIEW

This handler is used as an optional authentication mechanism.

It does *not* password protect a portion of your site. Instead, _if_ the client browser sends user credentials, and if those credentials match an existing MKDoc::Auth::User, then this user object will be set in the variable $::MKD_USER.

The MKDoc::Auth::Plugin::Login module does some trickery to get the browser to send the credentials.

In your httpd.conf this module is used as follows:

  <Location />
    PerlFixupHandler MKDoc::Auth::Handler::AuthenticateOpt
  </Location>

However when you install MKDoc::Auth onto a given site, this apache configuration should be deployed for you. All you need to do after you're done is restart apache.

API

get_login();

If the browser sent authentication credentials, returns the login part of the credentials.

Returns undef otherwise.

get_password();

If the browser sent authentication credentials, returns the password part of the credentials.

Returns undef otherwise.

handler();

If the browser sent authentication credentials, and those credentials matched an existing MKDoc::Auth::User, sets the user in $::MKD_USER.

This modules always returns OK, even if the credentials were not sent or were incorrect. However the $::MKD_USER is set only whenever the credentials are sent and correct.