コード例 #1
0
        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);
        }
コード例 #2
0
 public static OpenIdClient CreateTestClient(string openIdServerUrl, ILog log) =>
 OpenIdClient.Create(new RequestTimeouts(), new TestingHttpClientConfiguration(openIdServerUrl), log);