-
Notifications
You must be signed in to change notification settings - Fork 69
feat(ws): add auth to backend #202
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
feat(ws): add auth to backend #202
Conversation
Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
|
@thesuperzapper, impressive PR. This approach is indeed smart! :) As an FUP, I'll add the authorization mocks for the front end (in the standalone). After 1.10 release, I"ll also upgrade Model Registry auth for this. Great work |
|
/lgtm |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ederign, thesuperzapper The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
* feat(ws): add auth to backend Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> * add `DISABLE_AUTH` for interim testing (enabled by default) Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> --------- Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
* feat(ws): add auth to backend Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> * add `DISABLE_AUTH` for interim testing (enabled by default) Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> --------- Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> Signed-off-by: CI Bot <mkoushni@redhat.com>
* feat(ws): add auth to backend Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> * add `DISABLE_AUTH` for interim testing (enabled by default) Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com> --------- Signed-off-by: Mathew Wicks <5735406+thesuperzapper@users.noreply.github.com>
This PR:
helper.GetKubeconfigand replaces it withctrl.GetConfig()CLIENT_QPSandCLIENT_BURSTas configs (because the defaults are very low 20/30)Authentication is implemented by reading the
USERID_HEADERandGROUPS_HEADERin each request (seeNewRequestAuthenticator()).Authorization is implemented with SubjectAccessReviews (see
NewRequestAuthorizer()). TheNewRequestAuthorizer()method uses theauthorizerfactory.DelegatingAuthorizerConfigfromk8s.io/apiserver/pkg/authorization/authorizerfactoryand has a 10-second cache to not check the user is still authorized more than once every 10 seconds.To define what auth a specific handler requires, we have a new
a.requireAuth()method, which takes a new[]ResourcePolicylist, that can easily be constructed usingNewResourcePolicy()in a clear way.