diff options
Diffstat (limited to 'pkg/vpn/bonafide/auth_anon.go')
-rw-r--r-- | pkg/vpn/bonafide/auth_anon.go | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/pkg/vpn/bonafide/auth_anon.go b/pkg/vpn/bonafide/auth_anon.go index 61916e6..3a666a8 100644 --- a/pkg/vpn/bonafide/auth_anon.go +++ b/pkg/vpn/bonafide/auth_anon.go @@ -16,22 +16,29 @@ package bonafide import ( + "errors" "fmt" "io/ioutil" ) -type AnonymousAuthentication struct { - bonafide *Bonafide +type anonymousAuthentication struct { + client httpClient + authURI string + certURI string } -func (a *AnonymousAuthentication) GetPemCertificate() ([]byte, error) { - resp, err := a.bonafide.client.Post(certAPI, "", nil) +func (a *anonymousAuthentication) needsCredentials() bool { + return true +} + +func (a *anonymousAuthentication) getPemCertificate(cred *credentials) ([]byte, error) { + resp, err := a.client.Post(certAPI, "", nil) if err != nil { return nil, err } defer resp.Body.Close() if resp.StatusCode == 404 { - resp, err = a.bonafide.client.Post(certAPI3, "", nil) + resp, err = a.client.Post(certAPI3, "", nil) if err != nil { return nil, err } @@ -43,3 +50,7 @@ func (a *AnonymousAuthentication) GetPemCertificate() ([]byte, error) { return ioutil.ReadAll(resp.Body) } + +func (a *anonymousAuthentication) getToken(cred *credentials) ([]byte, error) { + return []byte(""), errors.New("anon authentication should not call getToken") +} |