Versions in this module Expand all Collapse all v0 v0.1.0 Oct 13, 2020 Changes in this version + const KeySessions + const SessionDuration + var ErrCache = errors.New("Cache Error") + var ErrDecode = errors.New("Decode Error") + var ErrEncode = errors.New("Encode Error") + var ErrInternalError = errors.New("InternalError") + var ErrInvalidCookie = errors.New("ErrInvalidCookie") + var ErrInvalidCrendential = errors.New("InvalidCredentials") + var ErrInvalidDuration = errors.New("Invalid Duration") + var ErrInvalidRemoteAddr = errors.New("Invalid RemoteAddr") + var ErrInvalidSessionID = errors.New("Invalid SessionID") + var ErrInvalidUserID = errors.New("Invalid UserID") + var ErrMissingCookie = errors.New("MissingCookie") + var ErrRemoteAddrChanged = errors.New("RemoteAddr Changed") + var ErrSessionClose = errors.New("SessionCloseFailed") + var ErrSessionCreationFailed = errors.New("SessionCreationFailed") + var ErrSessionExpired = errors.New("Session Expired") + var ErrTooManyOpenSession = errors.New("TooManyOpenSession") + func CreateSessionWithCookie(ctx context.Context, r *http.Request, w http.ResponseWriter, userID uint64) error + func GetSessionCookie(r *http.Request) string + func IsSessionValid(sessionID SessionID) bool + func IsUserValid(userID uint64) bool + func OpenSessionAllowed(ctx context.Context, userID uint64) bool + func VerifySession(ctx context.Context, subject string, message *messaging.Message) (*messaging.Message, error) + type CookieCodec struct + func NewCookieCodec(ctx context.Context) *CookieCodec + func (p *CookieCodec) NewRequest(r *http.Request) rpc.CodecRequest + type CookieCodecRequest struct + func (p *CookieCodecRequest) Method() (string, error) + func (p *CookieCodecRequest) ReadRequest(args interface{}) error + func (p *CookieCodecRequest) WriteError(w http.ResponseWriter, status int, err error) + func (p *CookieCodecRequest) WriteResponse(w http.ResponseWriter, args interface{}) + type Session struct + func ContextSession(ctx context.Context) (*Session, error) + func NewSession(ctx context.Context) *Session + func (s *Session) Count(ctx context.Context) (int, error) + func (s *Session) CreateSession(ctx context.Context, userID uint64, remoteAddr string, duration time.Duration) (SessionID, error) + func (s *Session) ExtendSession(ctx context.Context, remoteAddr string, sessionID SessionID, ...) (uint64, error) + func (s *Session) InvalidateSession(ctx context.Context, sessionID SessionID) error + func (s *Session) IsSessionValid(ctx context.Context, sessionID SessionID) bool + func (s *Session) UserSession(ctx context.Context, sessionID SessionID) uint64 + type SessionArgs struct + SessionID string + type SessionID string + func NewSessionID() SessionID + type SessionInfo struct + Expiration time.Time + RemoteAddr string + SessionID SessionID + UserID uint64 + func (s *SessionInfo) Decode(data []byte) error + func (s *SessionInfo) Encode() ([]byte, error) + func (s *SessionInfo) Expired() bool + type SessionReply struct + Status string + ValidUntil int64 + func OpenUserSession(ctx context.Context, session *Session, r *http.Request, userID uint64) (SessionReply, error)