IJsonPostWsBackupGetUserAuthenticationToken Method
|
This method returns the user authentication token requested by the rest requests.
Namespace:
Aruba.Cloud.WsBackup
Assembly:
Aruba.Cloud.WsBackup (in Aruba.Cloud.WsBackup.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax [OperationContractAttribute]
[WebInvokeAttribute(Method = "POST", ResponseFormat = WebMessageFormat.Json)]
Stream GetUserAuthenticationToken(
GetUserAuthenticationTokenRequest request
)
<OperationContractAttribute>
<WebInvokeAttribute(Method := "POST", ResponseFormat := WebMessageFormat.Json)>
Function GetUserAuthenticationToken (
request As GetUserAuthenticationTokenRequest
) As Stream
[OperationContractAttribute]
[WebInvokeAttribute(Method = L"POST", ResponseFormat = WebMessageFormat::Json)]
Stream^ GetUserAuthenticationToken(
GetUserAuthenticationTokenRequest^ request
)
[<OperationContractAttribute>]
[<WebInvokeAttribute(Method = "POST", ResponseFormat = WebMessageFormat.Json)>]
abstract GetUserAuthenticationToken :
request : GetUserAuthenticationTokenRequest -> Stream
function GetUserAuthenticationToken(
request : GetUserAuthenticationTokenRequest
) : Stream
Parameters
- request
- Type: GetUserAuthenticationTokenRequest
Return Value
Type:
StreamUser authentication token
Examples
Each user is associated with a unique token, valid for 30 minutes, that certifies that the service has been authenticated. If you have a valid token you can make calls to WSEndUser methods. After each call to any Aruba WSEndUser method the service actually checks for an invalid token for the account specified. If this does not exist, or if the token has expired, you will need to authenticate it again to get it.
In reality, the token is a substitute for password that has a temporary validity.
The APIs are authenticated with the pair username + password or username+valid token.
Getting the token for to recall the APIs is not mandatory.
The GetUserAuthenticationToken (WsCommon) and GetUserAuthenticationToken (WsEndUser) methods cannot be called with the username + token for security reasons.
The example generates an authentication token and associates it with the account indicated.
private static void LoginToAccount(WsEndUserClient client)
{
client.ClientCredentials.UserName.UserName = "ARU-0000";
client.ClientCredentials.UserName.Password = "0123456789";
try
{
WsResultOfUserToken result = client.GetUserAuthenticationToken();
if (result.Success)
{
}
else
{
throw new Exception(result.ResultMessage);
}
}
catch (MessageSecurityException msEx)
{
throw new Exception(msEx.Message);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
See Also