Interface IAuthenticator
A general interface for authenticating logging into the LemonEdge platform
Namespace: LemonEdge.Core
Assembly: API.dll
Syntax
public interface IAuthenticator
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
Task<bool> ForceUpgrade(string databaseAlias)
Parameters
Type | Name | Description |
---|---|---|
System.String | databaseAlias | The alias for the database to check |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | Indicates if the upgrade worked |
GetDatabaseAliases()
Returns an enumeration of valid databases the service can allow this client to connect to.
These are the visible database aliases that can be used to connect. It is possible there are others but they must be specifically known by the client, the service will not confirm if they can be used as a connection or not.
Declaration
Task<IEnumerable<string>> GetDatabaseAliases()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<System.String>> | An enumeration of valid databases the service can allow this client to connect to. |
GetMyUserInfo(Guid, String)
Returns the UserInfo object for the current logged in user, identified from the session id for the user
Declaration
Task<UserInfo> GetMyUserInfo(Guid sessionID, string databaseAlias)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | sessionID | The session id for the current logged in user. Provided when a user login is succesfull. |
System.String | databaseAlias | The database alias to login to. For a web service this will be an alias to the database the service can connect to. The possible aliases can be queried from GetDatabaseAliases() The Service connection is held in ConnectionServiceURISetting, which must be set before calling this For a direct connection to the database, this is the database name. The SQL Server connection is held in Utils.Database.Settings.ConnectionString, which must be set before calling this |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<UserInfo> | The UserInfo object for the current logged in user, identified from the session id for the user |
GetUserID(String, String)
Returns the unique ID of the specified username. This is used to generate a hashed version of the password for any login attempt via EncryptPasswordToBase64(Guid, String)
Declaration
Task<Guid> GetUserID(string databaseAlias, string userName)
Parameters
Type | Name | Description |
---|---|---|
System.String | databaseAlias | The database alias to login to. For a web service this will be an alias to the database the service can connect to. The possible aliases can be queried from GetDatabaseAliases() The Service connection is held in ConnectionServiceURISetting, which must be set before calling this For a direct connection to the database, this is the database name. The SQL Server connection is held in Utils.Database.Settings.ConnectionString, which must be set before calling this |
System.String | userName | The unique username to login to the system with |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Guid> | The unique ID of the specified user |
IsUpgrading(String)
Indicates the database you are currently trying to connect to is upgrading.
If you have a direct connection to the database, the system can attempt to force an upgrade too ForceUpgrade(String)
If this is through a web service it always returns false - you do not have access to the state of the databaseDeclaration
Task<DBStatus> IsUpgrading(string databaseAlias)
Parameters
Type | Name | Description |
---|---|---|
System.String | databaseAlias | The alias for the database to check |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DBStatus> | Indicates the database you are currently trying to connect to is upgrading. |
Login(String, String, String)
Specifies to login into the system using the specified datbaseAlias and a username/password login
Declaration
Task<Guid> Login(string databaseAlias, string userName, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | databaseAlias | The database alias to login to. For a web service this will be an alias to the database the service can connect to. The possible aliases can be queried from GetDatabaseAliases() The Service connection is held in ConnectionServiceURISetting, which must be set before calling this For a direct connection to the database, this is the database name. The SQL Server connection is held in Utils.Database.Settings.ConnectionString, which must be set before calling this |
System.String | userName | The unique username to login to the system with |
System.String | password | The hashed password for the user obtained from EncryptPasswordToBase64(Guid, String) |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Guid> | If the user sucessfully 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 |
LoginWindowsUser(String)
Specifies to login into the system using the specified datbaseAlias and a windows authentication login
Declaration
Task<Guid> LoginWindowsUser(string databaseAlias)
Parameters
Type | Name | Description |
---|---|---|
System.String | databaseAlias | The database alias to login to. For a web service this will be an alias to the database the service can connect to. The possible aliases can be queried from GetDatabaseAliases() The Service connection is held in ConnectionServiceURISetting, which must be set before calling this For a direct connection to the database, this is the database name. The SQL Server connection is held in Utils.Database.Settings.ConnectionString, which must be set before calling this |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Guid> | If the user sucessfully 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 |