forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clientauthorization.go
45 lines (35 loc) · 1.42 KB
/
clientauthorization.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package test
import (
"fmt"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/openshift/origin/pkg/oauth/api"
)
type ClientAuthorizationRegistry struct {
Err error
ClientAuthorizations *api.OAuthClientAuthorizationList
ClientAuthorization *api.OAuthClientAuthorization
CreatedAuthorization *api.OAuthClientAuthorization
UpdatedAuthorization *api.OAuthClientAuthorization
DeletedClientAuthorizationName string
}
func (r *ClientAuthorizationRegistry) ClientAuthorizationName(userName, clientName string) string {
return fmt.Sprintf("%s:%s", userName, clientName)
}
func (r *ClientAuthorizationRegistry) ListClientAuthorizations(label, field labels.Selector) (*api.OAuthClientAuthorizationList, error) {
return r.ClientAuthorizations, r.Err
}
func (r *ClientAuthorizationRegistry) GetClientAuthorization(name string) (*api.OAuthClientAuthorization, error) {
return r.ClientAuthorization, r.Err
}
func (r *ClientAuthorizationRegistry) CreateClientAuthorization(grant *api.OAuthClientAuthorization) error {
r.CreatedAuthorization = grant
return r.Err
}
func (r *ClientAuthorizationRegistry) UpdateClientAuthorization(grant *api.OAuthClientAuthorization) error {
r.UpdatedAuthorization = grant
return r.Err
}
func (r *ClientAuthorizationRegistry) DeleteClientAuthorization(name string) error {
r.DeletedClientAuthorizationName = name
return r.Err
}