TsgcWSAPIKeyManagerProperties › Scopes

Scopes Property

Catalog of allowed scope strings enforced when keys are issued or checked for a required scope.

Syntax

property Scopes: TsgcAPIKeyScopeList read FScopes write SetScopes;

Default Value

Remarks

Catalog of the scope strings your API recognises. When Scopes.Enabled is True every scope attached to an issued key (or requested via aRequiredScope on ValidateKey / IsRequestAuthorized) must exist in this list — unknown scopes are rejected. Each item is a TsgcAPIKeyScopeItem with Name (case-sensitive identifier such as read:orders), Description (shown in the object inspector and admin UIs) and its own Enabled flag so a scope can be temporarily disabled without deleting it. Disabled catalog entries never satisfy HasScope. Pair with IsRequestAuthorized to enforce per-endpoint permissions.

Example

sgcWSAPIKeyManager1.Scopes.Enabled := True;

with sgcWSAPIKeyManager1.Scopes.Scopes.Add as TsgcAPIKeyScopeItem do
begin
  Name := 'read:orders';
  Description := 'List and read order history';
end;

with sgcWSAPIKeyManager1.Scopes.Scopes.Add as TsgcAPIKeyScopeItem do
begin
  Name := 'write:shipments';
  Description := 'Create and update shipment records';
end;

Back to Properties