Documentation
¶
Index ¶
- func ValidScope(scope SessionScope) bool
- type ScopeSubject
- type Session
- func (s *Session) AddAllowedIPs(ips SessionIPs)
- func (s *Session) CreateSessionJWT(issuer string, mk keys.MasterKey) (string, error)
- func (s *Session) DeleteAllowedIP(ip SessionIP)
- func (s *Session) Extend(duration time.Duration)
- func (s *Session) GetAllowedIPs() SessionIPs
- func (s *Session) GetEntityname() string
- func (s *Session) GetID() string
- func (s *Session) GetJwtSubject() string
- func (s *Session) GetTtl() time.Duration
- func (s *Session) HasAllowedIP(ip SessionIP) (bool, error)
- func (s *Session) IsExpired() bool
- func (s *Session) ResetAllowedIPs()
- func (s *Session) SetAllowedIPs(ips SessionIPs)
- func (s *Session) Valid() bool
- func (s *Session) VerifySessionJWT(jwtString string, mk keys.MasterKey) error
- type SessionExpiredError
- type SessionIP
- type SessionIPs
- type SessionScope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidScope ¶
func ValidScope(scope SessionScope) bool
Types ¶
type ScopeSubject ¶
func ParseScopeSubject ¶
func ParseScopeSubject(subject string) (res ScopeSubject, err error)
type Session ¶
type Session struct { Id string `json:"_id" bson:"_id"` Scope SessionScope `json:"scope" bson:"scope"` EntityId string `json:"entityId" bson:"entityId"` Expire time.Time `json:"expire" bson:"expire"` AllowedIPs SessionIPs `json:"allowedIps" bson:"allowedIps"` Key keys.SecuredKey `json:"key" bson:"key"` }
func NewSession ¶
func NewSession(scope SessionScope, username string, duration time.Duration, allowedIps []string, mk keys.MasterKey) (s Session, err error)
NewSession create a new Session object with the username and duration specified
func (*Session) AddAllowedIPs ¶
func (s *Session) AddAllowedIPs(ips SessionIPs)
func (*Session) CreateSessionJWT ¶
func (*Session) DeleteAllowedIP ¶
func (*Session) GetAllowedIPs ¶
func (s *Session) GetAllowedIPs() SessionIPs
func (*Session) GetEntityname ¶
GetEntityname returns the username of the user associated to the session
func (*Session) GetJwtSubject ¶
func (*Session) IsExpired ¶
IsExpired returns a boolean that indicate if the time limit of the session is elapsed
func (*Session) ResetAllowedIPs ¶
func (s *Session) ResetAllowedIPs()
func (*Session) SetAllowedIPs ¶
func (s *Session) SetAllowedIPs(ips SessionIPs)
type SessionExpiredError ¶
type SessionExpiredError struct{}
func (*SessionExpiredError) Error ¶
func (m *SessionExpiredError) Error() string
type SessionIPs ¶
type SessionIPs []SessionIP
type SessionScope ¶
type SessionScope string
const ( ScopeTotp SessionScope = "otp" ScopeValidation SessionScope = "vld" ScopeLogin SessionScope = "sid" ScopeAuthChange SessionScope = "aut" ScopeWebauthn SessionScope = "wau" ScopeMachine SessionScope = "mac" )
Click to show internal directories.
Click to hide internal directories.