Skip to content

DapperMaticApiKeyOptions ​

Namespace: MJCZone.DapperMatic.AspNetCore.Authentication

Assembly: MJCZone.DapperMatic.AspNetCore

Summary ​

API keys: how programs sign in. Off until <c>dm.AddApiKeys()</c>. A key is shown once, when made, and kept only as a hash; it is sent as <c>Authorization: Bearer {key}</c> or in HeaderName, never in a URL.

sealed public

Contents ​

Constructors (1) | Methods (4) | Properties (6)

Constructors ​

DapperMaticApiKeyOptions ​

csharp
DapperMaticApiKeyOptions()

Methods ​

GetType ​

csharp
GetType()

ToString ​

csharp
ToString()

Equals ​

csharp
Equals()

GetHashCode ​

csharp
GetHashCode()

Properties ​

Prefix ​

Gets or sets what keys begin with, so that they are recognised when they leak (secret scanners, logs): 1 to 16 lowercase letters and digits. Default is <c>dm</c>.

Type: string

HeaderName ​

Gets or sets the header a key may be sent in, besides <c>Authorization: Bearer</c>. Default is <c>X-Api-Key</c>.

Type: string

MaxPersonalKeyLifetime ​

Gets or sets how long a personal key may last at most, or null (the default) for as long as its maker wants.

Type: TimeSpan?

MaxServiceKeyLifetime ​

Gets or sets how long a service account's key may last at most, or null (the default) for as long as its maker wants.

Type: TimeSpan?

PersonalKeyRoles ​

Gets the roles that may make their own personal keys; a caller with any of them may. Default is <c>authenticated</c> (anyone signed in); clear it to turn self-service off. Keys never make keys.

Type: List&lt;string&gt;

ResolveOwner ​

Gets or sets how a personal key's owner is found as they are now, each time the key signs in: their id and the key's tenant in, their principal out, or null when they are gone or no longer in that tenant. DapperMatic's built-in accounts find their own; with neither, personal keys cannot be made.

Type: Func&lt;string, string, IServiceProvider, CancellationToken, ValueTask&lt;ClaimsPrincipal&gt;&gt;