You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-06-19 00:27:39 +02:00
Centralize Ticket management of persistent stores (#682)
* Centralize Ticket management of persistent stores persistence package with Manager & Ticket will handle all the details about keys, secrets, ticket into cookies, etc. Persistent stores just need to pass Save, Load & Clear function handles to the persistent manager now. * Shift to persistence.Manager wrapping a persistence.Store * Break up the Redis client builder logic * Move error messages to Store from Manager * Convert ticket to private for Manager use only * Add persistence Manager & ticket tests * Make a custom MockStore that handles time FastForwards
This commit is contained in:
34
pkg/sessions/persistence/manager_test.go
Normal file
34
pkg/sessions/persistence/manager_test.go
Normal file
@ -0,0 +1,34 @@
|
||||
package persistence
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/oauth2-proxy/oauth2-proxy/pkg/apis/options"
|
||||
sessionsapi "github.com/oauth2-proxy/oauth2-proxy/pkg/apis/sessions"
|
||||
"github.com/oauth2-proxy/oauth2-proxy/pkg/logger"
|
||||
"github.com/oauth2-proxy/oauth2-proxy/pkg/sessions/tests"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
func TestManager(t *testing.T) {
|
||||
logger.SetOutput(GinkgoWriter)
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Persistence Manager SessionStore")
|
||||
}
|
||||
|
||||
var _ = Describe("Persistence Manager SessionStore Tests", func() {
|
||||
var ms *tests.MockStore
|
||||
BeforeEach(func() {
|
||||
ms = tests.NewMockStore()
|
||||
})
|
||||
tests.RunSessionStoreTests(
|
||||
func(_ *options.SessionOptions, cookieOpts *options.Cookie) (sessionsapi.SessionStore, error) {
|
||||
return NewManager(ms, cookieOpts), nil
|
||||
},
|
||||
func(d time.Duration) error {
|
||||
ms.FastForward(d)
|
||||
return nil
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user