.\" 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::Store::Cookie 3pm" .TH CGI::Application::Plugin::Authentication::Store::Cookie 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::Store::Cookie \- Cookie based Store .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use base qw(CGI::Application); \& use CGI::Application::Plugin::Session; \& use CGI::Application::Plugin::Authentication; \& \& _\|_PACKAGE_\|_\->authen\->config( \& STORE => [\*(AqCookie\*(Aq, SECRET => "Shhh, don\*(Aqt tell anyone", NAME => \*(AqCAPAUTH_DATA\*(Aq, EXPIRY => \*(Aq+1y\*(Aq], \& ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module uses a cookie to store authentication information across multiple requests. It works by creating a cookie that contains the information we would like to store (like the name of the user that is currently authenticated), and then base64 encoding the data. In order to ensure that the information is not manipulated by the end-user, we include a \s-1CRC\s0 checksum that is generated along with our secret. Since the user does not know the value of the secret, they will not be able to recreate the checksum if they change some of the values, so we will be able to tell if the information in the cookie has been manipulated. .SH "THE SECRET" .IX Header "THE SECRET" .SS "Choosing a good secret" .IX Subsection "Choosing a good secret" An easy way to generate a relatively good secret is to run the following perl snippet: .PP .Vb 1 \& perl \-MDigest::MD5=md5_base64 \-l \-e \*(Aqprint md5_base64($$,time(),rand(9999))\*(Aq .Ve .PP Just use the resulting string as your secret. .SS "Configuring the secret" .IX Subsection "Configuring the secret" There are three ways that you can provide a secret to the module: .IP "Hardcode the secret" 4 .IX Item "Hardcode the secret" You can hardcode a secret right in the CGI::Application::Plugin::Authentication::Store::Cookie module, so that you don't have to remember to provide one every time you use the module. Just open the source in a text editor and look at the top of the file where it defines 'our \f(CW$SECRET\fR' and follow the instruction listed there. .IP "Provide the \s-1SECRET\s0 option when using the module" 4 .IX Item "Provide the SECRET option when using the module" You can also just provide the secret as an option when using the module using the \s-1SECRET\s0 parameter. .Sp .Vb 3 \& _\|_PACKAGE_\|_\->authen\->config( \& STORE => [\*(AqCookie\*(Aq, SECRET => "Shhh, don\*(Aqt tell anyone"], \& ); .Ve .IP "Let the module choose a secret for you" 4 .IX Item "Let the module choose a secret for you" And lastly, if you forget to do either of these, the module will use the name of your application as the secret, but that is not a very good value to use, so a warning will be spit out everytime it uses this. This is the least desirable choice, and is only included as a last resort. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" This module requires the following modules to be available. .IP "MIME::Base64" 4 .IX Item "MIME::Base64" .PD 0 .IP "Digest::SHA" 4 .IX Item "Digest::SHA" .IP "CGI::Cookie" 4 .IX Item "CGI::Cookie" .PD .SH "METHODS" .IX Header "METHODS" .SS "fetch" .IX Subsection "fetch" This method accepts a list of parameters and fetches them from the cookie data. .SS "save" .IX Subsection "save" This method accepts a hash of parameters and values and stores them in the cookie data. .SS "delete" .IX Subsection "delete" This method accepts a list of parameters and deletes them from the cookie data. .SS "initialize" .IX Subsection "initialize" This method will check for an existing cookie, and decode the contents for later retrieval. .SS "cookie_name" .IX Subsection "cookie_name" This method will return the name of the cookie .SH "SEE ALSO" .IX Header "SEE ALSO" CGI::Application::Plugin::Authentication::Store, 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