-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.go
44 lines (38 loc) · 1.32 KB
/
model.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
package oauth
import (
"time"
)
type TokenType string
const (
BearerToken TokenType = "Bearer"
AuthToken TokenType = "A"
UserToken TokenType = "U"
ClientToken TokenType = "C"
)
// TokenResponse is the authorization server response
type TokenResponse struct {
Token string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
TokenType TokenType `json:"token_type"` // bearer
ExpiresIn int64 `json:"expires_in"` // secs
Properties map[string]string `json:"properties"`
}
// Token structure generated by the authorization server
type Token struct {
ID string `json:"id_token"`
CreationDate time.Time `json:"date"`
ExpiresIn time.Duration `json:"expires_in"` // secs
Credential string `json:"credential"`
Scope string `json:"scope"`
Claims map[string]string `json:"claims"`
TokenType TokenType `json:"type"`
}
// RefreshToken structure included in the authorization server response
type RefreshToken struct {
CreationDate time.Time `json:"date"`
TokenID string `json:"id_token"`
RefreshTokenID string `json:"id_refresh_token"`
Credential string `json:"credential"`
TokenType TokenType `json:"type"`
Scope string `json:"scope"`
}