aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/packages/container/auth.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/packages/container/auth.go')
-rw-r--r--routers/api/packages/container/auth.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/api/packages/container/auth.go b/routers/api/packages/container/auth.go
index e134f74c8f..33f439ec3e 100644
--- a/routers/api/packages/container/auth.go
+++ b/routers/api/packages/container/auth.go
@@ -20,25 +20,25 @@ func (a *Auth) Name() string {
// Verify extracts the user from the Bearer token
// If it's an anonymous session a ghost user is returned
-func (a *Auth) Verify(req *http.Request, w http.ResponseWriter, store auth.DataStore, sess auth.SessionStore) *user_model.User {
+func (a *Auth) Verify(req *http.Request, w http.ResponseWriter, store auth.DataStore, sess auth.SessionStore) (*user_model.User, error) {
uid, err := packages.ParseAuthorizationToken(req)
if err != nil {
log.Trace("ParseAuthorizationToken: %v", err)
- return nil
+ return nil, err
}
if uid == 0 {
- return nil
+ return nil, nil
}
if uid == -1 {
- return user_model.NewGhostUser()
+ return user_model.NewGhostUser(), nil
}
u, err := user_model.GetUserByID(req.Context(), uid)
if err != nil {
log.Error("GetUserByID: %v", err)
- return nil
+ return nil, err
}
- return u
+ return u, nil
}