MCPcopy
hub / github.com/tinyauthapp/tinyauth / setHeaders

Method setHeaders

internal/controller/proxy_controller.go:302–318  ·  view source on GitHub ↗
(c *gin.Context, acls config.App)

Source from the content-addressed store, hash-verified

300}
301
302func (controller *ProxyController) setHeaders(c *gin.Context, acls config.App) {
303 c.Header("Authorization", c.Request.Header.Get("Authorization"))
304
305 headers := utils.ParseHeaders(acls.Response.Headers)
306
307 for key, value := range headers {
308 tlog.App.Debug().Str("header", key).Msg("Setting header")
309 c.Header(key, value)
310 }
311
312 basicPassword := utils.GetSecret(acls.Response.BasicAuth.Password, acls.Response.BasicAuth.PasswordFile)
313
314 if acls.Response.BasicAuth.Username != "" && basicPassword != "" {
315 tlog.App.Debug().Str("username", acls.Response.BasicAuth.Username).Msg("Setting basic auth header")
316 c.Header("Authorization", fmt.Sprintf("Basic %s", utils.GetBasicAuth(acls.Response.BasicAuth.Username, basicPassword)))
317 }
318}
319
320func (controller *ProxyController) handleError(c *gin.Context, proxyCtx ProxyContext) {
321 redirectURL := fmt.Sprintf("%s/error", controller.config.AppURL)

Callers 1

proxyHandlerMethod · 0.95

Calls 3

ParseHeadersFunction · 0.92
GetSecretFunction · 0.92
GetBasicAuthFunction · 0.92

Tested by

no test coverage detected