.\" 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 "HTML::FormFu::Element::RequestToken 3pm" .TH HTML::FormFu::Element::RequestToken 3pm "2022-12-06" "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" HTML::FormFu::Element::RequestToken .SH "VERSION" .IX Header "VERSION" version 2.04 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& my $e = $form\->element( { type => \*(AqToken\*(Aq } ); \& \& my $p = $form\->element( { plugin => \*(AqToken\*(Aq } ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This field can prevent \s-1CSRF\s0 attacks. It contains a random token. After submission the token is checked with the token which is stored in the session of the current user. See \&\*(L"request_token_enable\*(R" in Catalyst::Controller::HTML::FormFu for a convenient way how to use it. .SH "NAME" HTML::FormFu::Element::RequestToken \- Hidden text field which contains a unique token .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "context" .IX Subsection "context" Value of the stash key for the Catalyst context object (\f(CW$c\fR). Defaults to \&\f(CW\*(C`context\*(C'\fR. .SS "expiration_time" .IX Subsection "expiration_time" Time to life for a token in seconds. Defaults to \f(CW3600\fR. .SS "session_key" .IX Subsection "session_key" Session key which is used to store the tokens. Defaults to \f(CW\*(C`_\|_token\*(C'\fR. .SS "limit" .IX Subsection "limit" Limit the number of tokens which are kept in the session. Defaults to 20. .SS "constraints" .IX Subsection "constraints" Defaults to HTML::FormFu::Constraint::RequestToken and HTML::FormFu::Constraint::Required. .SS "message" .IX Subsection "message" Set the error message. .SH "METHODS" .IX Header "METHODS" .SS "expire_token" .IX Subsection "expire_token" This method looks in the session for expired tokens and removes them. .SS "get_token" .IX Subsection "get_token" Generates a new token and stores it in the stash. .SS "verify_token" .IX Subsection "verify_token" Checks whether a given token is already in the session. Returns \f(CW1\fR if it exists, \f(CW0\fR otherwise. .SH "SEE ALSO" .IX Header "SEE ALSO" Catalyst::Controller::HTML::FormFu, HTML::FormFu::Plugin::RequestToken, HTML::FormFu::Constraint::RequestToken .PP HTML::FormFu .SH "AUTHOR" .IX Header "AUTHOR" Moritz Onken, \f(CW\*(C`onken@houseofdesign.de\*(C'\fR .SH "LICENSE" .IX Header "LICENSE" This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 Carl Franks .IP "\(bu" 4 Nigel Metheringham .IP "\(bu" 4 Dean Hamstead .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2007\-2018 by Carl Franks / Nigel Metheringham / Dean Hamstead. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.