aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2021-11-22 18:39:08 -0800
committerMike Crute <mike@crute.us>2021-11-22 18:39:08 -0800
commit4f457596a2fa991b5914d4c368697c659db9d1e7 (patch)
tree3731fab5a7ea1eafb59f6c2770eb74db821f1562 /cmd
parent114dbb5ab7952ab66a041c814d5c6a028c8e3039 (diff)
downloadcloud-identity-broker-4f457596a2fa991b5914d4c368697c659db9d1e7.tar.bz2
cloud-identity-broker-4f457596a2fa991b5914d4c368697c659db9d1e7.tar.xz
cloud-identity-broker-4f457596a2fa991b5914d4c368697c659db9d1e7.zip
Add API index resource
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web/server.go45
1 files changed, 25 insertions, 20 deletions
diff --git a/cmd/web/server.go b/cmd/web/server.go
index 3797acd..c573244 100644
--- a/cmd/web/server.go
+++ b/cmd/web/server.go
@@ -127,30 +127,35 @@ func webMain(cfg app.Config, embeddedTemplates fs.FS, version string) {
127 } 127 }
128 am.RegisterUrls(s) 128 am.RegisterUrls(s)
129 129
130 api := s.Group("/api/account") 130 api := s.Group("/api")
131 api.Use(glmw.VaryCookie()) 131 api.Use(glmw.VaryCookie())
132 api.Use(glmw.CacheNeverMiddleware) 132 api.Use(glmw.CacheNeverMiddleware)
133 api.Use(am.Middleware) 133 api.Use(am.Middleware)
134 { 134 {
135 api.GET("", controllers.NewAPIAccountListHandler(as)) 135 api.GET("", controllers.APIIndexHandler)
136 api.GET( 136
137 "/:account/credentials", 137 account := api.Group("/account")
138 controllers.NewAPIRegionListHandler(aws), 138 {
139 ) 139 account.GET("", controllers.NewAPIAccountListHandler(as))
140 api.GET( 140 account.GET(
141 "/:account/console", 141 "/:account/credentials",
142 controllers.NewAPIConsoleRedirectHandler(aws, cfg.IssuerEndpoint), 142 controllers.NewAPIRegionListHandler(aws),
143 rateLimit, 143 )
144 ) 144 account.GET(
145 api.GET( 145 "/:account/console",
146 "/:account/credentials/:region", 146 controllers.NewAPIConsoleRedirectHandler(aws, cfg.IssuerEndpoint),
147 controllers.NewAPICredentialsHandler(aws), 147 rateLimit,
148 rateLimit, 148 )
149 ) 149 account.GET(
150 (&controllers.APIAccountHandler{ 150 "/:account/credentials/:region",
151 Store: as, 151 controllers.NewAPICredentialsHandler(aws),
152 AdminStore: adminAccountStore, 152 rateLimit,
153 }).Register("/:account", api) 153 )
154 (&controllers.APIAccountHandler{
155 Store: as,
156 AdminStore: adminAccountStore,
157 }).Register("/:account", account)
158 }
154 } 159 }
155 s.GET("/favicon.ico", echo.NotFoundHandler) 160 s.GET("/favicon.ico", echo.NotFoundHandler)
156 s.GET("/logout", controllers.LogoutHandler) 161 s.GET("/logout", controllers.LogoutHandler)