68 lines
1.2 KiB
Go
68 lines
1.2 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Token struct {
|
|
ID uuid.UUID
|
|
RefreshTokenID uuid.UUID
|
|
Expiration time.Time
|
|
Subjet string
|
|
Audiences []string
|
|
Scopes []string
|
|
}
|
|
|
|
type RefreshToken struct {
|
|
ID uuid.UUID
|
|
ClientID string
|
|
UserID string
|
|
Scopes []string
|
|
AuthTime time.Time
|
|
}
|
|
|
|
func (t RefreshToken) Request() *RefreshTokenRequest {
|
|
return &RefreshTokenRequest{
|
|
userID: t.UserID,
|
|
clientID: t.ClientID,
|
|
scopes: t.Scopes,
|
|
authTime: t.AuthTime,
|
|
}
|
|
}
|
|
|
|
type RefreshTokenRequest struct {
|
|
clientID string
|
|
authTime time.Time
|
|
userID string
|
|
scopes []string
|
|
}
|
|
|
|
func (r RefreshTokenRequest) GetAMR() []string {
|
|
return []string{}
|
|
}
|
|
|
|
func (r RefreshTokenRequest) GetAudience() []string {
|
|
return []string{}
|
|
}
|
|
|
|
func (r RefreshTokenRequest) GetAuthTime() time.Time {
|
|
return r.authTime
|
|
}
|
|
|
|
func (r RefreshTokenRequest) GetClientID() string {
|
|
return r.clientID
|
|
}
|
|
|
|
func (r RefreshTokenRequest) GetScopes() []string {
|
|
return r.scopes
|
|
}
|
|
|
|
func (r RefreshTokenRequest) GetSubject() string {
|
|
return r.userID
|
|
}
|
|
|
|
func (r *RefreshTokenRequest) SetCurrentScopes(scopes []string) {
|
|
r.scopes = scopes
|
|
}
|