Web UIs: add OpenID Connect support

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2022-02-13 14:30:20 +01:00
parent fa0ca8fe89
commit 66945c0a02
30 changed files with 2307 additions and 236 deletions

View File

@@ -36,7 +36,7 @@ func validateJWTToken(w http.ResponseWriter, r *http.Request, audience tokenAudi
var redirectPath string
if audience == tokenAudienceWebAdmin {
redirectPath = webLoginPath
redirectPath = webAdminLoginPath
} else {
redirectPath = webClientLoginPath
}
@@ -199,6 +199,20 @@ func checkHTTPUserPerm(perm string) func(next http.Handler) http.Handler {
}
}
func requireBuiltinLogin(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if isLoggedInWithOIDC(r) {
if isWebClientRequest(r) {
renderClientForbiddenPage(w, r, "This feature is not available if you are logged in with OpenID")
} else {
renderForbiddenPage(w, r, "This feature is not available if you are logged in with OpenID")
}
return
}
next.ServeHTTP(w, r)
})
}
func checkPerm(perm string) func(next http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {