diff --git a/src/CommonLibrariesForNET/AuthenticationClient.cs b/src/CommonLibrariesForNET/AuthenticationClient.cs index 02df6e80..a044fd43 100644 --- a/src/CommonLibrariesForNET/AuthenticationClient.cs +++ b/src/CommonLibrariesForNET/AuthenticationClient.cs @@ -16,6 +16,8 @@ public class AuthenticationClient : IAuthenticationClient, IDisposable public string RefreshToken { get; set; } public string Id { get; set; } public string ApiVersion { get; set; } + public string Signature { get; set; } + public string IssuedAt { get; set; } private const string UserAgent = "forcedotcom-toolkit-dotnet"; private const string TokenRequestEndpointUrl = "https://login.salesforce.com/services/oauth2/token"; @@ -78,6 +80,8 @@ public async Task UsernamePasswordAsync(string clientId, string clientSecret, st AccessToken = authToken.AccessToken; InstanceUrl = authToken.InstanceUrl; Id = authToken.Id; + Signature = authToken.Signature; + IssuedAt = authToken.IssuedAt; } else { @@ -130,6 +134,8 @@ public async Task WebServerAsync(string clientId, string clientSecret, string re InstanceUrl = authToken.InstanceUrl; Id = authToken.Id; RefreshToken = authToken.RefreshToken; + Signature = authToken.Signature; + IssuedAt = authToken.IssuedAt; } else { @@ -178,6 +184,8 @@ public async Task TokenRefreshAsync(string clientId, string refreshToken, string RefreshToken = refreshToken; InstanceUrl = authToken.InstanceUrl; Id = authToken.Id; + Signature = authToken.Signature; + IssuedAt = authToken.IssuedAt; } else { @@ -186,6 +194,25 @@ public async Task TokenRefreshAsync(string clientId, string refreshToken, string } } + public async Task TokenRevokeAsync() + { + HttpRequestMessage request = new HttpRequestMessage(); + request.Method = HttpMethod.Post; + request.RequestUri = new Uri("https://login.salesforce.com/services/oauth2/revoke"); + request.Content = new FormUrlEncodedContent(new[] + { + new KeyValuePair("token", AccessToken) + }); + + try + { + HttpResponseMessage responseMessage = await _httpClient.SendAsync(request); + } + catch (Exception ex) + { + throw new ForceAuthException(Error.UnknownException, ex.Message); + } + } public async Task GetLatestVersionAsync() {