Commit 0a1e24f3 authored by Cao Shufeng's avatar Cao Shufeng

remove useless check from impersonation filter

When groupsSpecified is false, that means no other groups are added rather than the service account groups. So this check doesn't make any sense.
parent 956acc2b
...@@ -118,18 +118,8 @@ func WithImpersonation(handler http.Handler, requestContextMapper request.Reques ...@@ -118,18 +118,8 @@ func WithImpersonation(handler http.Handler, requestContextMapper request.Reques
if !groupsSpecified && username != user.Anonymous { if !groupsSpecified && username != user.Anonymous {
// When impersonating a non-anonymous user, if no groups were specified // When impersonating a non-anonymous user, if no groups were specified
// if neither the system:authenticated nor system:unauthenticated groups are explicitly included,
// include the system:authenticated group in the impersonated user info // include the system:authenticated group in the impersonated user info
found := false groups = append(groups, user.AllAuthenticated)
for _, group := range groups {
if group == user.AllAuthenticated || group == user.AllUnauthenticated {
found = true
break
}
}
if !found {
groups = append(groups, user.AllAuthenticated)
}
} }
newUser := &user.DefaultInfo{ newUser := &user.DefaultInfo{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment