Esempio n. 1
0
        /// <summary>
        /// Get authorization challenge
        /// </summary>
        /// <param name="uri">Uri of the challenge.</param>
        /// <param name="cancellationToken">Cancellation token for the async request.</param>
        /// <returns><see cref="AuthorizationChallengeResponse"/></returns>
        public async Task <AuthorizationChallengeResponse> GetAuthorizationChallengeAsync(Uri uri, CancellationToken cancellationToken = default)
        {
            var(result, response) = await client.GetAsync <AuthorizationChallengeResponse>(uri, cancellationToken);

            if (result is AuthorizationChallengeResponse acmeOrder)
            {
                foreach (var challenge in result.Challenges)
                {
                    challenge.AuthorizationToken = jws.GetKeyAuthorization(challenge.Token);
                }

                return(acmeOrder);
            }

            throw new InvalidServerResponse("Invalid response from server during GetAuthorizationChallenge.", response, Directory.NewAccount);
        }
Esempio n. 2
0
 public string GetKeyAuthorization(string token)
 {
     return(_jws.GetKeyAuthorization(token));
 }
Esempio n. 3
0
 public string GetKeyAuthorization(string token) => jws.GetKeyAuthorization(token);
        public void Ensure_key_authorization_is_correct()
        {
            var jws = new Jws(GetPrivateKey());

            Assert.Equal("token.pdmN_UI10XD6wy44jm-JkHmJOFxevse_2jio8cH1lRw", jws.GetKeyAuthorization("token"));
        }