mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-07 13:22:43 +02:00
- all: prefer `FormValues` to `ParseForm` with subsequent `Form.Get`s - all: refactor authentication stack to be checked by middleware, and accessible via request context. - all: replace http.ServeMux with gorilla/mux’s router - all: replace custom CSRF checks with gorilla/csrf middleware - authenticate: extract callback path as constant. - internal/config: implement stringer interface for policy - internal/cryptutil: add helper func `NewBase64Key` - internal/cryptutil: rename `GenerateKey` to `NewKey` - internal/cryptutil: rename `GenerateRandomString` to `NewRandomStringN` - internal/middleware: removed alice in favor of gorilla/mux - internal/sessions: remove unused `ValidateRedirectURI` and `ValidateClientSecret` - internal/sessions: replace custom CSRF with gorilla/csrf fork that supports custom handler protection - internal/urlutil: add `SignedRedirectURL` to create hmac'd URLs - internal/urlutil: add `ValidateURL` helper to parse URL options - internal/urlutil: add `GetAbsoluteURL` which takes a request and returns its absolute URL. - proxy: remove holdover state verification checks; we no longer are setting sessions in any proxy routes so we don’t need them. - proxy: replace un-named http.ServeMux with named domain routes. Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
28 lines
760 B
Go
28 lines
760 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, *State) error {
|
|
return ms.SaveError
|
|
}
|