Method | Description | |
---|---|---|
CreateAuthorization ( ) : string |
Create basic authentication header data for REST requests.
|
|
Credentials ( |
Constructor that takes IAM token options.
|
|
Credentials ( string url = null ) : FullSerializer |
Constructor that takes the URL. Used for token authentication.
|
|
Credentials ( string apiKey, string url = null ) : FullSerializer |
Constructor that takes an authentication token created by the user or an ApiKey. If no URL is set then default to the non-IAM Visual Recognition endpoint.
|
|
Credentials ( string username, string password, string url = null ) : FullSerializer |
Constructor that takes the user name and password.
|
|
GetToken ( ) : void |
This function sends an access token back through a callback. The source of the token is determined by the following logic: 1. If user provides their own managed access token, assume it is valid and send it 2. If this class is managing tokens and does not yet have one, make a request for one 3. If this class is managing tokens and the token has expired, refresh it 4. If this class is managing tokens and has a valid token stored, send it
|
|
HasApiKey ( ) : bool |
Do we have an ApiKey?
|
|
HasCredentials ( ) : bool |
Do we have credentials?
|
|
HasIamApikey ( ) : bool |
Do we have an IAM apikey?
|
|
HasIamAuthorizationToken ( ) : bool |
Do we have an IAM authentication token?
|
|
HasIamTokenData ( ) : bool |
Do we have IamTokenData?
|
|
HasWatsonAuthenticationToken ( ) : bool |
Do we have an authentication token?
|
|
IsRefreshTokenExpired ( ) : bool |
Used as a fail-safe to prevent the condition of a refresh token expiring, which could happen after around 30 days.This function will return true if it has been at least 7 days and 1 hour since the last token was retrieved.
|
|
IsTokenExpired ( ) : bool |
Check if currently stored token is expired. Using a buffer to prevent the edge case of the token expiring before the request could be made. The buffer will be a fraction of the total TTL. Using 80%.
|
|
RefreshIamToken ( SuccessCallback successCallback, FailCallback failCallback, Dictionary customData = null ) : bool |
Refresh an IAM token using a refresh token.
|
|
RequestIamToken ( SuccessCallback successCallback, FailCallback failCallback, Dictionary customData = null ) : bool |
Request an IAM token using an API key.
|
|
SaveTokenInfo ( |
Save the response from the IAM service request to the object's state.
|
|
SetAccessToken ( string iamAccessToken ) : void |
Set a self-managed IAM access token. The access token should be valid and not yet expired. By using this method, you accept responsibility for managing the access token yourself.You must set a new access token before this one expires. Failing to do so will result in authentication errors after this token expires.
|
Method | Description | |
---|---|---|
OnGetToken ( |
||
OnGetTokenFail ( RESTConnector.Error error, Dictionary customData ) : void | ||
OnRefreshIamTokenResponse ( RESTConnector.Request req, RESTConnector.Response resp ) : void | ||
OnRequestIamTokenResponse ( RESTConnector.Request req, RESTConnector.Response resp ) : void | ||
SetCredentials ( |
||
SetCredentials ( string username, string password, string url = null ) : void |
public Credentials ( |
||
iamTokenOptions | ||
serviceUrl | string | |
return | FullSerializer |
public Credentials ( string url = null ) : FullSerializer | ||
url | string | |
return | FullSerializer |
public Credentials ( string apiKey, string url = null ) : FullSerializer | ||
apiKey | string | |
url | string | The service endpoint. |
return | FullSerializer |
public Credentials ( string username, string password, string url = null ) : FullSerializer | ||
username | string | The string containing the user name. |
password | string | A string containing the password. |
url | string | The service endpoint. |
return | FullSerializer |
public HasWatsonAuthenticationToken ( ) : bool | ||
return | bool |
public RefreshIamToken ( SuccessCallback successCallback, FailCallback failCallback, Dictionary customData = null ) : bool | ||
successCallback | SuccessCallback | The success callback. |
failCallback | FailCallback | The fail callback. |
customData | Dictionary | Dictionary of custom data. |
return | bool |
public RequestIamToken ( SuccessCallback successCallback, FailCallback failCallback, Dictionary customData = null ) : bool | ||
successCallback | SuccessCallback | The request callback. |
failCallback | FailCallback | The fail callback. |
customData | Dictionary | Dictionary of custom data. |
return | bool |
public SaveTokenInfo ( |
||
iamTokenData | Response object from IAM service request | |
return | void |
public SetAccessToken ( string iamAccessToken ) : void | ||
iamAccessToken | string | A valid, non-expired IAM access token. |
return | void |