Class AuthenticationManager
Simplic authentication manager, which logs a user in and creates its identity and principal
Inheritance
System.Object
AuthenticationManager
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Simplic.Framework.Base.Auth
Assembly: Simplic.Framework.Base.dll
Syntax
public class AuthenticationManager
Constructors
| Improve this Doc View SourceAuthenticationManager()
Initialize new authentication manager
Declaration
public AuthenticationManager()
Methods
| Improve this Doc View SourceAuthorizeAsync(IIdentity)
Get the principal which belongs to authenticated user
Declaration
public async Task<IPrincipal> AuthorizeAsync(IIdentity identity)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IIdentity | identity | Identity instance for authorization |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Security.Principal.IPrincipal> | Principal if valid identity, else null |
LoginAsync(String, String)
Login a user and return it's identity
Declaration
public async Task<IIdentity> LoginAsync(string userName, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | userName | Unique username |
System.String | password | Not hashed password |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Security.Principal.IIdentity> | identity if found and valid, else null |
LoginByApiKeyAsync(String, String)
Login a user and return it's identity using an API key.
Declaration
public async Task<IIdentity> LoginByApiKeyAsync(string userName, string apiKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | userName | Unique username |
System.String | apiKey | API key |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Security.Principal.IIdentity> | identity if found and valid, else null |