diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-02-06 16:26:05 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2024-02-19 14:15:07 +0100 |
| commit | 819d7f9914cbb34abb76b932c05b030a34986ec2 (patch) | |
| tree | 7da743c1a0363e800a041e0310ca8cf441bc3f90 /internal/server/endpoints | |
| parent | 4d26c8489b09acc98128715e9a2ed67558eb8105 (diff) | |
Server: Delete old files to prepare for new internal API
Diffstat (limited to 'internal/server/endpoints')
| -rw-r--r-- | internal/server/endpoints/endpoints.go | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/internal/server/endpoints/endpoints.go b/internal/server/endpoints/endpoints.go deleted file mode 100644 index 3e675e4..0000000 --- a/internal/server/endpoints/endpoints.go +++ /dev/null @@ -1,56 +0,0 @@ -package endpoints - -import ( - "net/url" - - "github.com/go-errors/errors" -) - -type List struct { - API string `json:"api_endpoint"` - Authorization string `json:"authorization_endpoint"` - Token string `json:"token_endpoint"` -} - -type Versions struct { - V2 List `json:"http://eduvpn.org/api#2"` - V3 List `json:"http://eduvpn.org/api#3"` -} - -// Endpoints defines the json format for /.well-known/vpn-user-portal". -type Endpoints struct { - API Versions `json:"api"` - V string `json:"v"` -} - -func (e Endpoints) Validate() error { - v3 := e.API.V3 - pAPI, err := url.Parse(v3.API) - if err != nil { - return errors.WrapPrefix(err, "failed to parse API endpoint", 0) - } - pAuth, err := url.Parse(v3.Authorization) - if err != nil { - return errors.WrapPrefix(err, "failed to parse API authorization endpoint", 0) - } - pToken, err := url.Parse(v3.Token) - if err != nil { - return errors.WrapPrefix(err, "failed to parse API token endpoint", 0) - } - if pAPI.Scheme != "https" { - return errors.Errorf("API Scheme: '%v', is not equal to HTTPS", pAPI.Scheme) - } - if pAPI.Scheme != pAuth.Scheme { - return errors.Errorf("API scheme: '%v', is not equal to authorization scheme: '%v'", pAPI.Scheme, pAuth.Scheme) - } - if pAPI.Scheme != pToken.Scheme { - return errors.Errorf("API scheme: '%v', is not equal to token scheme: '%v'", pAPI.Scheme, pToken.Scheme) - } - if pAPI.Host != pAuth.Host { - return errors.Errorf("API host: '%v', is not equal to authorization host: '%v'", pAPI.Host, pAuth.Host) - } - if pAPI.Host != pToken.Host { - return errors.Errorf("API host: '%v', is not equal to token host: '%v'", pAPI.Host, pToken.Host) - } - return nil -} |
