From: Tomas Doran Date: Wed, 10 Sep 2008 15:46:35 +0000 (+0000) Subject: Add an example of how to call authorization_required_response (you used to just be... X-Git-Tag: v1.003~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Authentication-Credential-HTTP.git;a=commitdiff_plain;h=031f556c9ad2c64f19b6feb03e65924d41dfafba Add an example of how to call authorization_required_response (you used to just be able to call it on , but now we are no longer a plugin, it's a tad more involved) --- diff --git a/Changes b/Changes index 4be501e..7f9af0e 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,8 @@ when calling $c->authenticate. Docs and tests for this. - Clean up documentation of options inherited from Catalyst::Authentication::Credential::Password + - Added an example of calling methods in the credential module from a + controller to the POD. 1.002 2008-09-03 - Fix the assumptions that the password field is named password when doing diff --git a/Todo b/Todo index c87e4a8..fe959cf 100644 --- a/Todo +++ b/Todo @@ -1,6 +1,4 @@ . Document md5'd passwords for digest stuff -. Port work's apps. -. Document how to find the credential module, so that you can call authorization_required_response if you want to. . Add deprecation notice to old module. . document & test authorization_required_message . Test $self->_config->{authorization_required_message} + authorization_required_message = undef does not stamp on body. diff --git a/lib/Catalyst/Authentication/Credential/HTTP.pm b/lib/Catalyst/Authentication/Credential/HTTP.pm index f1ff62b..806f355 100644 --- a/lib/Catalyst/Authentication/Credential/HTTP.pm +++ b/lib/Catalyst/Authentication/Credential/HTTP.pm @@ -410,6 +410,16 @@ for Catalyst. do_stuff(); } + + sub always_auth : Local { + my ( $self, $c ) = @_; + + # Force authorization headers onto the response so that the user + # is asked again for authentication, even if they successfully + # authenticated. + my $realm = $c->get_auth_realm('example'); + $realm->credential->authorization_required_response($c, $realm); + } # with ACL plugin __PACKAGE__->deny_access_unless("/path", sub { $_[0]->authenticate });