single db with prefixes, dump/restore, blacklisting on user deletion
This commit is contained in:
parent
62ff59957a
commit
d4971cda89
20 changed files with 264 additions and 163 deletions
|
|
@ -15,6 +15,7 @@ import (
|
|||
const (
|
||||
userClaim = "user"
|
||||
adminClaim = "admin"
|
||||
createdClaim = "created"
|
||||
sharedClaim = "shared"
|
||||
sectionClaim = "section"
|
||||
titleClaim = "title"
|
||||
|
|
@ -40,8 +41,13 @@ func newContext(w http.ResponseWriter, r *http.Request, s *HTTPServer) (ctx *Con
|
|||
if err = s.JWT.Verify(t); err != nil {
|
||||
log.Println("VerifyToken:", err)
|
||||
} else {
|
||||
ctx.Token = *t
|
||||
return
|
||||
if !s.DB.LockedOut(t.Claims.GetString(userClaim), t.Claims.GetString(createdClaim)) {
|
||||
ctx.Token = *t
|
||||
return
|
||||
}
|
||||
if err = s.JWT.Invalidate(t); err != nil {
|
||||
log.Println("Invalidate:", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue