public async Task <string> Handle(string language, JObject jObj, CancellationToken cancellationToken) { var currentDateTime = DateTime.UtcNow; DateTime?expirationDateTime = null; if (_options.ClientSecretExpirationInSeconds != null) { expirationDateTime = currentDateTime.AddSeconds(_options.ClientSecretExpirationInSeconds.Value); } var parameter = jObj.ToCreateOpenIdClientParameter(); var openidClient = OpenIdClient.Create(parameter.ApplicationKind.Value, parameter.ClientName, language, expirationDateTime, _options.DefaultTokenExpirationTimeInSeconds, _options.DefaultRefreshTokenExpirationTimeInSeconds); await _oauthClientRepository.Add(openidClient, cancellationToken); await _oauthClientRepository.SaveChanges(cancellationToken); return(openidClient.ClientId); }
public static OpenIdClient CreateTestClient(string openIdServerUrl, ILog log) => OpenIdClient.Create(new RequestTimeouts(), new TestingHttpClientConfiguration(openIdServerUrl), log);