mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-06 16:36:51 +00:00
refactor(session): move session id generator to relevant pkg
This commit is contained in:
@@ -79,7 +79,7 @@ func (h *Handler) getSessionLifetime(tokenExpiry time.Time) time.Duration {
|
||||
}
|
||||
|
||||
func (h *Handler) createSession(w http.ResponseWriter, r *http.Request, tokens *jwt.Tokens, rawTokens *oauth2.Token, params url.Values) error {
|
||||
externalSessionID, err := NewSessionID(h.Provider.GetOpenIDConfiguration(), tokens.IDToken, params)
|
||||
externalSessionID, err := session.NewSessionID(h.Provider.GetOpenIDConfiguration(), tokens.IDToken, params)
|
||||
if err != nil {
|
||||
return fmt.Errorf("generating session ID: %w", err)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package router
|
||||
package session
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
@@ -1,4 +1,4 @@
|
||||
package router_test
|
||||
package session_test
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/nais/wonderwall/pkg/jwt"
|
||||
"github.com/nais/wonderwall/pkg/openid"
|
||||
"github.com/nais/wonderwall/pkg/router"
|
||||
"github.com/nais/wonderwall/pkg/session"
|
||||
)
|
||||
|
||||
func TestSessionID(t *testing.T) {
|
||||
@@ -98,7 +98,7 @@ func TestSessionID(t *testing.T) {
|
||||
exactMatch: true,
|
||||
},
|
||||
} {
|
||||
actual, err := router.NewSessionID(test.config, test.idToken, test.params)
|
||||
actual, err := session.NewSessionID(test.config, test.idToken, test.params)
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if test.expectErr {
|
||||
Reference in New Issue
Block a user