[Catalyst-commits] r10247 - in
Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support:
. lib/Catalyst/Authentication/Credential
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sat May 23 11:03:07 GMT 2009
Author: t0m
Date: 2009-05-23 11:03:07 +0000 (Sat, 23 May 2009)
New Revision: 10247
Added:
Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/Todo.NTLM
Modified:
Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/Changes
Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/lib/Catalyst/Authentication/Credential/HTTP.pm
Log:
Write a todo, various POD and method changes
Modified: Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/Changes
===================================================================
--- Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/Changes 2009-05-23 11:01:44 UTC (rev 10246)
+++ Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/Changes 2009-05-23 11:03:07 UTC (rev 10247)
@@ -1,4 +1,3 @@
-1.00999_02 2009-04-03
- Add debug when a user is found, but passwords don't match (abraxxa)
- Added NTLM support (abraxxa)
Added: Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/Todo.NTLM
===================================================================
--- Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/Todo.NTLM (rev 0)
+++ Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/Todo.NTLM 2009-05-23 11:03:07 UTC (rev 10247)
@@ -0,0 +1,9 @@
+ * Fix type to be an array of types of auth that we support. You should be able to choose any
+ combination of types and have it work!
+
+ * NTLM - Test store for cleartext password storage.
+
+ * NTLM - Test we are not self-check, as that can't work.
+
+ * Split authenticate_ntlm method to be smaller.
+
Modified: Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/lib/Catalyst/Authentication/Credential/HTTP.pm
===================================================================
--- Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/lib/Catalyst/Authentication/Credential/HTTP.pm 2009-05-23 11:01:44 UTC (rev 10246)
+++ Catalyst-Authentication-Credential-HTTP/1.000/branches/ntlm_support/lib/Catalyst/Authentication/Credential/HTTP.pm 2009-05-23 11:03:07 UTC (rev 10247)
@@ -36,7 +36,7 @@
ntlm_domain
/) if NTLM_SUPPORT;
-our $VERSION = '1.00999_03';
+our $VERSION = '1.010';
sub new {
my ($class, $config, $app, $realm) = @_;
@@ -77,18 +77,20 @@
my ( $self, $c, $realm, $auth_info ) = @_;
my $auth;
- # don't try NTLM auth if NTLM support isn't available
if (NTLM_SUPPORT) {
- $auth = $self->authenticate_ntlm($c, $realm, $auth_info) if $self->_is_http_auth_type('ntlm');
+ $auth = $self->authenticate_ntlm($c, $realm, $auth_info)
+ if $self->_is_http_auth_type('ntlm');
return $auth if $auth;
}
-
- $auth = $self->authenticate_digest($c, $realm, $auth_info) if $self->_is_http_auth_type('digest');
+
+ $auth = $self->authenticate_digest($c, $realm, $auth_info)
+ if $self->_is_http_auth_type('digest');
return $auth if $auth;
- $auth = $self->authenticate_basic($c, $realm, $auth_info) if $self->_is_http_auth_type('basic');
+ $auth = $self->authenticate_basic($c, $realm, $auth_info)
+ if $self->_is_http_auth_type('basic');
return $auth if $auth;
-
+
$self->authorization_required_response($c, $realm, $auth_info);
die $Catalyst::DETACH;
}
@@ -109,6 +111,10 @@
if ($self->check_password($user_obj, $opts)) {
return $user_obj;
}
+ else {
+ $c->log->debug("Password mismatch!") if $c->debug;
+ return;
+ }
}
else {
$c->log->debug("Unable to locate user matching user info provided") if $c->debug;
@@ -360,7 +366,7 @@
}
sub _add_authentication_header {
- my ( $c, $header ) = @_;
+ my ( $self, $c, $header ) = @_;
$c->response->headers->push_header( 'WWW-Authenticate' => $header );
return;
}
@@ -371,7 +377,7 @@
return unless $self->_is_http_auth_type('ntlm');
if ( my $ntlm = $self->_build_ntlm_auth_header( $c, $opts ) ) {
- _add_authentication_header( $c, $ntlm );
+ $self->_add_authentication_header( $c, $ntlm );
return 1;
}
@@ -384,7 +390,7 @@
return unless $self->_is_http_auth_type('ntlm');
if ( my $ntlm = $self->_build_ntlm_challenge_header( $c, $server, $flags ) ) {
- _add_authentication_header( $c, $ntlm );
+ $self->_add_authentication_header( $c, $ntlm );
return 1;
}
@@ -397,7 +403,7 @@
return unless $self->_is_http_auth_type('digest');
if ( my $digest = $self->_build_digest_auth_header( $c, $opts ) ) {
- _add_authentication_header( $c, $digest );
+ _$self->_add_authentication_header( $c, $digest );
return 1;
}
@@ -410,7 +416,7 @@
return unless $self->_is_http_auth_type('basic');
if ( my $basic = $self->_build_basic_auth_header( $c, $opts ) ) {
- _add_authentication_header( $c, $basic );
+ _$self->_add_authentication_header( $c, $basic );
return 1;
}
@@ -452,7 +458,7 @@
sub _build_basic_auth_header {
my ( $self, $c, $opts ) = @_;
- return _join_auth_header_parts( Basic => $self->_build_auth_header_common( $c, $opts ) );
+ return $self->_join_auth_header_parts( Basic => $self->_build_auth_header_common( $c, $opts ) );
}
sub _build_ntlm_auth_header {
@@ -473,7 +479,7 @@
$c->log->debug("NTLM type 2 message: $challenge_msg") if $c->debug;
- return _join_auth_header_parts( NTLM => $challenge_msg );
+ return $self->_join_auth_header_parts( NTLM => $challenge_msg );
}
sub _build_digest_auth_header {
@@ -485,7 +491,7 @@
$self->store_digest_authorization_nonce( $c, $key, $nonce );
- return _join_auth_header_parts( Digest =>
+ return $self->_join_auth_header_parts( Digest =>
$self->_build_auth_header_common($c, $opts),
map { sprintf '%s="%s"', $_, $nonce->$_ } qw(
qop
@@ -511,7 +517,7 @@
}
sub _join_auth_header_parts {
- my ( $type, @parts ) = @_;
+ my ( $self, $type, @parts ) = @_;
return "$type " . join(", ", @parts );
}
@@ -560,7 +566,7 @@
=head1 NAME
-Catalyst::Authentication::Credential::HTTP - HTTP NTLM, Digest and Basic authentication
+Catalyst::Authentication::Credential::HTTP - HTTP Basic, Digest and NTLM authentication
for Catalyst.
=head1 SYNOPSIS
@@ -633,7 +639,7 @@
=head1 DESCRIPTION
This module lets you use HTTP authentication with
-L<Catalyst::Plugin::Authentication>. Currently NTLM, Digest and Basic
+L<Catalyst::Plugin::Authentication>. Currently Basic, Digest and NTLM
authentication are supported.
When authentication is required, this module sets a status of 401, and
More information about the Catalyst-commits
mailing list