ServicePrincipalTokensTable
extends BaseTable
in package
ServicePrincipalTokens Table - API Token Management
Manages authentication tokens for service principals.
Table of Contents
Constants
- CACHE_GROUPS_TO_CLEAR = []
- CACHES_TO_CLEAR = []
- ID_CACHES_TO_CLEAR = []
Properties
- $CreatedByMembers : MembersTable|BelongsTo
- $ServicePrincipals : ServicePrincipalsTable|BelongsTo
Methods
- addBranchScopeQuery() : SelectQuery
- Add branch-based data scoping to a query.
- afterDelete() : void
- After delete hook to capture impersonation audit trail entries.
- afterSave() : void
- After-save handler for automatic cache invalidation.
- buildRules() : RulesChecker
- Returns a rules checker object.
- findActive() : SelectQuery
- Find active (non-expired) tokens.
- findByHash() : SelectQuery
- Find token by hash.
- findOrCreate() : ServicePrincipalToken
- get() : ServicePrincipalToken
- initialize() : void
- Initialize method
- newEmptyEntity() : ServicePrincipalToken
- newEntity() : ServicePrincipalToken
- patchEntity() : ServicePrincipalToken
- save() : ServicePrincipalToken|false
- saveOrFail() : ServicePrincipalToken
- updateLastUsed() : void
- Update last used timestamp for a token.
- validationDefault() : Validator
- Default validation rules.
- logImpersonationAction() : void
- Record impersonated writes to audit log table.
Constants
CACHE_GROUPS_TO_CLEAR
protected
array<string|int, string>
CACHE_GROUPS_TO_CLEAR
= []
Cache groups to clear entirely on save
CACHES_TO_CLEAR
protected
array<string|int, array{string, string}>
CACHES_TO_CLEAR
= []
Static cache entries to clear on save
ID_CACHES_TO_CLEAR
protected
array<string|int, array{string, string}>
ID_CACHES_TO_CLEAR
= []
Entity-ID cache prefixes to clear on save
Properties
$CreatedByMembers
public
MembersTable|BelongsTo
$CreatedByMembers
$ServicePrincipals
public
ServicePrincipalsTable|BelongsTo
$ServicePrincipals
Methods
addBranchScopeQuery()
Add branch-based data scoping to a query.
public
addBranchScopeQuery(SelectQuery $query, array<string|int, int> $branchIDs) : SelectQuery
Child tables should override for custom branch relationships.
Parameters
- $query : SelectQuery
-
The query to modify
- $branchIDs : array<string|int, int>
-
Authorized branch IDs
Return values
SelectQuery —Query with branch filtering
afterDelete()
After delete hook to capture impersonation audit trail entries.
public
afterDelete(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
- $event : EventInterface
-
Delete event
- $entity : EntityInterface
-
Entity being deleted
- $options : ArrayObject
-
Delete options
afterSave()
After-save handler for automatic cache invalidation.
public
afterSave(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
- $event : EventInterface
-
The afterSave event
- $entity : EntityInterface
-
The saved entity
- $options : ArrayObject
-
Save options
buildRules()
Returns a rules checker object.
public
buildRules(RulesChecker $rules) : RulesChecker
Parameters
- $rules : RulesChecker
-
The rules object
Return values
RulesCheckerfindActive()
Find active (non-expired) tokens.
public
findActive(SelectQuery $query) : SelectQuery
Parameters
- $query : SelectQuery
-
Query
Return values
SelectQueryfindByHash()
Find token by hash.
public
findByHash(SelectQuery $query, string $tokenHash) : SelectQuery
Parameters
- $query : SelectQuery
-
Query
- $tokenHash : string
-
Token hash
Return values
SelectQueryfindOrCreate()
public
findOrCreate(mixed $search[, callable|null $callback = = 'null' ][, array<string|int, mixed> $options = = '[]' ]) : ServicePrincipalToken
Parameters
- $search : mixed
- $callback : callable|null = = 'null'
- $options : array<string|int, mixed> = = '[]'
Return values
ServicePrincipalTokenget()
public
get(mixed $primaryKey[, array<string|int, mixed>|string $finder = = '\'all\'' ][, CacheInterface|string|null $cache = = 'null' ][, Closure|string|null $cacheKey = = 'null' ], mixed ...$args) : ServicePrincipalToken
Parameters
- $primaryKey : mixed
- $finder : array<string|int, mixed>|string = = '\'all\''
- $cache : CacheInterface|string|null = = 'null'
- $cacheKey : Closure|string|null = = 'null'
- $args : mixed
Return values
ServicePrincipalTokeninitialize()
Initialize method
public
initialize(array<string, mixed> $config) : void
Parameters
- $config : array<string, mixed>
-
Configuration
newEmptyEntity()
public
newEmptyEntity() : ServicePrincipalToken
Return values
ServicePrincipalTokennewEntity()
public
newEntity(array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : ServicePrincipalToken
Parameters
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
ServicePrincipalTokenpatchEntity()
public
patchEntity(EntityInterface $entity, array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : ServicePrincipalToken
Parameters
- $entity : EntityInterface
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
ServicePrincipalTokensave()
public
save(EntityInterface $entity[, array<string|int, mixed> $options = = '[]' ]) : ServicePrincipalToken|false
Parameters
- $entity : EntityInterface
- $options : array<string|int, mixed> = = '[]'
Return values
ServicePrincipalToken|falsesaveOrFail()
public
saveOrFail(EntityInterface $entity[, array<string|int, mixed> $options = = '[]' ]) : ServicePrincipalToken
Parameters
- $entity : EntityInterface
- $options : array<string|int, mixed> = = '[]'
Return values
ServicePrincipalTokenupdateLastUsed()
Update last used timestamp for a token.
public
updateLastUsed(int $tokenId) : void
Parameters
- $tokenId : int
-
Token ID
validationDefault()
Default validation rules.
public
validationDefault(Validator $validator) : Validator
Parameters
- $validator : Validator
-
Validator instance
Return values
ValidatorlogImpersonationAction()
Record impersonated writes to audit log table.
protected
logImpersonationAction(string $defaultOperation, EntityInterface $entity) : void
Parameters
- $defaultOperation : string
-
Operation fallback (save/delete)
- $entity : EntityInterface
-
Affected entity