wrappedsessionstore

package
v0.0.0-...-6aee27a Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT, MIT Imports: 9 Imported by: 0

README

Local Session Store

A fork of MySQLStore with identifable sessions

Overview

This subproject attempts to be a minimal fork of MySQLStore which adds the ability to identify which users own which sessions. The goal is to be able to find all sessions for a particular user so that they may be invalidated.

Changes
  1. The sessions table now includes a user_id field (which acts as a foreign key to the users table)
  2. The sessions table must be created prior to using this store
  3. the _on suffix on dates is now _at, to better correspond to the Ashirt proejct's usage

In addition to the above changes, some code related to the above has been changed to conform to the new usage.

The original copyright can be found in local_session_store.go as the header

License

The original project is licensed as MIT, and a copy of the license can be found in the LICENSE file

Contributors

A list of contributors to MySQLStore can be found in the CONTRIBUTORS file

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeletableSessionStore

type DeletableSessionStore interface {
	sessions.Store
	Delete(r *http.Request, w http.ResponseWriter, s *sessions.Session) error
}

DeletableSessionStore is an extension of sessions.Store that also supports a Delete method

type MySQLStore

type MySQLStore struct {
	Codecs  []securecookie.Codec
	Options *sessions.Options
	// contains filtered or unexported fields
}

MySQLStore acts as a session store based on MySQL. This particular store also allows for identification of the user associated with the session

func NewMySQLStore

func NewMySQLStore(endpoint string, path string, maxAge int, keyPairs ...[]byte) (*MySQLStore, error)

NewMySQLStore connects to the named database, then executes NewMySQLStoreFromConnection

func NewMySQLStoreFromConnection

func NewMySQLStoreFromConnection(db *sql.DB, path string, maxAge int, keyPairs ...[]byte) (*MySQLStore, error)

NewMySQLStoreFromConnection prepares a few statements for interacting with the database, then returns a ready-to-use MySQLStore

func (*MySQLStore) Close

func (m *MySQLStore) Close()

Close cleans up resources used by the MySQLStore (namely: statements, database access)

func (*MySQLStore) Delete

func (m *MySQLStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

Delete removes the provided session from the store (database). An error is returned if some database issue occurs while trying to remove the session

func (*MySQLStore) Get

func (m *MySQLStore) Get(r *http.Request, name string) (*sessions.Session, error)

func (*MySQLStore) New

func (m *MySQLStore) New(r *http.Request, name string) (*sessions.Session, error)

func (*MySQLStore) Save

func (m *MySQLStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

func (*MySQLStore) SetSessionToUserID

func (m *MySQLStore) SetSessionToUserID(fn func(*sessions.Session) *int64)

Jump to

Keyboard shortcuts

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