Hi !
I'd like to make a component that forces the user to authenticate again.
I founded how to do it in php, this is simple as that:
<?php
Header("WWW-Authenticate: Basic realm=\"My Realm\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You canceled authentication\n";
exit;
?>
But I cannot figured out how to do it in mason.
I tried:
<%flags>
inherit=> undef
</%flags>
<%perl>
$m->autoflush(0);
$m->clear_buffer();
$r->header_out->add("WWW-Authenticate" => 'Basic realm="RealmChain"');
$r->header_out->add("HTTP/1.0 401 Unauthorized" => '');
$r->send_http_header();
$m->abort();
</%perl>
But it just make my browser display a void page.
Could anybody can help ?
Thanks !
Jerome.
--
Nice photos of naked perl sources here !
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.