Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Commit

Permalink
Prefix URL Warning (#206)
Browse files Browse the repository at this point in the history
- adding a log warning just to remind its no longer a prefix but a http route
  • Loading branch information
gambol99 authored Apr 18, 2017
1 parent 1260543 commit 3d88003
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3d88003

Please sign in to comment.