aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/api0/api.go
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-14 17:12:58 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-14 17:12:58 -0400
commit7c46a0dc05c85a62f19a72bafca37a711c17621e (patch)
treebab8ad073d151b85fd325bd0f5b78828d7ee033e /pkg/api/api0/api.go
parent38218809c7ce18d43c73f21be60bad93e8186f4e (diff)
downloadAtlas-7c46a0dc05c85a62f19a72bafca37a711c17621e.tar.gz
Atlas-7c46a0dc05c85a62f19a72bafca37a711c17621e.zip
pkg/api/api0: Implement /client/origin_auth
Diffstat (limited to 'pkg/api/api0/api.go')
-rw-r--r--pkg/api/api0/api.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/api/api0/api.go b/pkg/api/api0/api.go
index 2c154cb..f64203c 100644
--- a/pkg/api/api0/api.go
+++ b/pkg/api/api0/api.go
@@ -20,7 +20,9 @@ import (
"net/http"
"strconv"
"strings"
+ "time"
+ "github.com/pg9182/atlas/pkg/origin"
"github.com/rs/zerolog/hlog"
"golang.org/x/mod/semver"
)
@@ -33,6 +35,10 @@ type Handler struct {
// PdataStorage stores player data. It must be non-nil.
PdataStorage PdataStorage
+ // OriginAuthMgr manages Origin nucleus tokens (used for checking
+ // usernames). If not provided, usernames will not be updated.
+ OriginAuthMgr *origin.AuthMgr
+
// MainMenuPromos gets the main menu promos to return for a request.
MainMenuPromos func(*http.Request) MainMenuPromos
@@ -48,6 +54,10 @@ type Handler struct {
// to clients with at least this version, which must be valid semver. +dev
// versions are always allowed.
MinimumLauncherVersion string
+
+ // TokenExpiryTime controls the expiry of player masterserver auth tokens.
+ // If zero, a reasonable a default is used.
+ TokenExpiryTime time.Duration
}
// ServeHTTP routes requests to Handler.
@@ -57,6 +67,8 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/client/mainmenupromos":
h.handleMainMenuPromos(w, r)
+ case "/client/origin_auth":
+ h.handleClientOriginAuth(w, r)
case "/client/auth_with_self":
h.handleClientAuthWithSelf(w, r)
case "/accounts/write_persistence":