@@ -8,12 +8,9 @@ import (
8
8
"html/template"
9
9
"net/http"
10
10
"net/url"
11
- "regexp"
12
11
"strings"
13
12
"sync"
14
13
15
- "github.com/zenazn/goji/web"
16
-
17
14
"github.com/crewjam/saml"
18
15
"github.com/crewjam/saml/logger"
19
16
)
@@ -94,40 +91,39 @@ func New(opts Options) (*Server, error) {
94
91
// is called automatically for you by New, but you may need to call it
95
92
// yourself if you don't create the object using New.)
96
93
func (s * Server ) InitializeHTTP () {
97
- mux := web . New ()
94
+ mux := http . NewServeMux ()
98
95
s .Handler = mux
99
96
100
- mux .Get ( " /metadata" , func (w http.ResponseWriter , r * http.Request ) {
97
+ mux .HandleFunc ( "GET /metadata" , func (w http.ResponseWriter , r * http.Request ) {
101
98
s .idpConfigMu .RLock ()
102
99
defer s .idpConfigMu .RUnlock ()
103
100
s .IDP .ServeMetadata (w , r )
104
101
})
105
- mux .Handle ("/sso" , func (w http.ResponseWriter , r * http.Request ) {
102
+ mux .HandleFunc ("/sso" , func (w http.ResponseWriter , r * http.Request ) {
106
103
s .IDP .ServeSSO (w , r )
107
104
})
108
105
109
- mux .Handle ("/login" , s .HandleLogin )
110
- mux .Handle ("/login/:shortcut" , s .HandleIDPInitiated )
111
- mux .Handle ("/login/:shortcut/*" , s .HandleIDPInitiated )
112
-
113
- mux .Get ("/services/" , s .HandleListServices )
114
- mux .Get ("/services/:id" , s .HandleGetService )
115
- mux .Put ("/services/:id" , s .HandlePutService )
116
- mux .Post ("/services/:id" , s .HandlePutService )
117
- mux .Delete ("/services/:id" , s .HandleDeleteService )
118
-
119
- mux .Get ("/users/" , s .HandleListUsers )
120
- mux .Get ("/users/:id" , s .HandleGetUser )
121
- mux .Put ("/users/:id" , s .HandlePutUser )
122
- mux .Delete ("/users/:id" , s .HandleDeleteUser )
123
-
124
- sessionPath := regexp .MustCompile ("/sessions/(?P<id>.*)" )
125
- mux .Get ("/sessions/" , s .HandleListSessions )
126
- mux .Get (sessionPath , s .HandleGetSession )
127
- mux .Delete (sessionPath , s .HandleDeleteSession )
128
-
129
- mux .Get ("/shortcuts/" , s .HandleListShortcuts )
130
- mux .Get ("/shortcuts/:id" , s .HandleGetShortcut )
131
- mux .Put ("/shortcuts/:id" , s .HandlePutShortcut )
132
- mux .Delete ("/shortcuts/:id" , s .HandleDeleteShortcut )
106
+ mux .HandleFunc ("/login" , s .HandleLogin )
107
+ mux .HandleFunc ("/login/{shortcut}" , s .HandleIDPInitiated )
108
+ mux .HandleFunc ("/login/{shortcut}/{suffix}" , s .HandleIDPInitiated )
109
+
110
+ mux .HandleFunc ("GET /services/" , s .HandleListServices )
111
+ mux .HandleFunc ("GET /services/{id}" , s .HandleGetService )
112
+ mux .HandleFunc ("PUT /services/{id}" , s .HandlePutService )
113
+ mux .HandleFunc ("POST /services/{id}" , s .HandlePutService )
114
+ mux .HandleFunc ("DELETE /services/{id}" , s .HandleDeleteService )
115
+
116
+ mux .HandleFunc ("GET /users/" , s .HandleListUsers )
117
+ mux .HandleFunc ("GET /users/{id}" , s .HandleGetUser )
118
+ mux .HandleFunc ("PUT /users/{id}" , s .HandlePutUser )
119
+ mux .HandleFunc ("DELETE /users/{id}" , s .HandleDeleteUser )
120
+
121
+ mux .HandleFunc ("GET /sessions/" , s .HandleListSessions )
122
+ mux .HandleFunc ("GET /sessions/{id}" , s .HandleGetSession )
123
+ mux .HandleFunc ("DELETE /sessions/{id}" , s .HandleDeleteSession )
124
+
125
+ mux .HandleFunc ("GET /shortcuts/" , s .HandleListShortcuts )
126
+ mux .HandleFunc ("GET /shortcuts/{id}" , s .HandleGetShortcut )
127
+ mux .HandleFunc ("PUT /shortcuts/{id}" , s .HandlePutShortcut )
128
+ mux .HandleFunc ("DELETE /shortcuts/{id}" , s .HandleDeleteShortcut )
133
129
}
0 commit comments