Filtri Menu 0 0.00

Add basic authentication to your IdHttpServer with Delphi

Add basic authentication to your IdHttpServer with Delphi

To add basic authentication to you own http server is really simple, you only need to add inside the “onCommandGet” method the authentication check, as in the example shown after the image

Inside the method you can:

if 
  ( ARequestInfo.AuthUsername.ToUpper.Equals('USERNAME'.ToUpper)
   and
   ARequestInfo.AuthPassword.Equals('PASSWORD')
  )
then
begin 
  AResponseInfo. ResponseNo : = 401;
  AResponseInfo. AuthRealm : = 'Autentication required'; 
  exit;
end;

related articles:

Condividi:

Iscriviti alla newsletter

Iscriviti alla nostra newsletter per ricevere offerte di sconto anticipate, aggiornamenti e informazioni sui nuovi prodotti.
Top