aboutsummaryrefslogtreecommitdiff
path: root/provider.go
diff options
context:
space:
mode:
Diffstat (limited to 'provider.go')
-rw-r--r--provider.go49
1 files changed, 27 insertions, 22 deletions
diff --git a/provider.go b/provider.go
index d97bbad..ecb1bfd 100644
--- a/provider.go
+++ b/provider.go
@@ -194,31 +194,36 @@ func (p *Provider) solve(s Signer, ch Challenge) error {
return ch.Solved()
}
-//func (p *Provider) Authz(s Signer, domain string, sol map[ChallengeType]Solver) error {
-func (p *Provider) Authz(s Signer, d *Desire) error {
- for _, domain := range d.altnames {
- // first step: pocke
- r := &Authorization{
- Resource: ResNewAuthz,
- Identifier: Identifier{
- Type: IdentDNS,
- Value: domain,
- },
- }
- resp, err := p.post(p.NewAuthz, s, r)
- if err != nil {
- return err
- }
- err = parseJson(resp, r)
- if err != nil {
+func (p *Provider) authz(s Signer, domain string, sol map[ChallengeType]Solver) error {
+ // first step: pocke
+ r := &Authorization{
+ Resource: ResNewAuthz,
+ Identifier: Identifier{
+ Type: IdentDNS,
+ Value: domain,
+ },
+ }
+ resp, err := p.post(p.NewAuthz, s, r)
+ if err != nil {
+ return err
+ }
+ err = parseJson(resp, r)
+ if err != nil {
+ return err
+ }
+ // second step: choose and start solver
+ for _, ch := range r.Supported(sol) {
+ if err = p.solve(s, ch); err != nil {
return err
}
+ }
+ return nil
+}
- // second step: choose and start solver
- for _, ch := range r.Supported(d.solver) {
- if err = p.solve(s, ch); err != nil {
- return err
- }
+func (p *Provider) Authz(s Signer, d *Desire) error {
+ for _, domain := range d.altnames {
+ if err := p.authz(s, domain, d.solver); err != nil {
+ return err
}
}
return nil