Catalyst-Plugin-Authentication-Store-HTTP
view release on metacpan or search on metacpan
Configuration is done in the standard Catalyst fashion. All
configuration keys are under "authentication/http".
The supported keys are:-
auth_url
The URL that is fetched to demonstrate that the supplied credentials
work. This can be any URL that LWP::UserAgent will support and that
will support a "HEAD" method. This item must be supplied.
keep_alive
A boolean value that sets whether keep alive is used on the URL
fetch. This must be set for NTLM authentication - and the *ntlm*
configuration key forces it to be set.
domain
An optional domain value for authentication. If set the presented
username for authentication has this domain prepended to it - this
is really of use only for NTLM authentication mode.
ntlm
A boolean value that should be set if NTLM authentication is
required. If this is set then *domain* must be set and *keep_alive*
is forced on.
EXTENDED METHODS
setup
Checks the configuration information and sets up the
"default_auth_store". This method is not intended to be called directly
by user code.
SEE ALSO
Catalyst::Plugin::Authentication.
lib/Catalyst/Plugin/Authentication/Store/HTTP.pm view on Meta::CPAN
The supported keys are:-
=over 4
=item auth_url
The URL that is fetched to demonstrate that the supplied credentials
work. This can be any URL that L<LWP::UserAgent> will support and
that will support a C<HEAD> method. This item must be supplied.
=item keep_alive
A boolean value that sets whether keep alive is used on the URL
fetch. This must be set for NTLM authentication - and the I<ntlm>
configuration key forces it to be set.
=item domain
An optional domain value for authentication. If set the presented
username for authentication has this domain prepended to it - this is
really of use only for NTLM authentication mode.
=item ntlm
A boolean value that should be set if NTLM authentication is
required. If this is set then I<domain> must be set and I<keep_alive>
is forced on.
=back
=head1 EXTENDED METHODS
=head2 setup
Checks the configuration information and sets up the
C<default_auth_store>. This method is not intended to be called
lib/Catalyst/Plugin/Authentication/Store/HTTP.pm view on Meta::CPAN
sub setup {
my $c = shift;
unless ($c->config->{authentication}{http}{auth_url}) {
Catalyst::Exception->throw(
message => q/Require auth_url for Authentication::Store::HTTP/);
}
if ($c->config->{authentication}{http}{ntlm}) {
# force keep_alive to be set
$c->config->{authentication}{http}{keep_alive} ||= 1;
#
# domain needs to be set
unless ($c->config->{authentication}{http}{domain}) {
Catalyst::Exception->throw(message =>
q/Require domain to be set in NTLM mode for Authentication::Store::HTTP/
);
}
}
lib/Catalyst/Plugin/Authentication/Store/HTTP/Backend.pm view on Meta::CPAN
=cut
sub get_user {
my ($self, $id) = @_;
my $user = {
id => $id,
auth_url => $self->{auth_url},
domain => $self->{domain},
keep_alive => $self->{keep_alive} || 0,
ntlm => $self->{ntlm} || 0,
};
return bless $user, 'Catalyst::Plugin::Authentication::Store::HTTP::User';
}
=head1 AUTHOR
Daisuke Murase <typester@cpan.org>
lib/Catalyst/Plugin/Authentication/Store/HTTP/User.pm view on Meta::CPAN
=head2 check_password
=cut
sub check_password {
my ($self, $password) = @_;
my $ua =
Catalyst::Plugin::Authentication::Store::HTTP::UserAgent->new(
keep_alive => ($self->{keep_alive} ? 1 : 0));
my $req = HTTP::Request->new(HEAD => $self->{auth_url});
# set the credentials for the request.
# if there is a domain set then prepend this onto the user id
$ua->credentials(
($self->{domain} ? join("\\", $self->{domain}, $self->id) : $self->id),
$password
);
my $res = $ua->request($req);
( run in 0.529 second using v1.01-cache-2.11-cpan-39bf76dae61 )