pomerium/internal/sessions/mock/mock_store.go
Bobby DeSimone 2f13488598
authorize: use opa for policy engine (#474)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2020-02-02 11:18:22 -08:00

35 lines
983 B
Go

// Package mock provides a mock implementation of session store and loader.
package mock // import "github.com/pomerium/pomerium/internal/sessions/mock"
import (
"net/http"
"github.com/pomerium/pomerium/internal/sessions"
)
var _ sessions.SessionStore = &Store{}
var _ sessions.SessionLoader = &Store{}
// Store is a mock implementation of the SessionStore interface
type Store struct {
ResponseSession string
SessionJWT string
Session *sessions.State
SaveError error
LoadError error
}
// ClearSession clears the ResponseSession
func (ms *Store) ClearSession(http.ResponseWriter, *http.Request) {
ms.ResponseSession = ""
}
// LoadSession returns the session and a error
func (ms Store) LoadSession(*http.Request) (*sessions.State, string, error) {
return ms.Session, ms.SessionJWT, ms.LoadError
}
// SaveSession returns a save error.
func (ms Store) SaveSession(http.ResponseWriter, *http.Request, interface{}) error {
return ms.SaveError
}