22.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
22.31.1. Inheritance
22.31.2. Implements
IAuthenticationTable, IInitializable, IHealthCheckProvider
22.31.3. Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
22.31.4. Constructors
22.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)
22.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
22.31.5. Properties
22.31.5.1. Logger
Logger
public ILogger Logger { get; }
22.31.5.1.1. Property Value
22.31.6. Methods
22.31.6.1. AddCertificates(IEnumerable<AuthData>)
Adds certificates to the database
public void AddCertificates(IEnumerable<AuthData> certificates)
22.31.6.1.1. Parameters
certificates IEnumerable<AuthData>
Certificates to be added
22.31.6.2. AddRoles(IEnumerable<RoleData>)
Adds roles to the database
public void AddRoles(IEnumerable<RoleData> roles)
22.31.6.2.1. Parameters
roles IEnumerable<RoleData>
Roles to be added
22.31.6.3. AddUsers(IEnumerable<UserData>)
Adds users to the database
public void AddUsers(IEnumerable<UserData> users)
22.31.6.3.1. Parameters
users IEnumerable<UserData>
Users to be added
22.31.6.4. Check(HealthCheckTag)
Checks the status of a class for the given health check type.
public Task<HealthCheckResult> Check(HealthCheckTag tag)
22.31.6.4.1. Parameters
tag HealthCheckTag
Health check for which the class has to answer.
22.31.6.4.2. Returns
The result of the check containing the status of the class for the health check type.
22.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)
22.31.6.5.1. Parameters
cn string
Common name of the certificate
fingerprint string
Fingerprint of the certificate
cancellationToken CancellationToken
Cancellation token
22.31.6.5.2. Returns
Task<UserAuthenticationResult?>
User authentication data matching the provided certificate, null if not found
22.31.6.6. GetIdentityFromUserAsync(int?, 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(int? id, string? username, CancellationToken cancellationToken = default)
22.31.6.6.1. Parameters
id int?
User Id
username string?
User name
cancellationToken CancellationToken
Cancellation token
22.31.6.6.2. Returns
Task<UserAuthenticationResult?>
User authentication data matching the id, if not null, otherwise the username, null if not found
22.31.6.7. Init(CancellationToken)
Executes an initialization process for the class
public Task Init(CancellationToken cancellationToken)
22.31.6.7.1. Parameters
cancellationToken CancellationToken
Token used to cancel the execution of the method
22.31.6.7.2. Returns
Task representing the asynchronous execution of the method