Table of Contents

Class ApiKey

Namespace
BiExcellence.OpenBi.Api.ApiKeys
Assembly
BiExcellence.OpenBi.Api.Client.dll

An API key: a non-interactive credential. Its Id and Secret are the client_id and client_secret that CreateAccessTokenAsync(IOpenBiApiClient, string, string, string?, CancellationToken) sends with the client_credentials grant, and the token it returns acts as the user the key belongs to.

public sealed record ApiKey : IApiKey
Inheritance
object
ApiKey
Implements

Properties

Created

When the key was created. Set by the server.

[JsonPropertyName("created")]
public DateTimeOffset Created { get; init; }

Property Value

DateTimeOffset

Id

The key's id, which is also its OAuth2 client_id. Generated by the server when left unset on create.

[JsonPropertyName("id")]
public string? Id { get; init; }

Property Value

string

LastUsed

When an access token was last issued for the key, null if never. Set by the server.

[JsonPropertyName("lastUsed")]
public DateTimeOffset? LastUsed { get; init; }

Property Value

DateTimeOffset?

Name

The display name of the key, so its owner can tell several keys apart.

[JsonPropertyName("name")]
public string? Name { get; init; }

Property Value

string

Scope

The permission ids the key may use, space delimited, as openbi.<resource>.<read|write|delete>. Empty or null means unrestricted, not powerless: a token then gets the permissions of the key's user. A key that names scopes gets those, and a token request may narrow them further. A token never gets a permission the key's user does not hold when it is issued; such a scope is dropped.

[JsonPropertyName("scope")]
public string? Scope { get; init; }

Property Value

string

Secret

The key's OAuth2 client_secret, in the one response that generates it - a create, or CreateApiKeySecretAsync(IOpenBiApiClient, string, CancellationToken) - and null in every other: the server keeps only a hash. Ignored in a request.

[JsonPropertyName("secret")]
public string? Secret { get; init; }

Property Value

string

UserId

The username of the user the key acts as. Always the calling user, unless the caller holds openbi.user.write; left unset on an update, the owner stays.

[JsonPropertyName("userId")]
public string? UserId { get; init; }

Property Value

string