ApiIdentity
final class ApiIdentity (View source)
Carries the authenticated API principal, its permissions and its verified trust boundary.
The authenticator owns trust assignment. Identity type and scopes remain descriptive and never promote an external identity to internal trust.
Methods
Creates an immutable identity from claims already verified by an API authenticator.
Returns the stable principal identifier supplied by the authenticator.
Returns the authenticator-defined identity category without granting trust from its value.
Returns the permissions verified for this identity.
Returns the optional human-readable principal name.
Reports whether the identity owns the exact supplied permission.
Returns the trust boundary established by the authenticator.
Details
__construct
__construct(string $id, string $type, array $scopes = [], string|null $name = null, ApiIdentityTrust $trust = ApiIdentityTrust::External)
Creates an immutable identity from claims already verified by an API authenticator.
Omitted trust defaults to external so existing callers cannot acquire internal access implicitly.
id
string
id()
Returns the stable principal identifier supplied by the authenticator.
type
string
type()
Returns the authenticator-defined identity category without granting trust from its value.
scopes
array
scopes()
Returns the permissions verified for this identity.
name
string|null
name()
Returns the optional human-readable principal name.
hasScope
bool
hasScope(string $scope)
Reports whether the identity owns the exact supplied permission.
trust
ApiIdentityTrust
trust()
Returns the trust boundary established by the authenticator.