Authentication
Provides centralized Identity Service through the implementation of Open ID Connect. Based on Identity Server, this service provides single sing-on / sign-out across federated gateways such as Azure Active Directory, Google, etc.
- class ClientSDK.Authentication
Methods
GetTokenAsync
The token endpoint can be used to programmatically request tokens. (see Identity Server Documentation).
- ONE.Utilities.PlatformEnvironment.GetTokenAsync(string userName, string password)
- Parameters
userName (string) – The user name of the user to authenticate.
password (string) – The password of the user to authenticate.
- Returns
- Return type
Task<string>
GetUserInfoAync
The UserInfo endpoint can be used to retrieve identity information about a user (see Identity Server Documentation).
- ONE.Utilities.PlatformEnvironment.GetUserInfoAync()
- Returns
the mapped claims (at least the openid scope is required).
- Return type
Task<string>
LoginResourceOwnerAsync
Logs the user in and acquires an access token. (see Identity Server Documentation).
- ONE.Utilities.PlatformEnvironment.LoginResourceOwnerAsync(string userName, string password)
- Parameters
userName (string) – The user name of the user to authenticate.
password (string) – The password of the user to authenticate.
- Returns
success
- Return type
Task<bool>
if (await clientSDK.Authentication.LoginResourceOwnerAsync(Username, Password))
// success
else
// fail
Logout
Clears the token and the Client.
- ONE.Utilities.PlatformEnvironment.Logout()
- Return type
void
Properties
IsAuthenticated
Password
- ClientSDK.Authentication.Password
- Returns
The password used in authentication.
- Return type
string
User
Sets or Returns the user.
- ClientSDK.Authentication.User
- Returns
The user used in authentication.
- Return type
User
// Setting the user property
if (clientSDK.Authentication.User == null)
{
var result = await clientSDK.Authentication.GetUserInfoAync();
clientSDK.Authentication.User = await clientSDK.UserHelper.GetUserFromUserInfoAsync(result);
}
UserName
- ClientSDK.Authentication.UserName
- Returns
The username used in authentication.
- Return type
string
Token
- ClientSDK.Authentication.Token
- Returns
The access token returned during authentication.
- Return type
Token