Take the magic out of defaulting to the Server implementations of HTTP-01 and TLS-SNI-01

This commit is contained in:
xenolf 2016-02-14 16:57:06 +01:00
parent 7475e7f9c2
commit 21de29e902
3 changed files with 2 additions and 10 deletions

View file

@ -95,8 +95,8 @@ func NewClient(caDirURL string, user User, keyBits int) (*Client, error) {
// Add all available solvers with the right index as per ACME // Add all available solvers with the right index as per ACME
// spec to this map. Otherwise they won`t be found. // spec to this map. Otherwise they won`t be found.
solvers := make(map[Challenge]solver) solvers := make(map[Challenge]solver)
solvers[HTTP01] = &httpChallenge{jws: jws, validate: validate} solvers[HTTP01] = &httpChallenge{jws: jws, validate: validate, provider: &HTTPProviderServer{}}
solvers[TLSSNI01] = &tlsSNIChallenge{jws: jws, validate: validate} solvers[TLSSNI01] = &tlsSNIChallenge{jws: jws, validate: validate, provider: &TLSProviderServer{}}
return &Client{directory: dir, user: user, jws: jws, keyBits: keyBits, solvers: solvers}, nil return &Client{directory: dir, user: user, jws: jws, keyBits: keyBits, solvers: solvers}, nil
} }

View file

@ -26,10 +26,6 @@ func (s *httpChallenge) Solve(chlng challenge, domain string) error {
return err return err
} }
if s.provider == nil {
s.provider = &httpChallengeServer{}
}
err = s.provider.Present(domain, chlng.Token, keyAuth) err = s.provider.Present(domain, chlng.Token, keyAuth)
if err != nil { if err != nil {
return fmt.Errorf("[%s] error presenting token: %v", domain, err) return fmt.Errorf("[%s] error presenting token: %v", domain, err)

View file

@ -27,10 +27,6 @@ func (t *tlsSNIChallenge) Solve(chlng challenge, domain string) error {
return err return err
} }
if t.provider == nil {
t.provider = &tlsSNIChallengeServer{}
}
err = t.provider.Present(domain, chlng.Token, keyAuth) err = t.provider.Present(domain, chlng.Token, keyAuth)
if err != nil { if err != nil {
return fmt.Errorf("[%s] error presenting token: %v", domain, err) return fmt.Errorf("[%s] error presenting token: %v", domain, err)