Class SystemApiKeyManagementService
Delegates system API key operations to IApiKeyAdministrationService, stamping the creating user's identity from their claims rather than trusting a caller-supplied value.
public class SystemApiKeyManagementService : ISystemApiKeyManagementService
- Inheritance
-
SystemApiKeyManagementService
- Implements
- Inherited Members
Remarks
Split out of ApiKeyManagementService: these operations belong to no team, so they carry no
per-team owner-scoping and are registered as a system service. Keeping them alongside the team
operations is what previously let one authorization policy be applied to both.
Constructors
SystemApiKeyManagementService(IApiKeyAdministrationService, IHttpContextAccessor)
public SystemApiKeyManagementService(IApiKeyAdministrationService inner, IHttpContextAccessor httpContextAccessor = null)
Parameters
innerIApiKeyAdministrationServicehttpContextAccessorIHttpContextAccessor
Methods
CreateSystemKeyAsync(string, string[], DateTime?)
public Task<IApiKey> CreateSystemKeyAsync(string name, string[] scopes, DateTime? expiryDate = null)
Parameters
Returns
DeleteSystemKeyAsync(string)
public Task DeleteSystemKeyAsync(string key)
Parameters
keystring
Returns
GetSystemKeysAsync()
public IAsyncEnumerable<IApiKey> GetSystemKeysAsync()
Returns
LockSystemKeyAsync(string)
public Task LockSystemKeyAsync(string key)
Parameters
keystring
Returns
RefreshSystemKeyAsync(string)
public Task<IApiKey> RefreshSystemKeyAsync(string key)
Parameters
keystring
Returns
SetSystemKeyDisabledAsync(string, bool)
Disables the key, or enables it again. A disabled key is refused at authentication but keeps its name, scopes, roles, tags and history — the reversible alternative to DeleteKeyAsync(string, string).
public Task SetSystemKeyDisabledAsync(string key, bool disabled)
Parameters
Returns
Remarks
Refreshing a disabled key does not enable it. A refresh mints a new secret; it is not a decision to trust the key again, and the usual reason to refresh is the same suspected leak that prompted the disable.