session

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	// CookieLifetime sets how long the session should last in minutes.
	// If empty or invalid, defaults to 60 minutes.
	CookieLifetime string

	// CookiePersist determines if the cookie should persist after browser close.
	// Valid values are "true" or "false" (case insensitive).
	CookiePersist string

	// CookieName sets the name of the session cookie.
	// If empty, defaults to "session" in the SCS library.
	CookieName string

	// CookieDomain sets the domain for the session cookie.
	// If empty, defaults to the domain name that the cookie was issued from.
	CookieDomain string

	// SessionType determines the storage backend for sessions.
	// Valid values are "redis", "mysql", "mariadb", "postgres", "postgresql".
	// Any other value defaults to cookie-based sessions.
	SessionType string

	// CookieSecure determines if the cookie should only be transmitted over HTTPS.
	// Valid values are "true" or "false" (case insensitive).
	CookieSecure string
	DBPool       *sql.DB
}

Session represents the configuration settings for session management. It holds various cookie-related settings as string values that will be parsed during session initialization.

func (*Session) InitSession

func (c *Session) InitSession() *scs.SessionManager

InitSession initializes and returns a new session manager using the configuration settings in the Session struct. It handles parsing of string configuration values and sets up the session manager with appropriate timeout, cookie settings, and storage backend.

The returned *scs.SessionManager is configured and ready to use for session management in a web application.

Jump to

Keyboard shortcuts

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