1:- module(conf_authenticate, []).
2:- use_module(library(http/http_wrapper), []).
3:- use_module(library(http/http_authenticate)).
4:- use_module(user(user_db)).
5
19
20:- multifile
21 http:request_expansion/2.
22
23http:request_expansion(Request, Request) :-
24 memberchk(authorization(Text), Request), !,
25 ( http_authorization_data(Text, basic(User, Password)),
26 validate_password(User, Password)
27 -> true
28 ; throw(http_reply(authorise(basic, 'ClioPatria')))
29 ).
30http:request_expansion(Request, Request) :-
31 \+ current_user(_), !. 32http:request_expansion(Request, Request) :-
33 throw(http_reply(authorise(basic, 'ClioPatria'))).