MCPcopy Create free account
hub / github.com/crewjam/saml / InitializeHTTP

Method InitializeHTTP

samlidp/samlidp.go:84–123  ·  view source on GitHub ↗

InitializeHTTP sets up the HTTP handler for the server. (This function is called automatically for you by New, but you may need to call it yourself if you don't create the object using New.)

()

Source from the content-addressed store, hash-verified

82// is called automatically for you by New, but you may need to call it
83// yourself if you don't create the object using New.)
84func (s *Server) InitializeHTTP() {
85 mux := web.New()
86 s.Handler = mux
87
88 mux.Get("/metadata", func(w http.ResponseWriter, r *http.Request) {
89 s.idpConfigMu.RLock()
90 defer s.idpConfigMu.RUnlock()
91 s.IDP.ServeMetadata(w, r)
92 })
93 mux.Handle("/sso", func(w http.ResponseWriter, r *http.Request) {
94 s.idpConfigMu.RLock()
95 defer s.idpConfigMu.RUnlock()
96 s.IDP.ServeSSO(w, r)
97 })
98
99 mux.Handle("/login", s.HandleLogin)
100 mux.Handle("/login/:shortcut", s.HandleIDPInitiated)
101 mux.Handle("/login/:shortcut/*", s.HandleIDPInitiated)
102
103 mux.Get("/services/", s.HandleListServices)
104 mux.Get("/services/:id", s.HandleGetService)
105 mux.Put("/services/:id", s.HandlePutService)
106 mux.Post("/services/:id", s.HandlePutService)
107 mux.Delete("/services/:id", s.HandleDeleteService)
108
109 mux.Get("/users/", s.HandleListUsers)
110 mux.Get("/users/:id", s.HandleGetUser)
111 mux.Put("/users/:id", s.HandlePutUser)
112 mux.Delete("/users/:id", s.HandleDeleteUser)
113
114 sessionPath := regexp.MustCompile("/sessions/(?P<id>.*)")
115 mux.Get("/sessions/", s.HandleListSessions)
116 mux.Get(sessionPath, s.HandleGetSession)
117 mux.Delete(sessionPath, s.HandleDeleteSession)
118
119 mux.Get("/shortcuts/", s.HandleListShortcuts)
120 mux.Get("/shortcuts/:id", s.HandleGetShortcut)
121 mux.Put("/shortcuts/:id", s.HandlePutShortcut)
122 mux.Delete("/shortcuts/:id", s.HandleDeleteShortcut)
123}

Callers 1

NewFunction · 0.95

Calls 7

ServeSSOMethod · 0.80
NewMethod · 0.65
GetMethod · 0.65
PutMethod · 0.65
DeleteMethod · 0.65
ServeMetadataMethod · 0.45
PostMethod · 0.45

Tested by

no test coverage detected