@@ -105,7 +105,6 @@ type OAuthProxy struct {
105 trustedIPs *ip.NetSet
105 trustedIPs *ip.NetSet
106 Banner string
106 Banner string
107 Footer string
107 Footer string
108− AllowedGroups []string
110 sessionChain alice.Chain
109 sessionChain alice.Chain
111 headersChain alice.Chain
110 headersChain alice.Chain
@@ -219,7 +218,6 @@ func NewOAuthProxy(opts *options.Options, validator func(string) bool) (*OAuthPr
219 Banner: opts.Banner,
218 Banner: opts.Banner,
220 Footer: opts.Footer,
219 Footer: opts.Footer,
221 SignInMessage: buildSignInMessage(opts),
220 SignInMessage: buildSignInMessage(opts),
222− AllowedGroups: opts.AllowedGroups,
224 basicAuthValidator: basicAuthValidator,
222 basicAuthValidator: basicAuthValidator,
225 displayHtpasswdForm: basicAuthValidator != nil && opts.DisplayHtpasswdForm,
223 displayHtpasswdForm: basicAuthValidator != nil && opts.DisplayHtpasswdForm,
@@ -992,13 +990,12 @@ func (p *OAuthProxy) getAuthenticatedSession(rw http.ResponseWriter, req *http.R
994 invalidEmail := session.Email != "" && !p.Validator(session.Email)
992 invalidEmail := session.Email != "" && !p.Validator(session.Email)
995− invalidGroups := session != nil && !p.validateGroups(session.Groups)
996 authorized, err := p.provider.Authorize(req.Context(), session)
993 authorized, err := p.provider.Authorize(req.Context(), session)
997 if err != nil {
994 if err != nil {
998 logger.Errorf("Error with authorization: %v", err)
995 logger.Errorf("Error with authorization: %v", err)
1001− if invalidEmail || invalidGroups || !authorized {
998+ if invalidEmail || !authorized {
1002 logger.PrintAuthf(session.Email, req, logger.AuthFailure, "Invalid authentication via session: removing session %s", session)
999 logger.PrintAuthf(session.Email, req, logger.AuthFailure, "Invalid authentication via session: removing session %s", session)
1003 // Invalid session, clear it
1000 // Invalid session, clear it
1004 err := p.ClearSessionCookie(rw, req)
1001 err := p.ClearSessionCookie(rw, req)
@@ -1037,23 +1034,3 @@ func (p *OAuthProxy) ErrorJSON(rw http.ResponseWriter, code int) {
1037 rw.Header().Set("Content-Type", applicationJSON)
1034 rw.Header().Set("Content-Type", applicationJSON)
1038 rw.WriteHeader(code)
1035 rw.WriteHeader(code)
1041−func (p *OAuthProxy) validateGroups(groups []string) bool {
1042− if len(p.AllowedGroups) == 0 {
1046− allowedGroups := map[string]struct{}{}
1048− for _, group := range p.AllowedGroups {
1049− allowedGroups[group] = struct{}{}
1052− for _, group := range groups {
1053− if _, ok := allowedGroups[group]; ok {