HyperServer e Autenticação HTTP

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; // Autenticação bem-sucedida
end
else
begin
// Solicitar autenticação
AResponseInfo.AuthRealm := 'Insira as credenciais para ' + Title;
AResponseInfo.ResponseNo := 401;
Handled := True;
end;
end;