In handler.imc:
.namespace [ 'MyAuthHandler' ]
.sub _handler
.local pmc r
.local pmc ap_const
.local string pw
.local int status
find_global ap_const, 'Apache::Constants', 'ap_constants'
# get the request_rec object
find_type $I0, 'Apache::RequestRec'
r = new $I0
# decline if not the initial request
$I1 = r.'is_initial_req'( )
if $I1 != 1 goto auth_declined
(status, pw) = r.'get_basic_auth_pw'( )
if pw != 'squawk' goto auth_failure
$I0 = ap_const['OK']
goto auth_return_status
auth_failure:
$I0 = ap_const['HTTP_UNAUTHORIZED']
goto auth_return_status
auth_declined:
$I0 = ap_const['DECLINED']
goto auth_return_status
auth_return_status:
.pcc_begin_return
.return $I0
.pcc_end_return
.end
In httpd.conf:
ParrotLoad
/tmp/handler.pbc
<Directory/usr/local/apache2/htdocs/parrot/private>
ParrotAuthenHandler MyAuthHandler
AuthType Basic
AuthName "Parrot Test"
Require valid-user
</Directory>
Parrot authentication handlers 0 Comments More | Login | Reply /