mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
fix: Redirect to login when unauthenticated and requesting a workspace app (#2903)
Fixes #2884.
This commit is contained in:
@ -103,10 +103,10 @@ func New(options *Options) *API {
|
||||
siteHandler: site.Handler(site.FS(), binFS),
|
||||
}
|
||||
api.workspaceAgentCache = wsconncache.New(api.dialWorkspaceAgent, 0)
|
||||
|
||||
apiKeyMiddleware := httpmw.ExtractAPIKey(options.Database, &httpmw.OAuth2Configs{
|
||||
oauthConfigs := &httpmw.OAuth2Configs{
|
||||
Github: options.GithubOAuth2Config,
|
||||
})
|
||||
}
|
||||
apiKeyMiddleware := httpmw.ExtractAPIKey(options.Database, oauthConfigs, false)
|
||||
|
||||
r.Use(
|
||||
func(next http.Handler) http.Handler {
|
||||
@ -121,7 +121,7 @@ func New(options *Options) *API {
|
||||
apps := func(r chi.Router) {
|
||||
r.Use(
|
||||
httpmw.RateLimitPerMinute(options.APIRateLimit),
|
||||
apiKeyMiddleware,
|
||||
httpmw.ExtractAPIKey(options.Database, oauthConfigs, true),
|
||||
httpmw.ExtractUserParam(api.Database),
|
||||
)
|
||||
r.HandleFunc("/*", api.workspaceAppsProxyPath)
|
||||
|
Reference in New Issue
Block a user