forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: poc: OIDC patch for restrictusers
Signed-off-by: everettraven <[email protected]>
- Loading branch information
1 parent
276310a
commit 7a3a6aa
Showing
6 changed files
with
341 additions
and
63 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
openshift-kube-apiserver/admission/authorization/restrictusers/authncache/authentication.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package authncache | ||
|
||
import ( | ||
configv1 "github.com/openshift/api/config/v1" | ||
configv1informer "github.com/openshift/client-go/config/informers/externalversions/config/v1" | ||
) | ||
|
||
type AuthnCache struct { | ||
authnInformer configv1informer.AuthenticationInformer | ||
} | ||
|
||
func NewAuthnCache(authInformer configv1informer.AuthenticationInformer) *AuthnCache { | ||
return &AuthnCache{ | ||
authnInformer: authInformer, | ||
} | ||
} | ||
|
||
func (ac *AuthnCache) Authn() (*configv1.Authentication, error) { | ||
return ac.authnInformer.Lister().Get("cluster") | ||
} | ||
|
||
func (ac *AuthnCache) HasSynced() bool { | ||
return ac.authnInformer.Informer().HasSynced() | ||
} |
17 changes: 17 additions & 0 deletions
17
openshift-kube-apiserver/admission/authorization/restrictusers/authncache_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package restrictusers | ||
|
||
import configv1 "github.com/openshift/api/config/v1" | ||
|
||
type fakeAuthnCache struct { | ||
authn *configv1.Authentication | ||
err error | ||
hasSynced bool | ||
} | ||
|
||
func (f *fakeAuthnCache) Authn() (*configv1.Authentication, error) { | ||
return f.authn, f.err | ||
} | ||
|
||
func (f *fakeAuthnCache) HasSynced() bool { | ||
return f.hasSynced | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.