mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-03 12:26:03 +02:00
28 lines
765 B
Go
28 lines
765 B
Go
package sessions // import "github.com/pomerium/pomerium/internal/sessions"
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
// MockSessionStore is a mock implementation of the SessionStore interface
|
|
type MockSessionStore struct {
|
|
ResponseSession string
|
|
Session *State
|
|
SaveError error
|
|
LoadError error
|
|
}
|
|
|
|
// ClearSession clears the ResponseSession
|
|
func (ms *MockSessionStore) ClearSession(http.ResponseWriter, *http.Request) {
|
|
ms.ResponseSession = ""
|
|
}
|
|
|
|
// LoadSession returns the session and a error
|
|
func (ms MockSessionStore) LoadSession(*http.Request) (*State, error) {
|
|
return ms.Session, ms.LoadError
|
|
}
|
|
|
|
// SaveSession returns a save error.
|
|
func (ms MockSessionStore) SaveSession(http.ResponseWriter, *http.Request, interface{}) error {
|
|
return ms.SaveError
|
|
}
|