AbstractAuthIdentity. This ensures that your authorization logic can always rely on an identity object being present, eliminating the need for null checks.
AbstractAuthIdentity
The base class for all identities. It defines the contract for checking authentication status, granted scopes, and permissions.Methods
isAuthenticated(): bool: Returnstrueif the requester is authenticated.getScopes(): string[]: Returns an array of scope names granted to this identity.getPermissions(): string[]: Returns an array of permission names granted to this identity.isScopeGranted(string $scope): bool: Helper method to check if a specific scope is present.isPermissionGranted(string $permission): bool: Helper method to check if a specific permission is present.
JwtAuthIdentity
Represents a successfully authenticated user via JWT.Usage
Typically created by the JwtAuthenticator after validating a token.Additional Methods
getUsername(): ?string: Returns the username.getEmail(): ?string: Returns the email.getSub(): ?string: Returns the subject (subclaim).
GuestAuthIdentity
Represents an anonymous or non-authenticated requester.Usage
By default, every request is initialized with an emptyGuestAuthIdentity.
Public Scopes
You can initialize aGuestAuthIdentity with default scopes. This is useful for “Public but scoped” endpoints where you want to grant certain permissions to everyone.