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:

Share:

Subscribe to newsletter

Subscribe to our newsletter to receive early discount offers, updates and new products info.
Top