@@ -30,7 +30,6 @@ import (
3030 "github.com/ory/hydra/v2/cmd/cliclient"
3131 "github.com/ory/x/cmdx"
3232 "github.com/ory/x/flagx"
33- "github.com/ory/x/httprouterx"
3433 "github.com/ory/x/pointerx"
3534 "github.com/ory/x/randx"
3635 "github.com/ory/x/tlsx"
@@ -237,7 +236,7 @@ and success, unless if the --no-shutdown flag is provided.`,
237236 }
238237 authCodeURL , state := generateAuthCodeURL ()
239238
240- r := httprouterx . NewRouterPublic ()
239+ r := http . NewServeMux ()
241240 var tlsc * tls.Config
242241 if isSSL {
243242 key , err := rsa .GenerateKey (rand .Reader , 2048 )
@@ -254,23 +253,23 @@ and success, unless if the --no-shutdown flag is provided.`,
254253
255254 server := graceful .WithDefaults (& http.Server {
256255 Addr : fmt .Sprintf (":%d" , port ),
257- Handler : r . Mux , TLSConfig : tlsc ,
256+ Handler : r , TLSConfig : tlsc ,
258257 ReadHeaderTimeout : time .Second * 5 ,
259258 })
260- var shutdown = func () {
259+ shutdown : = func () {
261260 time .Sleep (time .Second * 1 )
262261 ctx , cancel := context .WithTimeout (context .Background (), time .Second * 5 )
263262 defer cancel ()
264263 _ = server .Shutdown (ctx )
265264 }
266265
267- r .GET ( " /" , func (w http.ResponseWriter , r * http.Request ) {
266+ r .Handle ( "GET /" , http . HandlerFunc ( func (w http.ResponseWriter , r * http.Request ) {
268267 _ = tokenUserWelcome .Execute (w , & struct { URL string }{URL : authCodeURL })
269- })
268+ }))
270269
271- r .GET ( " /perform-flow" , func (w http.ResponseWriter , r * http.Request ) {
270+ r .Handle ( "GET /perform-flow" , http . HandlerFunc ( func (w http.ResponseWriter , r * http.Request ) {
272271 http .Redirect (w , r , authCodeURL , http .StatusFound )
273- })
272+ }))
274273
275274 rt := router {
276275 cl : client ,
@@ -290,12 +289,12 @@ and success, unless if the --no-shutdown flag is provided.`,
290289 noShutdown : noShutdown ,
291290 }
292291
293- r .GET ( " /login" , rt .loginGET )
294- r .POST ( " /login" , rt .loginPOST )
295- r .GET ( " /consent" , rt .consentGET )
296- r .POST ( " /consent" , rt .consentPOST )
297- r .GET ( " /callback" , rt .callback )
298- r .POST ( " /callback" , rt .callbackPOSTForm )
292+ r .Handle ( "GET /login" , http . HandlerFunc ( rt .loginGET ) )
293+ r .Handle ( "POST /login" , http . HandlerFunc ( rt .loginPOST ) )
294+ r .Handle ( "GET /consent" , http . HandlerFunc ( rt .consentGET ) )
295+ r .Handle ( "POST /consent" , http . HandlerFunc ( rt .consentPOST ) )
296+ r .Handle ( "GET /callback" , http . HandlerFunc ( rt .callback ) )
297+ r .Handle ( "POST /callback" , http . HandlerFunc ( rt .callbackPOSTForm ) )
299298
300299 if ! flagx .MustGetBool (cmd , "no-open" ) {
301300 _ = webbrowser .Open (serverLocation ) // ignore errors
0 commit comments