Skip to content

Commit

Permalink
Revert "Rebased on upstream/master"
Browse files Browse the repository at this point in the history
This reverts commit 63eb550.
  • Loading branch information
danielewood committed May 5, 2020
1 parent 63eb550 commit 6b66229
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
15 changes: 2 additions & 13 deletions handlers/auth.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
Copyright 2020 The Vouch Proxy Authors.
Use of this source code is governed by The MIT License (MIT) that
can be found in the LICENSE file. Software distributed under The
Use of this source code is governed by The MIT License (MIT) that
can be found in the LICENSE file. Software distributed under The
MIT License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -117,17 +117,6 @@ func verifyUser(u interface{}) (bool, error) {
}
return false, fmt.Errorf("verifyUser: user.Username not found in WhiteList: %s", user.Username)

// regexWhiteList
case len(cfg.CompiledRegexWhiteList) != 0:
for _, wl := range cfg.CompiledRegexWhiteList {
log.Debugf("Checking claim: '%v' against regex: '%v'", user.Username, wl)
if wl.MatchString(user.Username) {
log.Debugf("VerifyUser: Success! found user.Username in regexWhiteList: %s", user.Username)
return true, nil
}
}
return false, fmt.Errorf("VerifyUser: user.Username not found in regexWhiteList: %s", user.Username)

// TeamWhiteList
case len(cfg.Cfg.TeamWhiteList) != 0:
for _, team := range user.TeamMemberships {
Expand Down
18 changes: 9 additions & 9 deletions pkg/cfg/cfg.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
Copyright 2020 The Vouch Proxy Authors.
Use of this source code is governed by The MIT License (MIT) that
can be found in the LICENSE file. Software distributed under The
Use of this source code is governed by The MIT License (MIT) that
can be found in the LICENSE file. Software distributed under The
MIT License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -164,8 +164,8 @@ var (
Cfg = &Config{}
// IsHealthCheck see main.go
IsHealthCheck = false
// CompiledRegexWhiteList see auth.go
CompiledRegexWhiteList []*regexp.Regexp
// CompiledRegex see handlers.go
CompiledRegex []*regexp.Regexp
)

type cmdLineFlags struct {
Expand Down Expand Up @@ -395,18 +395,18 @@ func basicTest() error {
if Cfg.Cookie.MaxAge > Cfg.JWT.MaxAge {
return fmt.Errorf("configuration error: Cookie maxAge (%d) cannot be larger than the JWT maxAge (%d)", Cfg.Cookie.MaxAge, Cfg.JWT.MaxAge)
}
// if using regexWhiteList, compile regex statements, and store them in cfg.CompiledRegexWhiteList
// if using regexWhiteList, compile regex statements, and store them in cfg.CompiledRegex
if len(Cfg.RegexWhiteList) != 0 {
for i, wl := range Cfg.RegexWhiteList {
//generate regex array
reWhiteList, reWhiteListErr := regexp.Compile(wl)
if reWhiteListErr != nil {
return fmt.Fatalf("Uncompilable regex parameter: '%v'", wl)
return fmt.Errorf("Uncompilable regex parameter: '%v'", wl)
}
CompiledRegexWhiteList = append(CompiledRegexWhiteList, reWhiteList)
log.Debugf("Compiled regex parameter '%v'", CompiledRegexWhiteList[i])
CompiledRegex = append(CompiledRegex, reWhiteList)
log.Debugf("Compiled regex parameter '%v'", CompiledRegex[i])
}
log.Debugf("compiled regex array %v", CompiledRegexWhiteList)
log.Debugf("compiled regex array %v", CompiledRegex)
}
return nil
}
Expand Down

0 comments on commit 6b66229

Please sign in to comment.