RsaBearerTokenAuthenticationProvider
This class obtains current claims principal token that can be used by Relativity Service Account hosted processes.
using Relativity.DataExchange.Service;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Security.Claims;
namespace Relativity.DataExchange
{
internal class RsaBearerTokenAuthenticationProvider : IRelativityTokenProvider
{
[SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes", Justification = "Handled by the ImportApi class")]
public string GetToken()
{
string text = ClaimsPrincipal.Current.Claims.AccessToken();
if (string.IsNullOrEmpty(text))
throw new Exception("The current claims principal does not have a bearer token.");
return text;
}
}
}