authenticate: getUserInfoData() cleanup (#4818)

The Authenticate.getUserInfoData() method has an error return value, but
always returns nil for this value. Let's remove this return value from
the method signature.
This commit is contained in:
Kenneth Jenkins 2023-12-05 14:48:56 -08:00 committed by GitHub
parent 8068890e57
commit 3b2bdd059a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,12 +98,7 @@ func (a *Authenticate) mountDashboard(r *mux.Router) {
sr.Path("/").Handler(a.requireValidSignatureOnRedirect(a.userInfo))
sr.Path("/sign_in").Handler(httputil.HandlerFunc(a.SignIn))
sr.Path("/device-enrolled").Handler(httputil.HandlerFunc(func(w http.ResponseWriter, r *http.Request) error {
userInfoData, err := a.getUserInfoData(r)
if err != nil {
return err
}
handlers.DeviceEnrolled(userInfoData).ServeHTTP(w, r)
handlers.DeviceEnrolled(a.getUserInfoData(r)).ServeHTTP(w, r)
return nil
}))
@ -502,16 +497,11 @@ func (a *Authenticate) userInfo(w http.ResponseWriter, r *http.Request) error {
return nil
}
userInfoData, err := a.getUserInfoData(r)
if err != nil {
return err
}
handlers.UserInfo(userInfoData).ServeHTTP(w, r)
handlers.UserInfo(a.getUserInfoData(r)).ServeHTTP(w, r)
return nil
}
func (a *Authenticate) getUserInfoData(r *http.Request) (handlers.UserInfoData, error) {
func (a *Authenticate) getUserInfoData(r *http.Request) handlers.UserInfoData {
state := a.state.Load()
s, err := a.getSessionFromCtx(r.Context())
@ -527,7 +517,7 @@ func (a *Authenticate) getUserInfoData(r *http.Request) (handlers.UserInfoData,
BrandingOptions: a.options.Load().BrandingOptions,
}
return data, nil
return data
}
// revokeSession always clears the local session and tries to revoke the associated session stored in the