Class Authenticator
Inherited Members
Namespace: LemonEdge.Connections.Database
Assembly: LemonEdge.Database.Connector.dll
Syntax
public class Authenticator : IDatabaseAuthenticator, IAuthenticator
Constructors
Authenticator(IDatabaseInfoManager, IEntityContextFactory, IDatabaseStatusProxy, IDatabaseCacheFactory, ILogger<Authenticator>)
Declaration
public Authenticator(IDatabaseInfoManager databaseInfoManager, IEntityContextFactory entityContextFactory, IDatabaseStatusProxy databaseStatusProxy, IDatabaseCacheFactory cacheFactory, ILogger<Authenticator> logger)
Parameters
Type | Name | Description |
---|---|---|
IDatabaseInfoManager | databaseInfoManager | |
IEntityContextFactory | entityContextFactory | |
IDatabaseStatusProxy | databaseStatusProxy | |
IDatabaseCacheFactory | cacheFactory | |
ILogger<Authenticator> | logger |
Methods
ForceUpgrade(string)
If you are connected directly to the database this will attempt to force an upgrade of the database if the database has current state of being upgraded.
This can only be used in cases of direct database connection, and should only be used when you know the current upgrading process has failed or crashed, and that this process should attempt the upgrade instead
It will not perform an upgrade if the database is not stuck being marked as upgrading, or if you are not directly connected to it.Declaration
public Task<bool> ForceUpgrade(string source)
Parameters
Type | Name | Description |
---|---|---|
string | source |
Returns
Type | Description |
---|---|
Task<bool> | Indicates if the upgrade worked |
GetAppServiceVersion()
Returns the app service version of the connected database to indicate compatibility
Declaration
public Task<Version> GetAppServiceVersion()
Returns
Type | Description |
---|---|
Task<Version> | The appservice version of the connected database to indicate compatibility |
GetClientLoginSettings()
Gets Client Settings. For a service this means the currently configured auth token handlers, plus Windows negotiate, if configured. For local db connection, this means Windows auth and or username and password.
Declaration
public virtual Task<ClientAuthenticationSettings> GetClientLoginSettings()
Returns
Type | Description |
---|---|
Task<ClientAuthenticationSettings> | A ClientAuthenticationSettings object |
GetDatabaseName()
Returns the name of the database that backs this service.
Declaration
public Task<string> GetDatabaseName()
Returns
Type | Description |
---|---|
Task<string> |
GetDatabaseName(IPAddress)
Gets the name of the database that the service is connected to.
Declaration
public Task<IEnumerable<string>> GetDatabaseName(IPAddress address)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | address | The IP address |
Returns
Type | Description |
---|---|
Task<IEnumerable<string>> |
GetLoginProviders()
Gets the login providers. For a service this means the currently configured auth token handlers, plus Windows negotiate, if configured. For local db connection, this means Windows auth and or username and password.
Declaration
public virtual Task<string[]> GetLoginProviders()
Returns
Type | Description |
---|---|
Task<string[]> | A string array of the supported keys |
Login(string, string)
Specifies to login into the system using the specified username/password login
Declaration
public virtual Task<UserInfo> Login(string userName, string password)
Parameters
Type | Name | Description |
---|---|---|
string | userName | The unique username to login to the system with |
string | password | The password |
Returns
Type | Description |
---|---|
Task<UserInfo> | If the user successfully logs in then the system returns a new random and unique session id for this user to use. Otherwise no id is returned and an error is thrown |
LoginExternalUser(string, IPAddress)
Specifies to login into the system using a token from an external provider.
Declaration
public Task<UserInfo> LoginExternalUser(string email = null, IPAddress ipAddress = null)
Parameters
Type | Name | Description |
---|---|---|
string | ||
IPAddress | ipAddress |
Returns
Type | Description |
---|---|
Task<UserInfo> | If the user successfully logs in then the system returns a UserInfo. Otherwise no id is returned and an error is thrown |
LoginViaDatabase(IPAddress, string, string)
Logs in via the database, with a username and password.
Declaration
public Task<UserWithRoleNames> LoginViaDatabase(IPAddress address, string userName, string password)
Parameters
Type | Name | Description |
---|---|---|
IPAddress | address | The IP address |
string | userName | The username |
string | password | The password |
Returns
Type | Description |
---|---|
Task<UserWithRoleNames> |
LoginWindowsUser(string, IPAddress)
Specifies to login into the system using the specified windows authentication login
Declaration
public virtual Task<UserInfo> LoginWindowsUser(string email = null, IPAddress ipAddress = null)
Parameters
Type | Name | Description |
---|---|---|
string | ||
IPAddress | ipAddress |
Returns
Type | Description |
---|---|
Task<UserInfo> | If the user successfully logs in then the system returns a UserInfo. Otherwise no id is returned and an error is thrown |
ValidateUser(IUser)
Checks that the user is a valid LemonEdge user.
Declaration
public Task ValidateUser(IUser user)
Parameters
Type | Name | Description |
---|---|---|
IUser | user | The IUser |
Returns
Type | Description |
---|---|
Task |