From 79c422315ca3bce48562d67c4d255724c23440da Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Thu, 19 Dec 2019 17:29:07 +0000 Subject: [PATCH] Use short names for fields in the JSON-encoded session Makes the authentication cookie quite shorter. --- server/login/login.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server/login/login.go b/server/login/login.go index aff58ca..1744c7d 100644 --- a/server/login/login.go +++ b/server/login/login.go @@ -23,17 +23,17 @@ const maxFailures = 5 type Auth struct { // True if the user is authenticated. - Authenticated bool + Authenticated bool `json:"a"` // Deadline until authentication will need to be renewed. - Deadline time.Time + Deadline time.Time `json:"d"` // User name and other information (like group membership). - Username string - UserInfo *auth.UserInfo + Username string `json:"u"` + UserInfo *auth.UserInfo `json:"ui"` // Services the user has logged in to from this session. - Services []string + Services []string `json:"sv,omitempty"` } // AddService adds a service to the current session (if it's not @@ -51,10 +51,10 @@ type loginSession struct { Auth // Temporary fields required by the login process. - Password string - AuthResponse *auth.Response - Redir string - Failures int + Password string `json:"p"` + AuthResponse *auth.Response `json:"ar"` + Redir string `json:"r"` + Failures int `json:"fail"` // Implementation detail of the session layer. deleted bool -- GitLab