(proxy, internal\policy, docs\reference): define new access control option to bypass authentication

This commit is contained in:
Tejasvi Nareddy 2019-05-20 23:08:45 -04:00 committed by Teju Nareddy
parent c53c07c274
commit c5d2e40435
6 changed files with 60 additions and 3 deletions

View file

@ -180,11 +180,17 @@ func (p *Proxy) OAuthCallback(w http.ResponseWriter, r *http.Request) {
// Conditions should be few in number and have strong justifications.
func (p *Proxy) shouldSkipAuthentication(r *http.Request) bool {
pol, foundPolicy := p.policy(r)
if isCORSPreflight(r) && foundPolicy && pol.CORSAllowPreflight {
log.FromRequest(r).Debug().Msg("proxy: skipping authentication for valid CORS preflight request")
return true
}
if foundPolicy && pol.AllowPublicUnauthenticatedAccess {
log.FromRequest(r).Debug().Msg("proxy: skipping authentication for public route")
return true
}
return false
}