summaryrefslogtreecommitdiff
path: root/pkg/vpn/bonafide/auth_anon.go
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2020-02-11 13:43:01 +0100
committerkali kaneko (leap communications) <kali@leap.se>2020-08-20 20:27:42 +0200
commitc56df01274a91ff730018dcd6272423a3e1593f0 (patch)
tree0650d3b8cb27caff177b7306cc7f27d987824664 /pkg/vpn/bonafide/auth_anon.go
parent8bb41cff9f47895e00d7773dfd9372a7e17fae59 (diff)
[feat] expose auth API in pkg/vpn
Be able to check if it needs auth and then be able to login. Use the logged in token for fetching the cert.
Diffstat (limited to 'pkg/vpn/bonafide/auth_anon.go')
-rw-r--r--pkg/vpn/bonafide/auth_anon.go28
1 files changed, 2 insertions, 26 deletions
diff --git a/pkg/vpn/bonafide/auth_anon.go b/pkg/vpn/bonafide/auth_anon.go
index 3a666a8..8a55e3a 100644
--- a/pkg/vpn/bonafide/auth_anon.go
+++ b/pkg/vpn/bonafide/auth_anon.go
@@ -17,40 +17,16 @@ package bonafide
import (
"errors"
- "fmt"
- "io/ioutil"
)
type anonymousAuthentication struct {
- client httpClient
- authURI string
- certURI string
+ client httpClient
}
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.client.Post(certAPI3, "", nil)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
- }
- if resp.StatusCode != 200 {
- return nil, fmt.Errorf("Get vpn cert has failed with status: %s", resp.Status)
- }
-
- return ioutil.ReadAll(resp.Body)
-}
-
-func (a *anonymousAuthentication) getToken(cred *credentials) ([]byte, error) {
+func (a *anonymousAuthentication) getToken(user, password string) ([]byte, error) {
return []byte(""), errors.New("anon authentication should not call getToken")
}