Improvements for tokens

This commit is contained in:
Tom 2023-06-29 08:59:19 +02:00
parent effa79aacd
commit 8ccd490bed
15 changed files with 34 additions and 30 deletions

View file

@ -22,14 +22,14 @@ func (auth *Auth) Protect(handler http.Handler, AllowToken bool, scope component
var paramValue string
// load the user in the session
// TODO<tokens>: Check if API access is allowed
user, token, err := auth.SessionOf(r)
// TODO: In a future version of sessions, check if token has the permitted scope.
session, user, err := auth.SessionOf(r)
if err != nil {
goto err
}
// token was set, but not allowed!
if token && !AllowToken {
if session.Token && !AllowToken {
goto forbidden
}