-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.go
51 lines (38 loc) · 1.58 KB
/
store.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
46
47
48
49
50
51
package oauth2
import "context"
type (
// ClientStore the client information storage interface
ClientStore interface {
// according to the ID for the client information
GetByID(ctx context.Context, id string) (ClientInfo, error)
// NOTE
// Remove a client if needed
RemoveByID(id string) (err error)
// NOTE
// Add or update a client jwt(specific to svc clients)
UpsertClientJWToken(ctx context.Context, id, JWToken string) (err error)
}
// TokenStore the token information storage interface
TokenStore interface {
// create and store the new token information
Create(ctx context.Context, info TokenInfo) error
// delete the authorization code
RemoveByCode(ctx context.Context, code string) error
// use the access token to delete the token information
RemoveByAccess(ctx context.Context, access string) error
// use the refresh token to delete the token information
RemoveByRefresh(ctx context.Context, refresh string) error
// NOTE
// use the access token to delete all the tokens
RemoveAllTokensByAccess(ctx context.Context, access string) error
// NOTE
// use the refresh token to delete all the tokens
RemoveAllTokensByRefresh(ctx context.Context, refresh string) error
// use the authorization code for token information data
GetByCode(ctx context.Context, code string) (TokenInfo, error)
// use the access token for token information data
GetByAccess(ctx context.Context, access string) (TokenInfo, error)
// use the refresh token for token information data
GetByRefresh(ctx context.Context, refresh string) (TokenInfo, error)
}
)