Documentation ¶
Index ¶
- Constants
- func NewExpiresAt() *expiresAt
- func NewSessionStatus(num int) *status
- func SetSession(ctx context.Context, claim *Claim) context.Context
- type Claim
- func (c *Claim) Audience() string
- func (c *Claim) ExpiresAt() time.Time
- func (c *Claim) GenMapClaim() *jwt.MapClaims
- func (c *Claim) IsExpired() bool
- func (c *Claim) IssueAt() time.Time
- func (c *Claim) Issuer() string
- func (c *Claim) SessionID() (shared.UUID[Session], error)
- func (c *Claim) UserID() (shared.UUID[user.User], error)
- type Session
- func (s *Session) Deactivate()
- func (s *Session) ExpiresAt() time.Time
- func (s *Session) IsActive() bool
- func (s *Session) LastActivityAt() time.Time
- func (s *Session) Provider() oauth.AuthProviderName
- func (s *Session) SessionID() shared.UUID[Session]
- func (s *Session) Status() status
- func (s *Session) UpdateLastActivity()
- func (s *Session) UserID() shared.UUID[user.User]
- type SessionRepository
- type SessionService
- type TokenManager
Constants ¶
View Source
const ( SESSION_ACTIVE status = iota SESSION_INACTIVE )
View Source
const ( Issuer = "kotohiro.com" Audience = "kotohiro.com" )
Variables ¶
This section is empty.
Functions ¶
func NewExpiresAt ¶
func NewExpiresAt() *expiresAt
func NewSessionStatus ¶
func NewSessionStatus(num int) *status
Types ¶
type Claim ¶
type Claim struct { Sub string `json:"sub"` // subject (user) Iat int64 `json:"iat"` // issued at (seconds) Exp int64 `json:"exp"` // expiration time (seconds) Jti string `json:"jti"` // JWT ID(SessionID) IconURL *string `json:"iconURL,omitempty"` DisplayName *string `json:"displayName,omitempty"` DisplayID *string `json:"displayId,omitempty"` IsVerify bool `json:"isVerify"` }
func GetSession ¶
func NewClaimFromMap ¶
func NewClaimFromMap(claims jwt.MapClaims) Claim
func (*Claim) GenMapClaim ¶
func (c *Claim) GenMapClaim() *jwt.MapClaims
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func SortByLastActivity ¶
func (*Session) Deactivate ¶
func (s *Session) Deactivate()
func (*Session) LastActivityAt ¶
func (*Session) Provider ¶
func (s *Session) Provider() oauth.AuthProviderName
func (*Session) UpdateLastActivity ¶
func (s *Session) UpdateLastActivity()
type SessionRepository ¶
type SessionService ¶
Click to show internal directories.
Click to hide internal directories.