Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

you can be authorized and have a failure #34848

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions pkg/apiserver/filters/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,17 @@ func WithAuthorization(handler http.Handler, getAttribs RequestAttributeGetter,
return
}
authorized, reason, err := a.Authorize(attrs)
if err != nil {
internalError(w, req, err)
if authorized {
handler.ServeHTTP(w, req)
return
}
if !authorized {
glog.V(4).Infof("Forbidden: %#v, Reason: %s", req.RequestURI, reason)
forbidden(w, req)
if err != nil {
internalError(w, req, err)
return
}
handler.ServeHTTP(w, req)

glog.V(4).Infof("Forbidden: %#v, Reason: %s", req.RequestURI, reason)
forbidden(w, req)
Copy link
Member

@liggitt liggitt Oct 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should still return a server error http status if err != nil if you're not authorized

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, I can just upstream ours and change the authorizers. Currently, its completely useless

})
}

Expand Down