TsgcWSAPIKeyManager › Methods › IsConnectionAllowed
Server hook enforcing the optional IPAllowlist when FailClosed is True.
function IsConnectionAllowed(const aIP: string): Boolean;
| Name | Type | Description |
|---|---|---|
aIP | const string | Peer IP of the incoming TCP connection as reported by the server socket. |
False only when Enabled is True, Validation.FailClosed is True, Validation.IPAllowlist is non-empty and the supplied IP is not a member. True in every other case (allowlist empty, FailClosed off, component disabled). (Boolean)
Server-side hook invoked automatically by TsgcWebSocketHTTPServer and TsgcWSServer_HTTPAPI when this manager is assigned to their APIKeyManager property. Runs before the HTTP headers are available, so it only enforces the IP allowlist — actual API-key authentication happens later from IsRequestAuthorized in OnConnect. Do not call it manually unless you are bridging the manager into a custom server loop.
// Custom server loop bridging the manager
if not sgcWSAPIKeyManager1.IsConnectionAllowed(oPeer.IP) then
oPeer.Disconnect;