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:
1 2 3 4 5 6 7 8 9 10 11 |
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: