-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.go
39 lines (34 loc) · 1.44 KB
/
generate.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
package oauth2
import (
"context"
"net/http"
"time"
)
type (
// GenerateBasic provide the basis of the generated token data
GenerateBasic struct {
Client ClientInfo
UserID string
CreateAt time.Time
TokenInfo TokenInfo
Request *http.Request
}
// AuthorizeGenerate generate the authorization code interface
AuthorizeGenerate interface {
Token(ctx context.Context, data *GenerateBasic) (code string, err error)
}
// AccessGenerate generate the access and refresh tokens interface
AccessGenerate interface {
Token(ctx context.Context, data *GenerateBasic, isGenRefresh bool) (access, refresh string, err error)
}
JWTAccessGenerate interface {
CreateJWTAccessGenerate(kid string, key []byte, meth ...string) JWTAccessGenerate
GenerateOpenidJWToken(ctx context.Context, tokenInfo TokenInfo, isGenRefresh bool, openidInfo OpenidInfo) (string, string, error)
ValidOpenidJWToken(ctx context.Context, tokenSecret string) error
GetdataOpenidJWToken(ctx context.Context, tokenSecret string) (map[string]interface{}, error)
GetdataAdminOpenidJWToken(ctx context.Context, tokenSecret string) (map[string]interface{}, error)
// GetTokensOpenidJWToken(ctx context.Context, tokenSecret string) (error, map[string]interface{})
// GetOauthTokensFromOpenidJWToken(ctx context.Context, tokenSecret string) (OpenidInfo, string, string, error)
Token(ctx context.Context, data *GenerateBasic, isGenRefresh bool) (string, string, error)
}
)