HyperServer and HTTP Authentication

procedure TUniServerModule.UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo;
AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean);
begin
if ARequestInfo.AuthExists and
(ARequestInfo.AuthPassword = '1234') and
(ARequestInfo.AuthUsername = 'demo') then
begin
Exit; // Authentication is successful
end
else
begin
// Request authentication
AResponseInfo.AuthRealm := 'Enter credentials for ' + Title;
AResponseInfo.ResponseNo := 401;
Handled := True;
end;
end;