Class InMemoryCredentialRepository
- Namespace
- Core.CliniCore.Repositories.InMemory
- Assembly
- Core.CliniCore.dll
In-memory implementation of ICredentialRepository. Maintains a secondary index by username for O(1) authentication lookups.
public class InMemoryCredentialRepository : InMemoryRepositoryBase<UserCredential>, ICredentialRepository, IRepository<UserCredential>
- Inheritance
-
InMemoryCredentialRepository
- Implements
- Inherited Members
Methods
Add(UserCredential)
Adds a new credential and updates the username index.
public override void Add(UserCredential entity)
Parameters
entityUserCredential
Delete(Guid)
Deletes a credential and removes from the username index.
public override void Delete(Guid id)
Parameters
idGuid
Exists(string)
Checks if a username already exists.
public bool Exists(string username)
Parameters
usernamestring
Returns
GetByUsername(string)
Gets a credential by username (the natural key for authentication).
public UserCredential? GetByUsername(string username)
Parameters
usernamestring
Returns
Register(Guid, string, string, string)
Registers a new credential with password hashing.
public UserCredential? Register(Guid id, string username, string password, string role)
Parameters
Returns
Search(string)
Searches credentials by username (partial match).
public override IEnumerable<UserCredential> Search(string query)
Parameters
querystring
Returns
Update(UserCredential)
Updates an existing credential. Username changes are not allowed.
public override void Update(UserCredential entity)
Parameters
entityUserCredential