summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-01-10 12:15:01 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2023-01-10 12:28:59 +0100
commitb51831b6361dde4e63fa38bfd968ff729ab72dc5 (patch)
tree0d99fac1de8454d42aa5a13448c6f9e96dc5a4ea /internal
parentff70e291c96de23ae4dab20f9c4e9f895eee53d5 (diff)
Client + Discovery: Implement further organizations expiry
Diffstat (limited to 'internal')
-rw-r--r--internal/discovery/discovery.go12
-rw-r--r--internal/server/servers.go5
2 files changed, 14 insertions, 3 deletions
diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go
index 41685ac..f4151a7 100644
--- a/internal/discovery/discovery.go
+++ b/internal/discovery/discovery.go
@@ -73,13 +73,19 @@ func (discovery *Discovery) file(jsonFile string, previousVersion uint64, struct
return nil
}
+// MarkOrganizationsExpired marks the organizations as expired
+func (discovery *Discovery) MarkOrganizationsExpired() {
+ // Re-initialize the timestamp to zero
+ discovery.organizations.Timestamp = time.Time{}
+}
+
// DetermineOrganizationsUpdate returns a boolean indicating whether or not the discovery organizations should be updated
// FIXME: Implement based on
// https://github.com/eduvpn/documentation/blob/v3/SERVER_DISCOVERY.md
// - [IMPLEMENTED] on "first launch" when offering the search for "Institute Access" and "Organizations";
-// - [TODO] when the user tries to add new server AND the user did NOT yet choose an organization before;
-// - [TODO] when the authorization for the server associated with an already chosen organization is triggered, e.g. after expiry or revocation.
-// - [IMPLEMENTED using a custom error message] NOTE: when the org_id that the user chose previously is no longer available in organization_list.json the application should ask the user to choose their organization (again). This can occur for example when the organization replaced their identity provider, uses a different domain after rebranding or simply ceased to exist.
+// - [IMPLEMENTED in client/server.go] when the user tries to add new server AND the user did NOT yet choose an organization before;
+// - [IMPLEMENTED in client/server.go] when the authorization for the server associated with an already chosen organization is triggered, e.g. after expiry or revocation.
+// - [IMPLEMENTED using a custom error message, and in client/server.go] NOTE: when the org_id that the user chose previously is no longer available in organization_list.json the application should ask the user to choose their organization (again). This can occur for example when the organization replaced their identity provider, uses a different domain after rebranding or simply ceased to exist.
func (discovery *Discovery) DetermineOrganizationsUpdate() bool {
return discovery.organizations.Timestamp.IsZero()
}
diff --git a/internal/server/servers.go b/internal/server/servers.go
index 4086738..0fa8187 100644
--- a/internal/server/servers.go
+++ b/internal/server/servers.go
@@ -13,6 +13,11 @@ type Servers struct {
IsType Type `json:"is_secure_internet"`
}
+// HasSecureInternet returns whether or not we have a secure internet server added
+func (ss *Servers) HasSecureInternet() bool {
+ return len(ss.SecureInternetHomeServer.BaseMap) > 0
+}
+
func (ss *Servers) AddSecureInternet(
secureOrg *types.DiscoveryOrganization,
secureServer *types.DiscoveryServer,