/// <summary> /// Подписывает запрос (или вычисляет client_secret запроса). /// </summary> internal static string SignData(IEsiaSigner esiaSigner, EsiaOptions options, string scope, string timestamp, string clientId, string state) { byte[] signData = Encoding.UTF8.GetBytes(scope + timestamp + clientId + state); return((esiaSigner != null) ? esiaSigner.Sign(signData) : throw new ArgumentNullException("Need to define IEsiaSigner")); }
/// <param name="esiaOptions">Свойства подключения к ЕСИА.</param> /// <param name="esiaEnvironment">Среда ЕСИА.</param> /// <param name="serviceProvider">Поставщик служб (сейчас используется для получения IEsiaSigner).</param> public EsiaEvents( EsiaOptions esiaOptions, IEsiaEnvironment esiaEnvironment, IServiceProvider serviceProvider) // TODO add IEsiaSigner directly { this.EsiaOptions = esiaOptions; this.EsiaEnvironment = esiaEnvironment; this.EsiaSigner = serviceProvider.GetService <IEsiaSigner>(); // TODO add IEsiaSigner directly }
public EsiaRestService( IHttpContextAccessor httpContextAccessor, IEsiaEnvironment esiaEnvironment, IServiceProvider serviceProvider, // TODO add IEsiaSigner directly IOptionsMonitor <OpenIdConnectOptions> optionsMonitor, EsiaOptions esiaOptions) { this.context = httpContextAccessor.HttpContext; this.esiaEnvironment = esiaEnvironment; this.esiaSigner = serviceProvider.GetService <IEsiaSigner>(); // TODO add IEsiaSigner directly this.optionsMonitor = optionsMonitor; this.esiaOptions = esiaOptions; }