diff options
author | Mike Crute <mike@crute.us> | 2023-09-07 11:27:41 -0700 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2023-09-07 11:27:46 -0700 |
commit | 691d7abfdf5e8aa057483a1eb4340c71e45253de (patch) | |
tree | b816fa567344aaf9529cfaa24031502bb0fcad6f /cmd/web/server.go | |
parent | cc8afd651957d7409868fc1d7bde599af188d8cd (diff) | |
download | websocket_proxy-691d7abfdf5e8aa057483a1eb4340c71e45253de.tar.bz2 websocket_proxy-691d7abfdf5e8aa057483a1eb4340c71e45253de.tar.xz websocket_proxy-691d7abfdf5e8aa057483a1eb4340c71e45253de.zip |
Diffstat (limited to 'cmd/web/server.go')
-rw-r--r-- | cmd/web/server.go | 15 |
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 | } |