public async Task <string> GetTokenAsync() { var requestData = new Dictionary <string, object> { { "pkcs7", _awsEc2AuthenticationInfo.Pkcs7 } }; if (!string.IsNullOrWhiteSpace(_awsEc2AuthenticationInfo.Nonce)) { requestData.Add("nonce", _awsEc2AuthenticationInfo.Nonce); } if (!string.IsNullOrWhiteSpace(_awsEc2AuthenticationInfo.RoleName)) { requestData.Add("role", _awsEc2AuthenticationInfo.RoleName); } var response = await _dataAccessManager.MakeRequestAsync <Secret <Dictionary <string, object> > >(LoginResourcePath, HttpMethod.Post, requestData).ConfigureAwait(_continueAsyncTasksOnCapturedContext); if (response != null && response.AuthorizationInfo != null && !string.IsNullOrWhiteSpace(response.AuthorizationInfo.ClientToken)) { return(response.AuthorizationInfo.ClientToken); } throw new Exception("The call to the authentication backend did not yield a client token. Please verify your credentials."); }
public async Task <string> GetTokenAsync() { var response = await _dataAccessManager.MakeRequestAsync <Secret <dynamic> >(LoginResourcePath, HttpMethod.Post) .ConfigureAwait(_continueAsyncTasksOnCapturedContext); if (response != null && response.AuthorizationInfo != null && !string.IsNullOrWhiteSpace(response.AuthorizationInfo.ClientToken)) { return(response.AuthorizationInfo.ClientToken); } throw new Exception("The call to the authentication backend did not yield a client token. Please verify your credentials."); }