-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.go
More file actions
115 lines (89 loc) · 2.6 KB
/
Copy pathtoken.go
File metadata and controls
115 lines (89 loc) · 2.6 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package sql
import (
"time"
"github.com/alkeyio/authkit/models"
"github.com/alkeyio/authkit/types"
)
// Compile-time check that *Token implements models.ExtendableToken.
var _ models.ExtendableToken = (*Token)(nil)
type Token struct {
TokenType string `json:"token_type"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
ClientID string `json:"client_id"`
Scopes []string `json:"scopes"`
IssuedAt time.Time `json:"issued_at"`
AccessTokenExpiresIn time.Duration `json:"access_token_expires_in"`
RefreshTokenExpiresIn time.Duration `json:"refresh_token_expires_in"`
UserID string `json:"user_id"`
JwtID string `json:"jti"`
Data map[string]interface{} `json:"data"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (t *Token) GetType() string {
return t.TokenType
}
func (t *Token) SetType(typ string) {
t.TokenType = typ
}
func (t *Token) GetAccessToken() string {
return t.AccessToken
}
func (t *Token) SetAccessToken(tok string) {
t.AccessToken = tok
}
func (t *Token) GetRefreshToken() string {
return t.RefreshToken
}
func (t *Token) SetRefreshToken(tok string) {
t.RefreshToken = tok
}
func (t *Token) GetClientID() string {
return t.ClientID
}
func (t *Token) SetClientID(cID string) {
t.ClientID = cID
}
func (t *Token) GetScopes() types.Scopes {
return types.NewScopes(t.Scopes)
}
func (t *Token) SetScopes(s types.Scopes) {
t.Scopes = s.String()
}
func (t *Token) GetIssuedAt() time.Time {
return t.IssuedAt
}
func (t *Token) SetIssuedAt(iat time.Time) {
t.IssuedAt = iat
}
func (t *Token) GetAccessTokenExpiresIn() time.Duration {
return t.AccessTokenExpiresIn
}
func (t *Token) SetAccessTokenExpiresIn(exp time.Duration) {
t.AccessTokenExpiresIn = exp
}
func (t *Token) GetRefreshTokenExpiresIn() time.Duration {
return t.RefreshTokenExpiresIn
}
func (t *Token) SetRefreshTokenExpiresIn(exp time.Duration) {
t.RefreshTokenExpiresIn = exp
}
func (t *Token) GetUserID() string {
return t.UserID
}
func (t *Token) SetUserID(id string) {
t.UserID = id
}
func (t *Token) GetJwtID() string {
return t.JwtID
}
func (t *Token) SetJwtID(id string) {
t.JwtID = id
}
func (t *Token) GetExtraData() map[string]interface{} {
return t.Data
}
func (t *Token) SetExtraData(data map[string]interface{}) {
t.Data = data
}