Checking in changes prior to tagging of version 1.003. Changelog diff is: v1.003
Tomas Doran [Thu, 11 Sep 2008 14:22:13 +0000 (14:22 +0000)]
=== Changes
==================================================================
--- Changes (revision 7358)
+++ Changes (local)
@@ -1,4 +1,4 @@
-1.003  2008-09-??
+1.003  2008-09-11
- Add ability to override the realm name presented for authentication
when calling $c->authenticate. Documentation and tests for this.
- Clean up documentation of options inherited from
@@ -7,7 +7,8 @@
controller to the POD.
- Tests for the authorization_required_message configuration parameter.
- Document use_uri_for configuration option
-   - Document domain option (passed through from $c->authenticate)
+   - Document domain option (passed through from $c->authenticate) and add
+     tests for this option.

1.002  2008-09-03
- Fix the assumptions that the password field is named password when doing

Changes
lib/Catalyst/Authentication/Credential/HTTP.pm
t/basic.t

diff --git a/Changes b/Changes
index 65893f0..70f8995 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-1.003  2008-09-??
+1.003  2008-09-11
    - Add ability to override the realm name presented for authentication
      when calling $c->authenticate. Documentation and tests for this.
    - Clean up documentation of options inherited from 
@@ -7,7 +7,8 @@
      controller to the POD.
    - Tests for the authorization_required_message configuration parameter. 
    - Document use_uri_for configuration option
-   - Document domain option (passed through from $c->authenticate)
+   - Document domain option (passed through from $c->authenticate) and add 
+     tests for this option.
 
 1.002  2008-09-03
    - Fix the assumptions that the password field is named password when doing 
index 49e2a23..43e464e 100644 (file)
@@ -13,7 +13,7 @@ BEGIN {
     __PACKAGE__->mk_accessors(qw/_config realm/);
 }
 
-our $VERSION = "1.002";
+our $VERSION = "1.003";
 
 sub new {
     my ($class, $config, $app, $realm) = @_;
@@ -258,7 +258,6 @@ sub _build_auth_header_realm {
 
 sub _build_auth_header_domain {
     my ( $self, $c, $opts ) = @_;
-
     if ( my $domain = $opts->{domain} ) {
         Catalyst::Exception->throw("domain must be an array reference")
           unless ref($domain) && ref($domain) eq "ARRAY";
@@ -275,7 +274,7 @@ sub _build_auth_header_domain {
 
 sub _build_auth_header_common {
     my ( $self, $c, $opts ) = @_;
-
+warn("HERE Opts $opts");
     return (
         $self->_build_auth_header_realm($c, $opts),
         $self->_build_auth_header_domain($c, $opts),
@@ -534,12 +533,12 @@ Set this to a string to override the default body content "Authorization require
 
 =item password_type
 
-The type of password returned by the user object. Same useage as in 
+The type of password returned by the user object. Same usage as in 
 L<Catalyst::Authentication::Credential::Password|Catalyst::Authentication::Credential::Password/passwprd_type>
 
 =item password_field
 
-The name of accessor used to retrieve the value of the password field from the user object. Same useage as in 
+The name of accessor used to retrieve the value of the password field from the user object. Same usage as in 
 L<Catalyst::Authentication::Credential::Password|Catalyst::Authentication::Credential::Password/password_field>
 
 =item use_uri_for
index 91f2dc9..cda8e62 100644 (file)
--- a/t/basic.t
+++ b/t/basic.t
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use strict;
 use warnings;
-use Test::More tests => 28;
+use Test::More tests => 31;
 use Test::MockObject::Extends;
 use Test::MockObject;
 use Test::Exception;
@@ -127,6 +127,8 @@ $c->clear;
     is( $body, 'foobar', 'Body is supplied auth message');
 }
 
+# Check undef authorization_required_message suppresses crapping in
+# the body.
 $req_headers->clear;
 $res_headers->clear;
 $c->clear;
@@ -138,4 +140,19 @@ $c->clear;
         $self->authenticate( $c, $realm );
     } qr/^ $Catalyst::DETACH $/x, "detached";
     is( $body, undef, 'Body is not set - user overrode auth message');
-}
\ No newline at end of file
+}
+
+# Check domain config works
+$req_headers->clear;
+$res_headers->clear;
+$c->clear;
+{
+    my $self = new_self( type => 'any', password_type => 'clear',
+        #use_uri_for => 1,
+    );
+    throws_ok {
+        $self->authenticate( $c, $realm, {domain => [qw/dom1 dom2/]} );
+    } qr/^ $Catalyst::DETACH $/x, "detached";
+    like( ($res_headers->header('WWW-Authenticate'))[0], qr/domain="dom1 dom2"/, "WWW-Authenticate header set: digest domains set");
+    like( ($res_headers->header('WWW-Authenticate'))[1], qr/domain="dom1 dom2"/, "WWW-Authenticate header set: basic domains set");
+}