예제 #1
0
        public async Task <AcmeOrder> NewOrderAsync(IEnumerable <string> dnsNames, CancellationToken cancel = default)
        {
            Con.WriteDebug($"ACME: Putting the new certificate order for '{dnsNames._Combine(", ")}' ...");

            List <AcmeOrderIdEntity> o = new List <AcmeOrderIdEntity>();

            foreach (string dnsName in dnsNames)
            {
                o.Add(new AcmeOrderIdEntity {
                    type = AcmeOrderIdType.dns, value = dnsName,
                });
            }

            AcmeOrderPayload request = new AcmeOrderPayload
            {
                identifiers = o.ToArray(),
            };

            WebUserRet <AcmeOrderPayload> ret = await RequestAsync <AcmeOrderPayload>(WebMethods.POST, (await Options.GetEntryPointsAsync(cancel)).newOrder !, request, cancel);

            string accountUrl = ret.System.Headers.GetValues("Location").Single();

            AcmeOrder order = new AcmeOrder(this, accountUrl, ret.User);

            await order.UpdateInfoAsync(cancel);

            Con.WriteDebug($"ACME: The order is put.");

            return(order);
        }
예제 #2
0
        public async Task UpdateInfoAsync(CancellationToken cancel = default)
        {
            WebUserRet <AcmeOrderPayload> ret = await Account.RequestAsync <AcmeOrderPayload>(WebMethods.POST, this.Url, null, cancel);

            this.Info = ret.User;

            List <AcmeAuthz> authzList = new List <AcmeAuthz>();

            foreach (string authUrl in Info !.authorizations !)
            {
                AcmeAuthz a = new AcmeAuthz(this, authUrl);

                await a.UpdateInfoAsync(cancel);

                authzList.Add(a);
            }

            this.AuthzList = authzList;
        }
예제 #3
0
        public async Task <AcmeAccount> LoginAccountAsync(PrivKey key, string[] contacts, CancellationToken cancel = default)
        {
            AcmeEntryPoints url = await Options.GetEntryPointsAsync(cancel);

            AcmeCreateAccountPayload req = new AcmeCreateAccountPayload()
            {
                contact = contacts,
                termsOfServiceAgreed = true,
            };

            WebUserRet <object> ret = await this.RequestAsync <object>(WebMethods.POST, key, null, url.newAccount !, req, cancel);

            string accountUrl = ret.System.Headers.GetValues("Location").Single();

            if (accountUrl._IsEmpty())
            {
                throw new ApplicationException("Account Location is empty.");
            }

            return(new AcmeAccount(EnsureInternal.Yes, this, key, accountUrl));
        }
예제 #4
0
        public async Task UpdateInfoAsync(CancellationToken cancel = default)
        {
            WebUserRet <AcmeAuthzPayload> ret = await Account.RequestAsync <AcmeAuthzPayload>(WebMethods.POST, this.Url, null, cancel);

            this.Info = ret.User;
        }