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:
Diffstat (limited to 'internal/auth/auth.go')
-rw-r--r--internal/auth/auth.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/auth/auth.go b/internal/auth/auth.go
index 320dcb11..d84fc690 100644
--- a/internal/auth/auth.go
+++ b/internal/auth/auth.go
@@ -198,14 +198,17 @@ func (a *Auth) checkAuthenticationResponse(session *sessions.Session, w http.Res
http.Redirect(w, r, redirectURI, 302)
}
-func (a *Auth) domainAllowed(domain string, domains *source.Domains) bool {
- domainConfigured := (domain == a.pagesDomain) || strings.HasSuffix("."+domain, a.pagesDomain)
+func (a *Auth) domainAllowed(name string, domains *source.Domains) bool {
+ isConfigured := (name == a.pagesDomain) || strings.HasSuffix("."+name, a.pagesDomain)
- if domainConfigured {
+ if isConfigured {
return true
}
- return domains.HasDomain(domain)
+ domain, err := domains.GetDomain(name)
+
+ // domain exists and there is no error
+ return (domain != nil && err == nil)
}
func (a *Auth) handleProxyingAuth(session *sessions.Session, w http.ResponseWriter, r *http.Request, domains *source.Domains) bool {