<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
thanks for confirming, that I didn't miss anything. I have – for now
– resolved to something similar:<br>
<br>
my ($username,$password) =
$c->req->headers->authorization_basic;<br>
my ($u,$d) = split(/\@/,$username);<br>
$c->req->headers->authorization_basic($u,$password);<br>
my $res = $c->authenticate({}, $realm);<br>
<br>
if($c->user_exists) {<br>
$c->log->debug("checking
'".$c->user->domain->domain."' against '$d'");<br>
if ($c->user->domain->domain ne $d) {<br>
$c->user->logout;<br>
$c->log->warn("invalid api http login from
'".$c->req->address."'");<br>
my $r = $c->get_auth_realm($realm);<br>
$r->credential->authorization_required_response($c,
$r);<br>
return;<br>
}<br>
...<br>
} else {<br>
$c->log->warn("invalid api http login from
'".$c->req->address."'");<br>
my $r = $c->get_auth_realm($realm);<br>
$r->credential->authorization_required_response($c, $r);<br>
return;<br>
}<br>
<br>
<br>
If I get around to it, I'll consider extending
Catalyst::Authentication::Credential::HTTP because this sounds like
a useful feature.<br>
<br>
-Gerhard<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 2016-05-17 11:45, Dermot wrote:<br>
</div>
<blockquote
cite="mid:CAK+UtvK1jxrqFEkXH9Uqn+qkpSVJbQK5=rUJUQ07RYLF4ZgCmw@mail.gmail.com"
type="cite">
<div dir="ltr">We had a similar problem at $work. To get what we
wanted we had to stop using the HTTP plugin and do something
like this (warning: hand-written, un-tested code follows) in the
Root controller.
<div><br>
</div>
<div>my ( $username, $password ) =
$c->request->headers->authorization_basic;<br>
</div>
<div>my $logged_in_user;</div>
<div>if ( defined $username && defined $password ) {<br>
</div>
<div>
some_method_in_users_that_concatenates_and_athenticates($username,
$password);</div>
<div>}<br>
</div>
<div><br>
</div>
<div>if ($logged_in_user) {</div>
<div> $c->stash(user => $logged_in_user;</div>
<div> ...</div>
<div>}<br>
</div>
<div>else {</div>
<div> $c->response->header('WWW-Authenticate' =>
'Basic realm="MyRealm");</div>
<div> $c->response->content_type('text/plain');</div>
<div> $c->response->status(401);</div>
<div> $c->detach();</div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div>HTH,</div>
<div>Dermot</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 13 May 2016 at 16:32, Gerhard
Jungwirth <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:gjungwirth@sipwise.com" target="_blank">gjungwirth@sipwise.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am using Catalyst::Authentication::Store::DBIx::Class and<br>
Catalyst::Authentication::Credential::HTTP with the
following configuration:<br>
<br>
my_realm => {<br>
credential => {<br>
class => 'HTTP',<br>
type => 'basic',<br>
username_field => 'username',<br>
password_field => 'password',<br>
password_type => 'clear',<br>
},<br>
store => {<br>
class => 'DBIx::Class',<br>
user_model => 'DB::my_user_table',<br>
},<br>
},<br>
<br>
Which works great. The thing is: I want the user to
authenticate in the form "username@domain:password" using
HTTP Basic Authentication, where username and domain are
checked against separate fields in my DBIx::Class table.
(Ideally, domain is checked against a related table in my
schema)<br>
<br>
Is that supported? If not, can it be added? If not, how do
you suggest I implement that?<br>
<br>
Thanks and Cheers,<br>
Gerhard<br>
<br>
_______________________________________________<br>
List: <a moz-do-not-send="true"
href="mailto:Catalyst@lists.scsys.co.uk" target="_blank">Catalyst@lists.scsys.co.uk</a><br>
Listinfo: <a moz-do-not-send="true"
href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"
rel="noreferrer" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>
Searchable archive: <a moz-do-not-send="true"
href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"
rel="noreferrer" target="_blank">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>
Dev site: <a moz-do-not-send="true"
href="http://dev.catalyst.perl.org/" rel="noreferrer"
target="_blank">http://dev.catalyst.perl.org/</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
List: <a class="moz-txt-link-abbreviated" href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a>
Listinfo: <a class="moz-txt-link-freetext" href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a>
Searchable archive: <a class="moz-txt-link-freetext" href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a>
Dev site: <a class="moz-txt-link-freetext" href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a>
</pre>
</blockquote>
<br>
</body>
</html>