forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interfaces.go
36 lines (27 loc) · 826 Bytes
/
interfaces.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
package uaa
//go:generate counterfeiter . UAA
type UAA interface {
NewStaleAccessToken(refreshValue string) StaleAccessToken
Prompts() ([]Prompt, error)
ClientCredentialsGrant() (Token, error)
OwnerPasswordCredentialsGrant([]PromptAnswer) (AccessToken, error)
}
//go:generate counterfeiter . Token
// Token is a plain token with a value.
type Token interface {
Type() string
Value() string
}
//go:generate counterfeiter . AccessToken
// AccessToken is a token that can be refreshed.
type AccessToken interface {
Token
RefreshToken() Token
Refresh() (AccessToken, error)
}
// StaleAccessToken represents a token that should only be refreshed.
// Its value cannot be retrieved since it's stale hence should not be used.
type StaleAccessToken interface {
RefreshToken() Token
Refresh() (AccessToken, error)
}