TsgcHTTPServer › Properties › Authentication
Enables and configures user/password authentication for incoming HTTP connections.
property Authentication: TsgcWSAuthenticationServer_Options read FAuthentication write SetAuthentication;
Enabled=False
When Authentication.Enabled is True the server authenticates every incoming connection against the AuthUsers list (format user=password per line) using the Basic scheme (HTTP Basic Access Authentication). The Session and URL schemes documented on TsgcWebSocketHTTPServer attach credentials to the WebSocket handshake and have no effect on TsgcHTTPServer, since this component never upgrades a connection. The OnAuthentication event lets you plug in your own credential check; OnUnknownAuthentication handles non-standard schemes such as Bearer/JWT/OAuth2/WebAuthn. Use CustomHeaders to add extra HTTP headers returned on authentication errors.
oServer := TsgcHTTPServer.Create(nil);
oServer.Authentication.Enabled := true;
oServer.Authentication.Basic.Enabled := true;
oServer.Authentication.AuthUsers.Add('user=secret');
oServer.Active := true;