session

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SESSION_MAX_DURATION = 24 * 365 * time.Hour

Variables

This section is empty.

Functions

func NewCloseUserSessionsUsecase

func NewCloseUserSessionsUsecase(
	store SessionStorage,
	listUserSessions *ListUserSessionsUsecase,
	deleteUserSession *DeleteUserSessionUsecase,
) happydns.SessionCloserUsecase

func NewSessionId

func NewSessionId() string

Types

type CloseUserSessionsUsecase

type CloseUserSessionsUsecase struct {
	// contains filtered or unexported fields
}

func (*CloseUserSessionsUsecase) ByID

func (uc *CloseUserSessionsUsecase) ByID(userID happydns.Identifier) error

func (*CloseUserSessionsUsecase) CloseAll

func (uc *CloseUserSessionsUsecase) CloseAll(user happydns.UserInfo) error

type CreateUserSessionUsecase

type CreateUserSessionUsecase struct {
	// contains filtered or unexported fields
}

func NewCreateUserSessionUsecase

func NewCreateUserSessionUsecase(store SessionStorage) *CreateUserSessionUsecase

func (*CreateUserSessionUsecase) Create

func (uc *CreateUserSessionUsecase) Create(user *happydns.User, description string) (*happydns.Session, error)

type DeleteUserSessionUsecase

type DeleteUserSessionUsecase struct {
	// contains filtered or unexported fields
}

func NewDeleteUserSessionUsecase

func NewDeleteUserSessionUsecase(store SessionStorage, getUserSession *GetUserSessionUsecase) *DeleteUserSessionUsecase

func (*DeleteUserSessionUsecase) Delete

func (uc *DeleteUserSessionUsecase) Delete(user *happydns.User, sessionID string) error

type GetUserSessionUsecase

type GetUserSessionUsecase struct {
	// contains filtered or unexported fields
}

func NewGetUserSessionUsecase

func NewGetUserSessionUsecase(store SessionStorage) *GetUserSessionUsecase

func (*GetUserSessionUsecase) Get

func (uc *GetUserSessionUsecase) Get(user *happydns.User, sessionID string) (*happydns.Session, error)

type ListUserSessionsUsecase

type ListUserSessionsUsecase struct {
	// contains filtered or unexported fields
}

func NewListUserSessionsUsecase

func NewListUserSessionsUsecase(store SessionStorage) *ListUserSessionsUsecase

func (*ListUserSessionsUsecase) List

func (uc *ListUserSessionsUsecase) List(user happydns.UserInfo) ([]*happydns.Session, error)

type Service

type Service struct {
	CreateUserSessionUC *CreateUserSessionUsecase
	DeleteUserSessionUC *DeleteUserSessionUsecase
	GetUserSessionUC    *GetUserSessionUsecase
	ListUserSessionsUC  *ListUserSessionsUsecase
	UpdateUserSessionUC *UpdateUserSessionUsecase
	CloseUserSessionsUC happydns.SessionCloserUsecase
}

func NewSessionUsecases

func NewSessionUsecases(store SessionStorage) *Service

func (*Service) CloseUserSessions

func (s *Service) CloseUserSessions(user *happydns.User) error

func (*Service) CreateUserSession

func (s *Service) CreateUserSession(user *happydns.User, description string) (*happydns.Session, error)

func (*Service) DeleteUserSession

func (s *Service) DeleteUserSession(user *happydns.User, sessionID string) error

func (*Service) GetUserSession

func (s *Service) GetUserSession(user *happydns.User, sessionID string) (*happydns.Session, error)

func (*Service) ListUserSessions

func (s *Service) ListUserSessions(user *happydns.User) ([]*happydns.Session, error)

func (*Service) UpdateUserSession

func (s *Service) UpdateUserSession(user *happydns.User, sessionID string, updateFunc func(sess *happydns.Session)) error

type SessionStorage

type SessionStorage interface {
	// ListAllSessions retrieves the list of known Sessions.
	ListAllSessions() (happydns.Iterator[happydns.Session], error)

	// GetSession retrieves the Session with the given identifier.
	GetSession(sessionid string) (*happydns.Session, error)

	// ListAuthUserSessions retrieves all Session for the given AuthUser.
	ListAuthUserSessions(user *happydns.UserAuth) ([]*happydns.Session, error)

	// ListUserSessions retrieves all Session for the given User.
	ListUserSessions(userid happydns.Identifier) ([]*happydns.Session, error)

	// UpdateSession updates the fields of the given Session.
	UpdateSession(session *happydns.Session) error

	// DeleteSession removes the given Session from the database.
	DeleteSession(sessionid string) error

	// ClearSessions deletes all Sessions present in the database.
	ClearSessions() error
}

type UpdateUserSessionUsecase

type UpdateUserSessionUsecase struct {
	// contains filtered or unexported fields
}

func NewUpdateUserSessionUsecase

func NewUpdateUserSessionUsecase(store SessionStorage, getUserSession *GetUserSessionUsecase) *UpdateUserSessionUsecase

func (*UpdateUserSessionUsecase) Update

func (uc *UpdateUserSessionUsecase) Update(
	user *happydns.User,
	sessionID string,
	updateFunc func(sess *happydns.Session),
) error

Source Files

  • close_user_sessions.go
  • create_user_session.go
  • delete_user_session.go
  • factory.go
  • get_user_session.go
  • list_user_sessions.go
  • session_storage.go
  • update_user_session.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL