Exemple #1
0
        public Account(Model.Account model, string ordersUrl)
        {
            if (model is null)
            {
                throw new System.ArgumentNullException(nameof(model));
            }

            Status = EnumMappings.GetEnumString(model.Status);

            Contact = model.Contacts;
            TermsOfServiceAgreed = model.TOSAccepted.HasValue;

            ExternalAccountBinding = null;
            Orders = ordersUrl;
        }
Exemple #2
0
        public Order(Model.Order model,
                     IEnumerable <string> authorizationUrls, string finalizeUrl, string certificateUrl)
        {
            if (model is null)
            {
                throw new System.ArgumentNullException(nameof(model));
            }

            if (authorizationUrls is null)
            {
                throw new System.ArgumentNullException(nameof(authorizationUrls));
            }

            if (string.IsNullOrEmpty(finalizeUrl))
            {
                throw new System.ArgumentNullException(nameof(finalizeUrl));
            }

            if (string.IsNullOrEmpty(certificateUrl))
            {
                throw new System.ArgumentNullException(nameof(certificateUrl));
            }

            Status = EnumMappings.GetEnumString(model.Status);

            Expires   = model.Expires?.ToString("o", CultureInfo.InvariantCulture);
            NotBefore = model.NotBefore?.ToString("o", CultureInfo.InvariantCulture);
            NotAfter  = model.NotAfter?.ToString("o", CultureInfo.InvariantCulture);

            Identifiers = model.Identifiers.Select(x => new Identifier(x)).ToList();

            Authorizations = new List <string>(authorizationUrls);

            if (model.Status == Model.OrderStatus.Ready)
            {
                Finalize = finalizeUrl;
            }

            if (model.Status == Model.OrderStatus.Valid)
            {
                Certificate = certificateUrl;
            }

            if (model.Error != null)
            {
                Error = new AcmeError(model.Error);
            }
        }
Exemple #3
0
        public Authorization(Model.Authorization model, IEnumerable <Challenge> challenges)
        {
            if (model is null)
            {
                throw new System.ArgumentNullException(nameof(model));
            }

            if (challenges is null)
            {
                throw new System.ArgumentNullException(nameof(challenges));
            }

            Status = EnumMappings.GetEnumString(model.Status);

            Expires  = model.Expires.ToString("o", CultureInfo.InvariantCulture);
            Wildcard = model.IsWildcard;

            Identifier = new Identifier(model.Identifier);
            Challenges = new List <Challenge>(challenges);
        }
Exemple #4
0
        public Challenge(Model.Challenge model, string challengeUrl)
        {
            if (model is null)
            {
                throw new System.ArgumentNullException(nameof(model));
            }

            if (string.IsNullOrEmpty(challengeUrl))
            {
                throw new System.ArgumentNullException(nameof(challengeUrl));
            }

            Type  = model.Type;
            Token = model.Token;

            Status = EnumMappings.GetEnumString(model.Status);
            Url    = challengeUrl;

            Validated = model.Validated?.ToString("o", CultureInfo.InvariantCulture);
            Error     = model.Error != null ? new AcmeError(model.Error) : null;
        }