Example #1
0
        public async Task Authentication(CancellationToken cancellationToken)
        {
            var accountKey = await _certificateStore.GetAccountAsync(cancellationToken);

            if (accountKey != null)
            {
                await _letsEncryptService.AuthenticateWithExistingAccount(_options.AcmeServer, accountKey, cancellationToken);
            }
            else
            {
                accountKey = await _letsEncryptService.AuthenticateWithNewAccount(_options.Email, _options.AcmeServer, true, cancellationToken);

                await _certificateStore.SaveAccountAsync(accountKey, cancellationToken);
            }
        }