mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: correct SCIM Swagger try it out URLs (#24779)
This commit is contained in:
+10
-11
@@ -5,6 +5,7 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"database/sql"
|
||||
_ "embed"
|
||||
"errors"
|
||||
"expvar"
|
||||
"flag"
|
||||
@@ -115,6 +116,9 @@ import (
|
||||
// See https://github.com/swaggo/http-swagger/issues/78
|
||||
var globalHTTPSwaggerHandler http.HandlerFunc
|
||||
|
||||
//go:embed swagger_request_interceptor.js
|
||||
var swaggerRequestInterceptor string
|
||||
|
||||
func init() {
|
||||
globalHTTPSwaggerHandler = httpSwagger.Handler(
|
||||
httpSwagger.URL("/swagger/doc.json"),
|
||||
@@ -130,16 +134,11 @@ func init() {
|
||||
// So remove authenticating via a cookie, and rely on the authorization
|
||||
// header passed in.
|
||||
httpSwagger.UIConfig(map[string]string{
|
||||
// Pulled from https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/
|
||||
// 'withCredentials' should disable fetch sending browser credentials, but
|
||||
// for whatever reason it does not.
|
||||
// So this `requestInterceptor` ensures browser credentials are
|
||||
// omitted from all requests.
|
||||
"requestInterceptor": `(a => {
|
||||
a.credentials = "omit";
|
||||
return a;
|
||||
})`,
|
||||
"withCredentials": "false",
|
||||
// The interceptor source lives in swagger_request_interceptor.js so
|
||||
// it can be edited as real JavaScript.
|
||||
// See https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/.
|
||||
"requestInterceptor": swaggerRequestInterceptor,
|
||||
"withCredentials": "false",
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -310,7 +309,7 @@ type Options struct {
|
||||
// @license.name AGPL-3.0
|
||||
// @license.url https://github.com/coder/coder/blob/main/LICENSE
|
||||
|
||||
// @BasePath /api/v2
|
||||
// @BasePath /
|
||||
|
||||
// @securitydefinitions.apiKey Authorization
|
||||
// @in header
|
||||
|
||||
Reference in New Issue
Block a user