17.31. Class AuthenticationTable

Namespace: ArmoniK.Core.Adapters.MongoDB
Assembly: ArmoniK.Core.Adapters.MongoDB.dll

Storage class containing the authentication data

[PublicAPI]
public class AuthenticationTable : IAuthenticationTable, IInitializable, IHealthCheckProvider

17.31.1. Inheritance

objectAuthenticationTable

17.31.2. Implements

IAuthenticationTable, IInitializable, IHealthCheckProvider

17.31.3. Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

17.31.4. Constructors

17.31.4.1. AuthenticationTable(SessionProvider, MongoCollectionProvider<UserData, UserDataModelMapping>, MongoCollectionProvider<AuthData, AuthDataModelMapping>, MongoCollectionProvider<RoleData, RoleDataModelMapping>, ILogger<AuthenticationTable>, ActivitySource)

Creates an authentication storage

public AuthenticationTable(SessionProvider sessionProvider, MongoCollectionProvider<UserData, UserDataModelMapping> userCollectionProvider, MongoCollectionProvider<AuthData, AuthDataModelMapping> authCollectionProvider, MongoCollectionProvider<RoleData, RoleDataModelMapping> roleCollectionProvider, ILogger<AuthenticationTable> logger, ActivitySource activitySource)

17.31.4.1.1. Parameters

sessionProvider SessionProvider

MongoDB session provider

userCollectionProvider MongoCollectionProvider<UserData, UserDataModelMapping>

Provider for the collection containing user data

authCollectionProvider MongoCollectionProvider<AuthData, AuthDataModelMapping>

Provider for the collection containing certificate data

roleCollectionProvider MongoCollectionProvider<RoleData, RoleDataModelMapping>

Provider for the collection containing role data

logger ILogger<AuthenticationTable>

Logger

activitySource ActivitySource

Activity source

17.31.5. Properties

17.31.5.1. Logger

Logger

public ILogger Logger { get; }

17.31.5.1.1. Property Value

ILogger

17.31.6. Methods

17.31.6.1. AddCertificates(IEnumerable<AuthData>)

Adds certificates to the database

public void AddCertificates(IEnumerable<AuthData> certificates)

17.31.6.1.1. Parameters

certificates IEnumerable<AuthData>

Certificates to be added

17.31.6.2. AddRoles(IEnumerable<RoleData>)

Adds roles to the database

public void AddRoles(IEnumerable<RoleData> roles)

17.31.6.2.1. Parameters

roles IEnumerable<RoleData>

Roles to be added

17.31.6.3. AddUsers(IEnumerable<UserData>)

Adds users to the database

public void AddUsers(IEnumerable<UserData> users)

17.31.6.3.1. Parameters

users IEnumerable<UserData>

Users to be added

17.31.6.4. Check(HealthCheckTag)

Checks the status of a class for the given health check type.

public Task<HealthCheckResult> Check(HealthCheckTag tag)

17.31.6.4.1. Parameters

tag HealthCheckTag

Health check for which the class has to answer.

17.31.6.4.2. Returns

Task<HealthCheckResult>

The result of the check containing the status of the class for the health check type.

17.31.6.5. GetIdentityFromCertificateAsync(string, string, CancellationToken)

Get the User authentication data from the database, based on the provided certificate

public Task<UserAuthenticationResult?> GetIdentityFromCertificateAsync(string cn, string fingerprint, CancellationToken cancellationToken = default)

17.31.6.5.1. Parameters

cn string

Common name of the certificate

fingerprint string

Fingerprint of the certificate

cancellationToken CancellationToken

Cancellation token

17.31.6.5.2. Returns

Task<UserAuthenticationResult?>

User authentication data matching the provided certificate, null if not found

17.31.6.6. GetIdentityFromUserAsync(string?, string?, CancellationToken)

Get the User authentication data from the database, based on the id or username. If id is not null, will be used for matching, otherwise tries to match the username

public Task<UserAuthenticationResult?> GetIdentityFromUserAsync(string? id, string? username, CancellationToken cancellationToken = default)

17.31.6.6.1. Parameters

id string?

User Id

username string?

User name

cancellationToken CancellationToken

Cancellation token

17.31.6.6.2. Returns

Task<UserAuthenticationResult?>

User authentication data matching the id, if not null, otherwise the username, null if not found

17.31.6.7. Init(CancellationToken)

Executes an initialization process for the class

public Task Init(CancellationToken cancellationToken)

17.31.6.7.1. Parameters

cancellationToken CancellationToken

Token used to cancel the execution of the method

17.31.6.7.2. Returns

Task

Task representing the asynchronous execution of the method