session

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSession

func CreateSession(session Session) error

func HandleLogout

func HandleLogout(w http.ResponseWriter, r *http.Request)

HandleLogout godoc @Summary Log out a user @Description Terminates the user's session @Tags session @Accept json @Produce json @Param Authorization header string true "Bearer access token" @Success 200 {string} string "Session terminated successfully" @Failure 401 {object} model.ApiError @Failure 500 {object} model.ApiError @Router /oauth2/logout [post]

Types

type Session

type Session struct {
	ID             string
	UserID         string
	AccessToken    string
	RefreshToken   string
	UserAgent      string
	IPAddress      string
	DeviceID       string
	LastActivityAt time.Time
	CreatedAt      time.Time
	ExpiresAt      time.Time
	DeactivatedAt  *time.Time
	Location       string
}

func SessionByAccessToken

func SessionByAccessToken(accessToken string) (*Session, error)

func SessionByID

func SessionByID(sessionID string) (*Session, error)

Jump to

Keyboard shortcuts

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