-
Notifications
You must be signed in to change notification settings - Fork 24
/
web.go
38 lines (29 loc) · 835 Bytes
/
web.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package beyond
import (
"flag"
"fmt"
"net/http"
)
var (
homeURL = flag.String("home-url", "https://google.com", "redirect users here from root")
)
// NewMux mounts all configured web handlers
func NewMux() http.Handler {
mux := http.NewServeMux()
mux.HandleFunc(*healthPath, func(rw http.ResponseWriter, r *http.Request) {
fmt.Fprint(rw, *healthReply)
})
mux.HandleFunc(*host+"/federate", federate)
mux.HandleFunc(*host+"/federate/verify", federateVerify)
mux.HandleFunc(*host+"/launch", handleLaunch)
mux.HandleFunc(*host+"/oidc", handleOIDC)
if samlSP != nil {
mux.HandleFunc(*host+"/saml/", samlSP.ServeHTTP)
}
mux.Handle(*host+"/", http.RedirectHandler(*homeURL, http.StatusTemporaryRedirect))
for _, ds := range dockerServers {
ds.RegisterHandlers(mux)
}
mux.HandleFunc("/", handler)
return mux
}