Catalyst-Authentication-Credential-RemoteHTTP
view release on metacpan or search on metacpan
__PACKAGE__->config(
'Plugin::Authentication' => {
default_realm => 'members',
realms => {
members => {
credential => {
class => 'RemoteHTTP',
url => 'http://intranet.company.com/authenticated.html',
password_field => 'password',
username_prefix => 'MYDOMAIN\\',
http_keep_alive => 1,
defer_find_user => 1,
},
...
},
},
);
class
The classname used for Credential. This is part of
Catalyst::Plugin::Authentication and is the method by which
username before it is used for authenticating to the remote http
server. It may be used (for example) to apply a domain to the
authenticated username.
username_suffix
This is an optional suffix to the username, which is added to the
username before it is used for authenticating to the remote http
server. It may be used (for example) to apply a domain to the
authenticated username.
http_keep_alive
If "http_keep_alive" is set then keep_alive is set on the
connections to the remote http server. This is required if you are
using NTLM authentication (since an additional encryption nonce is
passed in the http negotiation). It is optional, but normally
harmless, for other forms of authentication.
defer_find_user
Normally the associated user store is queried for user information
before the remote http authentication takes place.
However if, for example, you are using a
Additionally you require Authen::NTLM of version 1.02 or later. There
are 2 different CPAN module distributions that provide this module - but
only one of them has the appropriate version number.
Finally, if you are using NTLM-1.02 then you need to apply the patch
described in RT entry 9521
<http://rt.cpan.org/Ticket/Display.html?id=9521>.
When using NTLM authentication the configuration option
"http_keep_alive" must be set true - otherwise the session to the remote
server is not maintained and the authentication nonce will be lost
between sessions.
You may also need to set "username_prefix" or "username_suffix" to set
the correct domain for the authentication, unless the username as given
to your application includes the domain information.
ACKNOWLEDGEMENTS
Daisuke Murase <typester@cpan.org> - original
Catalyst::Plugin::Authentication::Store::HTTP used as the base for a
lib/Catalyst/Authentication/Credential/RemoteHTTP.pm view on Meta::CPAN
use 5.008005;
use Catalyst::Exception ();
use Catalyst::Authentication::Credential::RemoteHTTP::UserAgent;
use namespace::autoclean;
our $VERSION = '0.05'; # VERSION
our $AUTHORITY = 'cpan:NIGELM'; # AUTHORITY
has realm => ( isa => Object, is => 'ro', required => 1 );
has [qw/http_keep_alive defer_find_user/] => ( is => 'ro', default => 0 );
has username_field => ( is => 'ro', default => 'username' );
has password_field => ( is => 'ro', default => 'password' );
has url => ( is => 'ro', required => 1 );
has [qw/ user_prefix user_suffix /] => ( is => 'ro', default => '' );
sub BUILDARGS {
my ( $class, $config, $app, $realm ) = @_;
lib/Catalyst/Authentication/Credential/RemoteHTTP.pm view on Meta::CPAN
my $userfindauthinfo = { %{$authinfo} };
delete( $userfindauthinfo->{ $self->password_field } );
my $user_obj;
$user_obj = $realm->find_user( $userfindauthinfo, $c )
unless ( $self->defer_find_user );
if ( ref($user_obj) || $self->defer_find_user ) {
my $ua =
Catalyst::Authentication::Credential::RemoteHTTP::UserAgent->new(
keep_alive => $self->http_keep_alive ? 1 : 0 );
# add prefix/suffix to user data to make auth_user, get password
my $auth_user = sprintf( '%s%s%s', $self->user_prefix, $username, $self->user_suffix );
my $password = $authinfo->{ $self->password_field };
$ua->set_credentials( $auth_user, $password );
# do the request
my $res = $ua->head( $self->url );
# did it succeed
lib/Catalyst/Authentication/Credential/RemoteHTTP.pm view on Meta::CPAN
__PACKAGE__->config(
'Plugin::Authentication' => {
default_realm => 'members',
realms => {
members => {
credential => {
class => 'RemoteHTTP',
url => 'http://intranet.company.com/authenticated.html',
password_field => 'password',
username_prefix => 'MYDOMAIN\\',
http_keep_alive => 1,
defer_find_user => 1,
},
...
},
},
);
=over 4
=item class
lib/Catalyst/Authentication/Credential/RemoteHTTP.pm view on Meta::CPAN
server. It may be used (for example) to apply a domain to the
authenticated username.
=item username_suffix
This is an optional suffix to the username, which is added to the
username before it is used for authenticating to the remote http
server. It may be used (for example) to apply a domain to the
authenticated username.
=item http_keep_alive
If C<http_keep_alive> is set then keep_alive is set on the
connections to the remote http server. This is required if you are
using NTLM authentication (since an additional encryption nonce is
passed in the http negotiation). It is optional, but normally
harmless, for other forms of authentication.
=item defer_find_user
Normally the associated user store is queried for user information
before the remote http authentication takes place.
lib/Catalyst/Authentication/Credential/RemoteHTTP.pm view on Meta::CPAN
Additionally you require L<Authen::NTLM> of version 1.02 or later.
There are 2 different CPAN module distributions that provide this
module - but only one of them has the appropriate version number.
Finally, if you are using L<NTLM-1.02> then you need to apply the
patch described in RT entry 9521
L<http://rt.cpan.org/Ticket/Display.html?id=9521>.
When using NTLM authentication the configuration option
C<http_keep_alive> must be set true - otherwise the session to the
remote server is not maintained and the authentication nonce will
be lost between sessions.
You may also need to set C<username_prefix> or C<username_suffix>
to set the correct domain for the authentication, unless the
username as given to your application includes the domain
information.
=head1 ACKNOWLEDGEMENTS
( run in 1.139 second using v1.01-cache-2.11-cpan-39bf76dae61 )