summaryrefslogtreecommitdiff
path: root/cmd/web/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/web/server.go')
-rw-r--r--cmd/web/server.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/cmd/web/server.go b/cmd/web/server.go
index e930257..4867970 100644
--- a/cmd/web/server.go
+++ b/cmd/web/server.go
@@ -171,15 +171,25 @@ func webMain(cfg app.Config, embeddedTemplates, embeddedClients fs.FS, appVersio
171 Webauthn: wauthn, 171 Webauthn: wauthn,
172 } 172 }
173 173
174 // TODO: Clean up this hack and expose these to echo
175 hostname := fmt.Sprintf("https://%s", cfg.Hostnames[0])
176 if strings.HasPrefix(cfg.Hostnames[0], "dev.") {
177 hostname += ":8070"
178 }
179
174 o2dc := &controllers.OAuth2DeviceController[*app.Session]{ 180 o2dc := &controllers.OAuth2DeviceController[*app.Session]{
175 Logger: s.Logger, 181 Logger: s.Logger,
176 AuthSessions: authSessionStore, 182 AuthSessions: authSessionStore,
177 OauthClients: oauthClientStore, 183 OauthClients: oauthClientStore,
178 Hostname: fmt.Sprintf("https://%s", cfg.Hostnames[0]), // TODO 184 Hostname: hostname,
179 PollSeconds: cfg.OauthDevicePollSecs, 185 PollSeconds: cfg.OauthDevicePollSecs,
180 SessionExpiration: cfg.OauthSessionTimeout, 186 SessionExpiration: cfg.OauthSessionTimeout,
181 } 187 }
182 188
189 od := controllers.Oauth2DiscoveryController{
190 Hostname: hostname,
191 }
192
183 ph := &controllers.ProxyHandler{ 193 ph := &controllers.ProxyHandler{
184 Logger: s.Logger, 194 Logger: s.Logger,
185 Users: userStore, 195 Users: userStore,
@@ -260,5 +270,8 @@ func webMain(cfg app.Config, embeddedTemplates, embeddedClients fs.FS, appVersio
260 pg.GET("/:host/:port", ph.Handle) 270 pg.GET("/:host/:port", ph.Handle)
261 } 271 }
262 272
273 s.GET(models.Oauth2MetadataPath, od.Handle)
274 s.GET(models.Oauth2MetadataCompatPath, od.Handle)
275
263 s.RunForever(!cfg.DisableBackgroundJobs) 276 s.RunForever(!cfg.DisableBackgroundJobs)
264} 277}