Improvements for tokens
This commit is contained in:
parent
effa79aacd
commit
8ccd490bed
15 changed files with 34 additions and 30 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue