private void SetCredentials(TokenOptions iamTokenOptions, string serviceUrl = null) { if (iamTokenOptions.IamApiKey.StartsWith(ICP_PREFIX)) { SetCredentials(APIKEY_AS_USERNAME, iamTokenOptions.IamApiKey, serviceUrl); } else { if (!string.IsNullOrEmpty(serviceUrl)) { Url = serviceUrl; } _iamUrl = !string.IsNullOrEmpty(iamTokenOptions.IamUrl) ? iamTokenOptions.IamUrl : "https://iam.bluemix.net/identity/token"; _iamTokenData = new IamTokenData(); if (!string.IsNullOrEmpty(iamTokenOptions.IamApiKey)) { _iamApiKey = iamTokenOptions.IamApiKey; } if (!string.IsNullOrEmpty(iamTokenOptions.IamAccessToken)) { this._userAcessToken = iamTokenOptions.IamAccessToken; } GetToken(); } }
/// <summary> /// Save the response from the IAM service request to the object's state. /// </summary> /// <param name="iamTokenData">Response object from IAM service request</param> public void SaveTokenInfo(IamTokenData iamTokenData) { TokenData = iamTokenData; }