|
@@ -9,6 +9,16 @@ import (
|
|
"imuslab.com/zoraxy/mod/info/logger"
|
|
"imuslab.com/zoraxy/mod/info/logger"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ sso.go
|
|
|
|
+
|
|
|
|
+ This file contains the main SSO handler and the SSO configuration
|
|
|
|
+ structure. It also contains the main SSO handler functions.
|
|
|
|
+
|
|
|
|
+ SSO web interface are stored in the static folder, which is embedded
|
|
|
|
+ into the binary.
|
|
|
|
+*/
|
|
|
|
+
|
|
//go:embed static/*
|
|
//go:embed static/*
|
|
var staticFiles embed.FS //Static files for the SSO portal
|
|
var staticFiles embed.FS //Static files for the SSO portal
|
|
|
|
|
|
@@ -54,10 +64,10 @@ func NewSSOHandler(config *SSOConfig) (*SSOHandler, error) {
|
|
return &thisHandler, nil
|
|
return &thisHandler, nil
|
|
}
|
|
}
|
|
|
|
|
|
-// ServeHTTP handle the SSO request by forwarding auth to the authelia server
|
|
|
|
|
|
+// ServeForwardAuth handle the SSO request by forwarding auth to the authelia server
|
|
// return false if the request is not authorized and shall not be proceed
|
|
// return false if the request is not authorized and shall not be proceed
|
|
// Note that only accounts that have SSO enabled will be handled by this handler
|
|
// Note that only accounts that have SSO enabled will be handled by this handler
|
|
-func (h *SSOHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) bool {
|
|
|
|
|
|
+func (h *SSOHandler) ServeForwardAuth(w http.ResponseWriter, r *http.Request) bool {
|
|
//Check if the user have the cookie "Zoraxy-SSO" set
|
|
//Check if the user have the cookie "Zoraxy-SSO" set
|
|
session, err := h.cookieStore.Get(r, "Zoraxy-SSO")
|
|
session, err := h.cookieStore.Get(r, "Zoraxy-SSO")
|
|
if err != nil {
|
|
if err != nil {
|