.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "CGI::Application::Plugin::Authentication::Driver 3pm" .TH CGI::Application::Plugin::Authentication::Driver 3pm "2024-01-07" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" CGI::Application::Plugin::Authentication::Driver \- Base module for building driver classes for CGI::Application::Plugin::Authentication .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& package CGI::Application::Plugin::Authentication::Driver::MyDriver; \& use base qw(CGI::Application::Plugin::Authentication::Driver); \& \& sub verify_credentials { \& my $self = shift; \& my @credentials = @_; \& \& if ( >>> Validate Credentials <<< ) { \& return $credentials[0]; \& } \& return; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is a base class for all driver classes for the CGI::Application::Plugin::Authentication plugin. Each driver class is required to provide only one method to validate the given credentials. Normally only two credentials will be passed in (username and password), but you can configure the plugin to handle any number of credentials (for example you may require the user to enter a group name, or domain name as well as a username and password). .SH "FIELD FILTERS" .IX Header "FIELD FILTERS" It is quite common for passwords to be stored using some form of one way encryption. Unix crypt being the old standard in the Unix community, however \s-1MD5\s0 or \s-1SHA1\s0 hashes are more popular today. In order to simplify the validation routines some methods have been provided to help test these passwords. When configuring a Driver (and if the driver supports it), you can specify which fields are encoded, and which method is used for the encoding by specifying a filter on the field in question. .PP .Vb 9 \& CREDENTIALS => [\*(Aqauthen_username\*(Aq, \*(Aqauthen_password\*(Aq], \& DRIVERS => [ \*(AqDBI\*(Aq, \& DSN => \*(Aq...\*(Aq, \& TABLE => \*(Aqusers\*(Aq, \& CONSTRAINTS => { \& username => \*(Aq_\|_CREDENTIAL_1_\|_\*(Aq, \& \*(AqMD5:password\*(Aq => \*(Aq_\|_CREDENTIAL_2_\|_\*(Aq, \& } \& ], .Ve .PP Here we are saying that the password field is encoded using an \s-1MD5\s0 hash, and should be checked accordingly. .SS "Filter options" .IX Subsection "Filter options" Some of the filters may have multiple forms. For example there are three forms of \s-1MD5\s0 hashes: binary, base64 and hex. You can specify these extra options by using an underscore to separate it from the filter name. .PP .Vb 1 \& \*(AqMD5_base64:password\*(Aq .Ve .SS "Chained Filters" .IX Subsection "Chained Filters" it is possible to chain multiple filters. This can be useful if your \s-1MD5\s0 strings are stored in hex format. Hex numbers are case insensitive, so the may be stored in either upper or lower case. To make this consistent, you can \s-1MD5\s0 encode the password first, and then upper case the results. The filters are applied from the inside out: .PP .Vb 1 \& \*(Aquc:MD5_hex:password\*(Aq .Ve .SS "Custom Filters" .IX Subsection "Custom Filters" If your field is encoded using a custom technique, then you can provide a custom filter function. This can be be done by providing a \s-1FILTERS\s0 option that contains a hash of filter subroutines that are keyed by their name. You can then use the filter name on any of the fields as if it was a builtin filter. .PP .Vb 10 \& CREDENTIALS => [\*(Aqauthen_username\*(Aq, \*(Aqauthen_password\*(Aq], \& DRIVERS => [ \*(AqDBI\*(Aq, \& DSN => \*(Aq...\*(Aq, \& TABLE => \*(Aqusers\*(Aq, \& CONSTRAINTS => { \& username => \*(Aq_\|_CREDENTIAL_1_\|_\*(Aq, \& \*(Aqrot13:password\*(Aq => \*(Aq_\|_CREDENTIAL_2_\|_\*(Aq, \& } \& FILTERS => { rot13 => \e&rot13_filter }, \& ], \& \& sub rot13_filter { \& my $param = shift; \& my $value = shift; \& $value =~ tr/A\-Za\-z/N\-ZA\-Mn\-za\-m/; \& return $value; \& } .Ve .PP Please see the documentation for the driver that you are using to make sure that it supports encoded fields. .SS "Builtin Filters" .IX Subsection "Builtin Filters" Here is a list of the filters that are provided with this module: .ie n .IP "crypt \- provided by perl ""crypt"" function" 4 .el .IP "crypt \- provided by perl \f(CWcrypt\fR function" 4 .IX Item "crypt - provided by perl crypt function" .PD 0 .IP "\s-1MD5\s0 \- requires Digest::MD5" 4 .IX Item "MD5 - requires Digest::MD5" .IP "\s-1SHA1\s0 \- requires Digest::SHA1" 4 .IX Item "SHA1 - requires Digest::SHA1" .ie n .IP "uc \- provided by the perl ""uc"" function" 4 .el .IP "uc \- provided by the perl \f(CWuc\fR function" 4 .IX Item "uc - provided by the perl uc function" .ie n .IP "lc \- provided by the perl ""lc"" function" 4 .el .IP "lc \- provided by the perl \f(CWlc\fR function" 4 .IX Item "lc - provided by the perl lc function" .IP "trim \- removed whitespace from the start and end of the field" 4 .IX Item "trim - removed whitespace from the start and end of the field" .PD .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" This is a constructor that can create a new Driver object. It requires an Authentication object as its first parameter, and any number of other parameters that will be used as options depending on which Driver object is being created. You shouldn't need to call this as the Authentication plugin takes care of creating Driver objects. .SS "initialize" .IX Subsection "initialize" This method will be called right after a new Driver object is created. So any startup customizations can be dealt with here. .SS "options" .IX Subsection "options" This will return a list of options that were provided when this driver was configured by the user. .SS "authen" .IX Subsection "authen" This will return the underlying CGI::Application::Plugin::Authentication object. In most cases it will not be necessary to access this. .SS "find_option" .IX Subsection "find_option" This method will search the Driver options for a specific key and return the value it finds. .SS "verify_credentials" .IX Subsection "verify_credentials" This method needs to be provided by the driver class. It needs to be an object method that accepts a list of credentials, and will verify that the credentials are valid, and return a username that will be used to identify this login (usually you will just return the value of the first credential, however you are not bound to that).. .SS "filter" .IX Subsection "filter" This method can be used to filter a field (usually password fields) using a number of standard or custom encoding techniques. See the section on Builtin Filters above to see what filters are available When using a custom filter, you will need to provide a \s-1FILTERS\s0 option in the configuration of the \s-1DRIVER\s0 (See the section on \s-1FIELD FILTERS\s0 above for an example). By default, if no filter is specified, it is returned as is. This means that you can run all fields through this function even if they don't have any filters to simplify the driver code. .PP .Vb 1 \& my $filtered = $self\->filter(\*(AqMD5_hex:password\*(Aq, \*(Aqfoobar\*(Aq); \& \& \- or \- \& \& # custom filter \& my $filtered = $self\->filter(\*(Aqfoobar:password\*(Aq, \*(Aqfoo\*(Aq); \& \& \- or \- \& \& # effectively a noop \& my $filtered = $self\->filter(\*(Aqusername\*(Aq, \*(Aqfoo\*(Aq); .Ve .SS "check_filtered" .IX Subsection "check_filtered" This method can be used to test filtered fields (usually password fields) against a number of standard or custom encoding techniques. The following encoding techniques are provided: plain, \s-1MD5, SHA1,\s0 crypt. When using a custom encoder, you will need to provide it in the configuration of the \s-1DRIVERS\s0 (See the section on \s-1ENCODED PASSWORDS\s0 above for an example). By default, if no encoding is specified, it is assumed to be 'plain'. This means that you can run all fields through this function even if they don't have any encoding to simplify the driver code. .PP .Vb 1 \& my $verified = $self\->check_filtered(\*(AqMD5:password\*(Aq, \*(Aqfoobar\*(Aq, \*(AqOFj2IjCsPJFfMAxmQxLGPw\*(Aq); \& \& \- or \- \& \& # custom encoder \& my $verified = $self\->check_filtered(\*(Aqfoobar:password\*(Aq, \*(Aqfoo\*(Aq, \*(Aqbar\*(Aq); \& \& \- or \- \& \& # a field that isn\*(Aqt filtered (effectively just checks for equality on second and third args) \& my $verified = $self\->check_filtered(\*(Aqusername\*(Aq, \*(Aqfoobar\*(Aq, \*(Aqfoobar\*(Aq); \& my $verified = $self\->check_filtered(\*(Aqplain:username\*(Aq, \*(Aqfoobar\*(Aq, \*(Aqfoobar\*(Aq); .Ve .SS "strip_field_names" .IX Subsection "strip_field_names" This method will take a field name (or list of names) and strip off the leading encoding type. For example if you passed in 'MD5:password' the method would return 'password'. .PP .Vb 1 \& my $fieldname = $self\->strip_field_names(\*(AqMD5:password\*(Aq); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" CGI::Application::Plugin::Authentication, \fBperl\fR\|(1) .SH "AUTHOR" .IX Header "AUTHOR" Cees Hek .SH "LICENCE AND COPYRIGHT" .IX Header "LICENCE AND COPYRIGHT" Copyright (c) 2005, SiteSuite. All rights reserved. .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "DISCLAIMER OF WARRANTY" .IX Header "DISCLAIMER OF WARRANTY" \&\s-1BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE \*(L"AS IS\*(R" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.\s0 .PP \&\s-1IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE\s0 (\s-1INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE\s0), \s-1EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\s0