generate.go (650B)
1 package oauth2 2 3 import ( 4 "context" 5 "net/http" 6 "time" 7 ) 8 9 type ( 10 // GenerateBasic provide the basis of the generated token data 11 GenerateBasic struct { 12 Client ClientInfo 13 UserID string 14 CreateAt time.Time 15 TokenInfo TokenInfo 16 Request *http.Request 17 } 18 19 // AuthorizeGenerate generate the authorization code interface 20 AuthorizeGenerate interface { 21 Token(ctx context.Context, data *GenerateBasic) (code string, err error) 22 } 23 24 // AccessGenerate generate the access and refresh tokens interface 25 AccessGenerate interface { 26 Token(ctx context.Context, data *GenerateBasic, isGenRefresh bool) (access, refresh string, err error) 27 } 28 )