public static HttpClient AddAuthorization(this HttpClient httpClient, IAuthorizationData authorizationData) { if (httpClient == null) { throw new ArgumentNullException(nameof(httpClient)); } var token = new AuthorizationDataSerializer <IAuthorizationData>(StaticConfiguration.JwtConfiguration).Serialize(authorizationData); if (httpClient.DefaultRequestHeaders.Contains("Authorization")) { httpClient.DefaultRequestHeaders.Remove("Authorization"); } httpClient.DefaultRequestHeaders.Add("Authorization", $"bearer {token}"); return(httpClient); }
void ConstructAuthorizationData(IAppHost appHost) { AuthorizationData = new AuthorizationData(); }
public CommonAuthorizationProvider(ILogProvider logProvider, IAuthorizationData authorizationData) { _logger = logProvider.GetLogger(GetType().Name); _authorizationData = authorizationData; }
public CommonAuthorizationProvider(ILogProvider logProvider, IAuthorizationData authorizationData) { _logger = logProvider.GetLogger(GetType().Name); _authorizationData = authorizationData; }