Skip to content
Snippets Groups Projects
Commit 1d6ad56a authored by Rohith Jayawardene's avatar Rohith Jayawardene Committed by Rohith
Browse files

Prefix URL Warning (#206)

- adding a log warning just to remind its no longer a prefix but a http route
parent b16d19e4
Branches
Tags
No related merge requests found
......@@ -175,18 +175,19 @@ func (r *oauthProxy) createReverseProxy() error {
if err := r.createTemplates(); err != nil {
return err
}
// step: provision in the protected resources
for _, resource := range r.config.Resources {
log.Infof("protecting resource: %s", resource)
switch resource.WhiteListed {
for _, x := range r.config.Resources {
if x.URL[len(x.URL)-1:] == "/" {
log.Warnf("the resource url: %s is not a prefix, you probably want %s* or %s* to protect the xs", x.URL, x.URL, strings.TrimRight(x.URL, "/"))
}
}
for _, x := range r.config.Resources {
log.Infof("protecting resource: %s", x)
switch x.WhiteListed {
case false:
engine.Match(resource.Methods, resource.URL, emptyHandler,
r.authenticationMiddleware(resource),
r.admissionMiddleware(resource),
r.headersMiddleware(r.config.AddClaims))
engine.Match(x.Methods, x.URL, emptyHandler, r.authenticationMiddleware(x), r.admissionMiddleware(x), r.headersMiddleware(r.config.AddClaims))
default:
engine.Match(resource.Methods, resource.URL, emptyHandler)
engine.Match(x.Methods, x.URL, emptyHandler)
}
}
for name, value := range r.config.MatchClaims {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment