Authen-Simple-WebForm
view release on metacpan or search on metacpan
lib/Authen/Simple/WebForm.pm view on Meta::CPAN
default => '',
optional => 1,
},
# compiled regex or string
login_expect_cookie => {
type => Params::Validate::SCALAR | Params::Validate::SCALARREF,
default => '',
optional => 1,
},
check_login_status_code => {
type => Params::Validate::BOOLEAN,
default => 1,
optional => 1,
},
login_request_method => {
type => Params::Validate::SCALAR,
default => 'POST',
optional => 1,
},
# for "domain\" if needed
username_prefix => {
type => Params::Validate::SCALAR,
default => '',
optional => 1,
},
username_field => {
type => Params::Validate::SCALAR,
default => 'username',
optional => 1,
},
password_field => {
type => Params::Validate::SCALAR,
default => 'password',
optional => 1,
},
lwp_user_agent => {
type => Params::Validate::SCALAR,
default => 'Authen::Simple::WebForm/'.$VERSION,
optional => 1,
},
lwp_timeout => {
type => Params::Validate::SCALAR,
default => '15',
optional => 1,
},
lwp_protocols_allowed => {
type => Params::Validate::ARRAYREF,
default => ['http', 'https'],
optional => 1,
},
lwp_use_conn_cache => {
type => Params::Validate::BOOLEAN,
default => 1,
optional => 1,
},
lwp_requests_redirectable => {
type => Params::Validate::ARRAYREF,
default => ['GET', 'POST'],
optional => 1,
},
# yes, this looks like a hash, but it's not (allows keys to show up twice)
# [ field => value, field => value ]
extra_fields => {
type => Params::Validate::ARRAYREF,
default => [],
optional => 1,
},
# yes, this looks like a hash, but it's not (allows keys to show up twice)
# [ field => value, field => value ]
extra_headers => {
type => Params::Validate::ARRAYREF,
default => [],
optional => 1,
},
trace => {
type => Params::Validate::BOOLEAN,
default => 0,
optional => 1,
},
});
=head1 SYNOPSIS
use Authen::Simple::WebForm;
my $webform = Authen::Simple::WebForm->new(
login_url => 'http://host.company.com/login.pl',
login_expect => 'Successful Login',
);
if ($webform->authenticate( $username, $password ) ) {
# successful authentication
}
# or as a mod_perl Authen handler
PerlModule Authen::Simple::Apache
PerlModule Authen::Simple::WebForm
PerlSetVar AuthenSimpleWebForm_login_url "http://host.company.com/login.pl"
PerlSetVar AuthenSimpleWebForm_login_expect "Successful Login"
<Location /protected>
PerlAuthenHandler Authen::Simple::WebForm
AuthType Basic
AuthName "Protected Area"
Require valid-user
</Location>
=head1 DESCRIPTION
Authentication against a variety of login forms. This wraps up the LWP (libwww-perl)
calls needed to attempt a login to a site that uses an HTML form for logins. It supports
logins that require cookies, various form variables, special headers, and more.
You can also subclass this to make it easier to setup, such as the
L<Authen::Simple::OWA2003> module.
There are a log of options, but they all have sane defaults. In most cases, you'll only need to use the following:
=over
=item login_url
=item login_expect
=item uesrname_field
( run in 0.976 second using v1.01-cache-2.11-cpan-39bf76dae61 )