36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/golang-jwt/jwt/v5"
|
|
)
|
|
|
|
type AccessToken struct {
|
|
Email string `json:"email"`
|
|
UsersID string `json:"users_id"`
|
|
RoleID *int `json:"role_id,omitempty"`
|
|
AdditionalRoleID []int `json:"additional_role_id"`
|
|
SessionID string `json:"session_id"`
|
|
Exp int64 `json:"exp"`
|
|
jwt.RegisteredClaims
|
|
}
|
|
|
|
type JWTSession struct {
|
|
ID string `json:"id" db:"id"`
|
|
UsersID string `json:"users_id" db:"users_id"`
|
|
RefreshTokenHash string `json:"refresh_token_hash" db:"refresh_token_hash"`
|
|
UserAgent string `json:"user_agent" db:"user_agent"`
|
|
IPAddress string `json:"ip_address" db:"ip_address"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
ExpiresAt time.Time `json:"expires_at" db:"expires_at"`
|
|
IsRevoked bool `json:"is_revoked" db:"is_revoked"`
|
|
}
|
|
|
|
type ExpiredSession struct {
|
|
ID string
|
|
UsersID string
|
|
RefreshTokenHash string
|
|
}
|