private Task <ApplicationInfo> GetApplicationInfo(Guid applicationUuid) => cache.GetOrCreateAsync(applicationUuid, async entry => { var retrier = new MAuthRequestRetrier(options); var response = await retrier.GetSuccessfulResponse( applicationUuid, CreateRequest, requestAttempts: (int)options.MAuthServiceRetryPolicy + 1 ).ConfigureAwait(false); var result = await response.Content.FromResponse().ConfigureAwait(false); entry.SetOptions( new MemoryCacheEntryOptions() .SetAbsoluteExpiration(response.Headers.CacheControl?.MaxAge ?? TimeSpan.FromHours(1)) ); return(result); });
public MAuthAuthenticator(MAuthOptionsBase options) { if (options.ApplicationUuid == default(Guid)) { throw new ArgumentException(nameof(options.ApplicationUuid)); } if (options.MAuthServiceUrl == null) { throw new ArgumentNullException(nameof(options.MAuthServiceUrl)); } if (string.IsNullOrWhiteSpace(options.PrivateKey)) { throw new ArgumentNullException(nameof(options.PrivateKey)); } this.options = options; retrier = new MAuthRequestRetrier(options); }