mirror of
https://github.com/1f349/lavender.git
synced 2024-11-09 22:32:48 +00:00
Fix some boolean issues
This commit is contained in:
parent
b99fb9df6f
commit
b47d4c8ad3
@ -67,7 +67,7 @@ func (h *HttpServer) OptionalAuthentication(next UserHandler) httprouter.Handle
|
|||||||
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
http.Error(rw, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if auth.IsGuest() && !h.readLoginDataCookie(rw, req, &auth) {
|
if auth.IsGuest() && h.readLoginDataCookie(rw, req, &auth) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
next(rw, req, params, auth)
|
next(rw, req, params, auth)
|
||||||
|
@ -200,11 +200,11 @@ func (h *HttpServer) readLoginDataCookie(rw http.ResponseWriter, req *http.Reque
|
|||||||
|
|
||||||
sessionData, done := h.fetchUserInfo(rw, err, sso, token)
|
sessionData, done := h.fetchUserInfo(rw, err, sso, token)
|
||||||
if !done {
|
if !done {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
u.Data = sessionData
|
u.Data = sessionData
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HttpServer) fetchUserInfo(rw http.ResponseWriter, err error, sso *issuer.WellKnownOIDC, token *oauth2.Token) (SessionData, bool) {
|
func (h *HttpServer) fetchUserInfo(rw http.ResponseWriter, err error, sso *issuer.WellKnownOIDC, token *oauth2.Token) (SessionData, bool) {
|
||||||
|
@ -84,7 +84,7 @@ func (h *HttpServer) ManageAppsPost(rw http.ResponseWriter, req *http.Request, _
|
|||||||
}) {
|
}) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if HasRole(roles, "lavender:admin") {
|
if !HasRole(roles, "lavender:admin") {
|
||||||
http.Error(rw, "400 Bad Request: Only admin users can create SSO client applications", http.StatusBadRequest)
|
http.Error(rw, "400 Bad Request: Only admin users can create SSO client applications", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ func (h *HttpServer) ManageUsersGet(rw http.ResponseWriter, req *http.Request, _
|
|||||||
}) {
|
}) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if HasRole(roles, "lavender:admin") {
|
if !HasRole(roles, "lavender:admin") {
|
||||||
http.Error(rw, "403 Forbidden", http.StatusForbidden)
|
http.Error(rw, "403 Forbidden", http.StatusForbidden)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ func (h *HttpServer) ManageUsersPost(rw http.ResponseWriter, req *http.Request,
|
|||||||
}) {
|
}) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if HasRole(roles, "lavender:admin") {
|
if !HasRole(roles, "lavender:admin") {
|
||||||
http.Error(rw, "400 Bad Request: Only admin users can manage users", http.StatusBadRequest)
|
http.Error(rw, "400 Bad Request: Only admin users can manage users", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
let currentTokens = null;
|
let currentTokens = null;
|
||||||
const ssoService = "http://localhost:9090";
|
const ssoService = "http://localhost:9090";
|
||||||
|
|
||||||
POP2.init(ssoService + "/authorize", "a", "openid profile", 500, 600);
|
POP2.init(ssoService + "/authorize", "f4cdb93d-fe28-427b-b037-f03f44c86a16", "openid profile", 500, 600);
|
||||||
|
|
||||||
function updateTokenInfo(data) {
|
function updateTokenInfo(data) {
|
||||||
currentTokens = data.tokens;
|
currentTokens = data.tokens;
|
||||||
|
Loading…
Reference in New Issue
Block a user