Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2021-07-07 10:03:54 +0300
committerJaime Martinez <jmartinez@gitlab.com>2021-07-07 10:03:54 +0300
commitc81339af0bd218ccb956f53d0f7bbabef835a5a4 (patch)
tree8ea2b81a4987cd442943657ff969473496bacb09 /internal/auth
parent86afc1dfeeb07fbc140d08ef8cdcfd8cbd4d7bcb (diff)
Add correlation_id to outbound requests
Diffstat (limited to 'internal/auth')
-rw-r--r--internal/auth/auth.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/auth/auth.go b/internal/auth/auth.go
index aab2f3cd..30cb1e38 100644
--- a/internal/auth/auth.go
+++ b/internal/auth/auth.go
@@ -1,6 +1,7 @@
package auth
import (
+ "context"
"crypto/sha256"
"encoding/base64"
"encoding/json"
@@ -217,14 +218,14 @@ func (a *Auth) checkAuthenticationResponse(session *sessions.Session, w http.Res
http.Redirect(w, r, redirectURI, 302)
}
-func (a *Auth) domainAllowed(name string, domains source.Source) bool {
+func (a *Auth) domainAllowed(ctx context.Context, name string, domains source.Source) bool {
isConfigured := (name == a.pagesDomain) || strings.HasSuffix("."+name, a.pagesDomain)
if isConfigured {
return true
}
- domain, err := domains.GetDomain(name)
+ domain, err := domains.GetDomain(ctx, name)
// domain exists and there is no error
return (domain != nil && err == nil)
@@ -249,7 +250,7 @@ func (a *Auth) handleProxyingAuth(session *sessions.Session, w http.ResponseWrit
host = proxyurl.Host
}
- if !a.domainAllowed(host, domains) {
+ if !a.domainAllowed(r.Context(), host, domains) {
logRequest(r).WithField("domain", host).Warn("Domain is not configured")
httperrors.Serve401(w)
return true