store.go (1184B)
1 package oauth2 2 3 import "context" 4 5 type ( 6 // ClientStore the client information storage interface 7 ClientStore interface { 8 GetByID(ctx context.Context, id string) (ClientInfo, error) 9 Set(ctx context.Context, id string, cli ClientInfo) error 10 Delete(ctx context.Context, id string) error 11 } 12 13 // TokenStore the token information storage interface 14 TokenStore interface { 15 // create and store the new token information 16 Create(ctx context.Context, info TokenInfo) error 17 18 // delete the authorization code 19 RemoveByCode(ctx context.Context, code string) error 20 21 // use the access token to delete the token information 22 RemoveByAccess(ctx context.Context, access string) error 23 24 // use the refresh token to delete the token information 25 RemoveByRefresh(ctx context.Context, refresh string) error 26 27 // use the authorization code for token information data 28 GetByCode(ctx context.Context, code string) (TokenInfo, error) 29 30 // use the access token for token information data 31 GetByAccess(ctx context.Context, access string) (TokenInfo, error) 32 33 // use the refresh token for token information data 34 GetByRefresh(ctx context.Context, refresh string) (TokenInfo, error) 35 } 36 )