diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-07 17:44:07 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-07 17:44:07 +0200 |
| commit | e1bd5ec1c939f5431925ab3bb83352d0a275ebd9 (patch) | |
| tree | 5272a8592b52757ca288e20a759c244ecb962a3b /internal/server/secureinternet.go | |
| parent | 9be031fda160f7bb8e3294ab6620a1510828bd97 (diff) | |
Refactor: Remove the usage of the FSM in other internal packages
This removes the FSM from being imported and thus used in other
internal packages such as `oauth` or `server`. The benefit is that it
becomes much easier now to reason about the FSM as it's only used in
the public package. Additionally, we do not have to re-initialize the
server and the oauth structure with the FSM pointer.
Diffstat (limited to 'internal/server/secureinternet.go')
| -rw-r--r-- | internal/server/secureinternet.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/internal/server/secureinternet.go b/internal/server/secureinternet.go index 40c429b..d5689a8 100644 --- a/internal/server/secureinternet.go +++ b/internal/server/secureinternet.go @@ -3,7 +3,6 @@ package server import ( "fmt" - "github.com/jwijenbergh/eduvpn-common/internal/fsm" "github.com/jwijenbergh/eduvpn-common/internal/oauth" "github.com/jwijenbergh/eduvpn-common/internal/types" "github.com/jwijenbergh/eduvpn-common/internal/util" @@ -70,7 +69,6 @@ func (servers *Servers) HasSecureLocation() bool { func (secure *SecureInternetHomeServer) addLocation( locationServer *types.DiscoveryServer, - fsm *fsm.FSM, ) (*ServerBase, error) { errorMessage := "failed adding a location" // Initialize the base map if it is non-nil @@ -95,9 +93,6 @@ func (secure *SecureInternetHomeServer) addLocation( base.Endpoints = *endpoints } - // Pass the fsm - base.FSM = fsm - // Ensure it is in the map secure.BaseMap[locationServer.CountryCode] = base return base, nil @@ -107,7 +102,6 @@ func (secure *SecureInternetHomeServer) addLocation( func (secure *SecureInternetHomeServer) init( homeOrg *types.DiscoveryOrganization, homeLocation *types.DiscoveryServer, - fsm *fsm.FSM, ) error { errorMessage := "failed initializing secure internet home server" @@ -123,14 +117,14 @@ func (secure *SecureInternetHomeServer) init( // Make sure to set the authorization URL template secure.AuthorizationTemplate = homeLocation.AuthenticationURLTemplate - base, baseErr := secure.addLocation(homeLocation, fsm) + base, baseErr := secure.addLocation(homeLocation) if baseErr != nil { return &types.WrappedErrorMessage{Message: errorMessage, Err: baseErr} } // Make sure oauth contains our endpoints - secure.OAuth.Init(base.Endpoints.API.V3.Authorization, base.Endpoints.API.V3.Token, fsm) + secure.OAuth.Init(base.Endpoints.API.V3.Authorization, base.Endpoints.API.V3.Token) return nil } |
