require authed user to perfrom logout

This commit is contained in:
Umputun
2019-01-16 23:28:49 -06:00
parent 79a8bfe453
commit ff46cbd173
2 changed files with 7 additions and 3 deletions
+3 -3
View File
@@ -112,7 +112,7 @@
version = "v1.0.0"
[[projects]]
digest = "1:5048ee5f04267e166b81a65f6944575750ebc1fc896124d1cf3e57f5d710e49d"
digest = "1:1bd48d32651b8806f269540fabe6b91b900c093c1dcd98c369ca9880c71390f5"
name = "github.com/go-pkgz/auth"
packages = [
".",
@@ -122,8 +122,8 @@
"token",
]
pruneopts = "UT"
revision = "203b40f77cd2d1941d1a8fcdd8474c3bec3cc6b5"
version = "v0.3.3"
revision = "272bd70168efc2706130177a3e900eafd3cd5030"
version = "v0.3.4"
[[projects]]
digest = "1:1933dabfb0e07548ed9684fdef857cc6f2413bbbb74ba838a7c1f77407b8fd90"
+4
View File
@@ -209,5 +209,9 @@ func (p Oauth2Handler) AuthHandler(w http.ResponseWriter, r *http.Request) {
// LogoutHandler - GET /logout
func (p Oauth2Handler) LogoutHandler(w http.ResponseWriter, r *http.Request) {
if _, _, err := p.JwtService.Get(r); err != nil {
rest.SendErrorJSON(w, r, p.L, http.StatusForbidden, err, "logout not allowed")
return
}
p.JwtService.Reset(w)
}