mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-14 04:07:46 +00:00
Cleanup [dec2025] (#101)
* Cleanup excessive comments. * Remove leftovers hanging around from previous refactor * Improve test coverage
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// Cache is a testify mock for cache operations
|
||||
type Cache struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// Get retrieves a value from the cache
|
||||
func (m *Cache) Get(key string) (interface{}, bool) {
|
||||
args := m.Called(key)
|
||||
return args.Get(0), args.Bool(1)
|
||||
}
|
||||
|
||||
// Set stores a value in the cache
|
||||
func (m *Cache) Set(key string, value interface{}) {
|
||||
m.Called(key, value)
|
||||
}
|
||||
|
||||
// SetWithTTL stores a value with a specific TTL
|
||||
func (m *Cache) SetWithTTL(key string, value interface{}, ttl time.Duration) {
|
||||
m.Called(key, value, ttl)
|
||||
}
|
||||
|
||||
// Delete removes a value from the cache
|
||||
func (m *Cache) Delete(key string) {
|
||||
m.Called(key)
|
||||
}
|
||||
|
||||
// Has checks if a key exists in the cache
|
||||
func (m *Cache) Has(key string) bool {
|
||||
args := m.Called(key)
|
||||
return args.Bool(0)
|
||||
}
|
||||
|
||||
// Clear removes all entries from the cache
|
||||
func (m *Cache) Clear() {
|
||||
m.Called()
|
||||
}
|
||||
|
||||
// Close closes the cache
|
||||
func (m *Cache) Close() {
|
||||
m.Called()
|
||||
}
|
||||
|
||||
// Size returns the number of items in the cache
|
||||
func (m *Cache) Size() int {
|
||||
args := m.Called()
|
||||
return args.Int(0)
|
||||
}
|
||||
|
||||
// TokenCache is a testify mock for token-specific cache operations
|
||||
type TokenCache struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// Get retrieves a token from the cache
|
||||
func (m *TokenCache) Get(key string) (string, bool) {
|
||||
args := m.Called(key)
|
||||
return args.String(0), args.Bool(1)
|
||||
}
|
||||
|
||||
// Set stores a token in the cache
|
||||
func (m *TokenCache) Set(key string, token string, ttl time.Duration) {
|
||||
m.Called(key, token, ttl)
|
||||
}
|
||||
|
||||
// Delete removes a token from the cache
|
||||
func (m *TokenCache) Delete(key string) {
|
||||
m.Called(key)
|
||||
}
|
||||
|
||||
// Has checks if a token exists in the cache
|
||||
func (m *TokenCache) Has(key string) bool {
|
||||
args := m.Called(key)
|
||||
return args.Bool(0)
|
||||
}
|
||||
|
||||
// Blacklist is a testify mock for token blacklist operations
|
||||
type Blacklist struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// IsBlacklisted checks if a token is blacklisted
|
||||
func (m *Blacklist) IsBlacklisted(jti string) bool {
|
||||
args := m.Called(jti)
|
||||
return args.Bool(0)
|
||||
}
|
||||
|
||||
// Add adds a token to the blacklist
|
||||
func (m *Blacklist) Add(jti string, expiry time.Time) {
|
||||
m.Called(jti, expiry)
|
||||
}
|
||||
|
||||
// Remove removes a token from the blacklist
|
||||
func (m *Blacklist) Remove(jti string) {
|
||||
m.Called(jti)
|
||||
}
|
||||
|
||||
// Cleanup removes expired entries from the blacklist
|
||||
func (m *Blacklist) Cleanup() {
|
||||
m.Called()
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// JWKSet represents a JSON Web Key Set for testing
|
||||
type JWKSet struct {
|
||||
Keys []JWK `json:"keys"`
|
||||
}
|
||||
|
||||
// JWK represents a JSON Web Key for testing
|
||||
type JWK struct {
|
||||
Kty string `json:"kty"`
|
||||
Kid string `json:"kid"`
|
||||
Use string `json:"use,omitempty"`
|
||||
Alg string `json:"alg,omitempty"`
|
||||
N string `json:"n,omitempty"`
|
||||
E string `json:"e,omitempty"`
|
||||
Crv string `json:"crv,omitempty"`
|
||||
X string `json:"x,omitempty"`
|
||||
Y string `json:"y,omitempty"`
|
||||
}
|
||||
|
||||
// TokenResponse represents an OAuth token response for testing
|
||||
type TokenResponse struct {
|
||||
AccessToken string `json:"access_token"`
|
||||
TokenType string `json:"token_type"`
|
||||
ExpiresIn int `json:"expires_in"`
|
||||
RefreshToken string `json:"refresh_token,omitempty"`
|
||||
IDToken string `json:"id_token,omitempty"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
}
|
||||
|
||||
// IntrospectionResponse represents a token introspection response
|
||||
type IntrospectionResponse struct {
|
||||
Active bool `json:"active"`
|
||||
Scope string `json:"scope,omitempty"`
|
||||
ClientID string `json:"client_id,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
TokenType string `json:"token_type,omitempty"`
|
||||
Exp int64 `json:"exp,omitempty"`
|
||||
Iat int64 `json:"iat,omitempty"`
|
||||
Nbf int64 `json:"nbf,omitempty"`
|
||||
Sub string `json:"sub,omitempty"`
|
||||
Aud string `json:"aud,omitempty"`
|
||||
Iss string `json:"iss,omitempty"`
|
||||
Jti string `json:"jti,omitempty"`
|
||||
}
|
||||
|
||||
// JWKCache is a testify mock for JWK caching operations
|
||||
type JWKCache struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// GetJWKS retrieves a JWKS from the cache or fetches it
|
||||
func (m *JWKCache) GetJWKS(ctx context.Context, jwksURL string, httpClient *http.Client) (*JWKSet, error) {
|
||||
args := m.Called(ctx, jwksURL, httpClient)
|
||||
if args.Get(0) == nil {
|
||||
return nil, args.Error(1)
|
||||
}
|
||||
return args.Get(0).(*JWKSet), args.Error(1)
|
||||
}
|
||||
|
||||
// Close cleans up the cache
|
||||
func (m *JWKCache) Close() {
|
||||
m.Called()
|
||||
}
|
||||
|
||||
// Cleanup performs periodic cleanup
|
||||
func (m *JWKCache) Cleanup() {
|
||||
m.Called()
|
||||
}
|
||||
|
||||
// TokenExchanger is a testify mock for token exchange operations
|
||||
type TokenExchanger struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// ExchangeCodeForToken exchanges an authorization code for tokens
|
||||
func (m *TokenExchanger) ExchangeCodeForToken(ctx context.Context, grantType, codeOrToken, redirectURL, codeVerifier string) (*TokenResponse, error) {
|
||||
args := m.Called(ctx, grantType, codeOrToken, redirectURL, codeVerifier)
|
||||
if args.Get(0) == nil {
|
||||
return nil, args.Error(1)
|
||||
}
|
||||
return args.Get(0).(*TokenResponse), args.Error(1)
|
||||
}
|
||||
|
||||
// GetNewTokenWithRefreshToken refreshes an access token
|
||||
func (m *TokenExchanger) GetNewTokenWithRefreshToken(refreshToken string) (*TokenResponse, error) {
|
||||
args := m.Called(refreshToken)
|
||||
if args.Get(0) == nil {
|
||||
return nil, args.Error(1)
|
||||
}
|
||||
return args.Get(0).(*TokenResponse), args.Error(1)
|
||||
}
|
||||
|
||||
// RevokeTokenWithProvider revokes a token
|
||||
func (m *TokenExchanger) RevokeTokenWithProvider(token, tokenType string) error {
|
||||
args := m.Called(token, tokenType)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
// TokenVerifier is a testify mock for token verification
|
||||
type TokenVerifier struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// VerifyToken verifies a JWT token
|
||||
func (m *TokenVerifier) VerifyToken(token string) error {
|
||||
args := m.Called(token)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
// JWTVerifier is a testify mock for JWT verification
|
||||
type JWTVerifier struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// VerifyJWT verifies a JWT and returns claims
|
||||
func (m *JWTVerifier) VerifyJWT(token string) (map[string]interface{}, error) {
|
||||
args := m.Called(token)
|
||||
if args.Get(0) == nil {
|
||||
return nil, args.Error(1)
|
||||
}
|
||||
return args.Get(0).(map[string]interface{}), args.Error(1)
|
||||
}
|
||||
|
||||
// HTTPClient is a testify mock for HTTP client operations
|
||||
type HTTPClient struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// Do executes an HTTP request
|
||||
func (m *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
||||
args := m.Called(req)
|
||||
if args.Get(0) == nil {
|
||||
return nil, args.Error(1)
|
||||
}
|
||||
return args.Get(0).(*http.Response), args.Error(1)
|
||||
}
|
||||
|
||||
// RoundTripper is a testify mock for HTTP transport
|
||||
type RoundTripper struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// RoundTrip executes a single HTTP transaction
|
||||
func (m *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
args := m.Called(req)
|
||||
if args.Get(0) == nil {
|
||||
return nil, args.Error(1)
|
||||
}
|
||||
return args.Get(0).(*http.Response), args.Error(1)
|
||||
}
|
||||
|
||||
// Logger is a testify mock for logging operations
|
||||
type Logger struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// Debug logs a debug message
|
||||
func (m *Logger) Debug(msg string) {
|
||||
m.Called(msg)
|
||||
}
|
||||
|
||||
// Debugf logs a formatted debug message
|
||||
func (m *Logger) Debugf(format string, args ...interface{}) {
|
||||
m.Called(format, args)
|
||||
}
|
||||
|
||||
// Info logs an info message
|
||||
func (m *Logger) Info(msg string) {
|
||||
m.Called(msg)
|
||||
}
|
||||
|
||||
// Infof logs a formatted info message
|
||||
func (m *Logger) Infof(format string, args ...interface{}) {
|
||||
m.Called(format, args)
|
||||
}
|
||||
|
||||
// Error logs an error message
|
||||
func (m *Logger) Error(msg string) {
|
||||
m.Called(msg)
|
||||
}
|
||||
|
||||
// Errorf logs a formatted error message
|
||||
func (m *Logger) Errorf(format string, args ...interface{}) {
|
||||
m.Called(format, args)
|
||||
}
|
||||
|
||||
// Warn logs a warning message
|
||||
func (m *Logger) Warn(msg string) {
|
||||
m.Called(msg)
|
||||
}
|
||||
|
||||
// Warnf logs a formatted warning message
|
||||
func (m *Logger) Warnf(format string, args ...interface{}) {
|
||||
m.Called(format, args)
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
func TestJWKCache(t *testing.T) {
|
||||
t.Run("GetJWKS returns configured response", func(t *testing.T) {
|
||||
m := new(JWKCache)
|
||||
expectedJWKS := &JWKSet{
|
||||
Keys: []JWK{{Kty: "RSA", Kid: "test-key"}},
|
||||
}
|
||||
|
||||
m.On("GetJWKS", mock.Anything, "https://example.com/jwks", mock.Anything).
|
||||
Return(expectedJWKS, nil)
|
||||
|
||||
result, err := m.GetJWKS(context.Background(), "https://example.com/jwks", nil)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expectedJWKS, result)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("GetJWKS returns error", func(t *testing.T) {
|
||||
m := new(JWKCache)
|
||||
expectedErr := errors.New("network error")
|
||||
|
||||
m.On("GetJWKS", mock.Anything, mock.Anything, mock.Anything).
|
||||
Return(nil, expectedErr)
|
||||
|
||||
result, err := m.GetJWKS(context.Background(), "https://example.com/jwks", nil)
|
||||
|
||||
assert.Nil(t, result)
|
||||
assert.Equal(t, expectedErr, err)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("Close is callable", func(t *testing.T) {
|
||||
m := new(JWKCache)
|
||||
m.On("Close").Return()
|
||||
|
||||
m.Close()
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
}
|
||||
|
||||
func TestTokenExchanger(t *testing.T) {
|
||||
t.Run("ExchangeCodeForToken success", func(t *testing.T) {
|
||||
m := new(TokenExchanger)
|
||||
expectedResp := &TokenResponse{
|
||||
AccessToken: "access-token",
|
||||
RefreshToken: "refresh-token",
|
||||
IDToken: "id-token",
|
||||
ExpiresIn: 3600,
|
||||
}
|
||||
|
||||
m.On("ExchangeCodeForToken", mock.Anything, "authorization_code", "test-code", "https://example.com/callback", "verifier").
|
||||
Return(expectedResp, nil)
|
||||
|
||||
result, err := m.ExchangeCodeForToken(context.Background(), "authorization_code", "test-code", "https://example.com/callback", "verifier")
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expectedResp, result)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("RefreshToken success", func(t *testing.T) {
|
||||
m := new(TokenExchanger)
|
||||
expectedResp := &TokenResponse{
|
||||
AccessToken: "new-access-token",
|
||||
ExpiresIn: 3600,
|
||||
}
|
||||
|
||||
m.On("GetNewTokenWithRefreshToken", "refresh-token").
|
||||
Return(expectedResp, nil)
|
||||
|
||||
result, err := m.GetNewTokenWithRefreshToken("refresh-token")
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expectedResp, result)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("RevokeToken success", func(t *testing.T) {
|
||||
m := new(TokenExchanger)
|
||||
m.On("RevokeTokenWithProvider", "token", "access_token").Return(nil)
|
||||
|
||||
err := m.RevokeTokenWithProvider("token", "access_token")
|
||||
|
||||
assert.NoError(t, err)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
}
|
||||
|
||||
func TestTokenVerifier(t *testing.T) {
|
||||
t.Run("VerifyToken success", func(t *testing.T) {
|
||||
m := new(TokenVerifier)
|
||||
m.On("VerifyToken", "valid-token").Return(nil)
|
||||
|
||||
err := m.VerifyToken("valid-token")
|
||||
|
||||
assert.NoError(t, err)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("VerifyToken failure", func(t *testing.T) {
|
||||
m := new(TokenVerifier)
|
||||
expectedErr := errors.New("token expired")
|
||||
m.On("VerifyToken", "expired-token").Return(expectedErr)
|
||||
|
||||
err := m.VerifyToken("expired-token")
|
||||
|
||||
assert.Equal(t, expectedErr, err)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSessionManager(t *testing.T) {
|
||||
t.Run("GetSession returns session", func(t *testing.T) {
|
||||
m := new(SessionManager)
|
||||
expectedSession := &SessionData{
|
||||
Email: "[email protected]",
|
||||
AccessToken: "access-token",
|
||||
}
|
||||
|
||||
m.On("GetSession", mock.AnythingOfType("*http.Request")).
|
||||
Return(expectedSession, nil)
|
||||
|
||||
req, _ := http.NewRequest("GET", "/", nil)
|
||||
result, err := m.GetSession(req)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expectedSession, result)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("SaveSession succeeds", func(t *testing.T) {
|
||||
m := new(SessionManager)
|
||||
session := &SessionData{Email: "[email protected]"}
|
||||
|
||||
m.On("SaveSession", mock.Anything, mock.Anything, session).Return(nil)
|
||||
|
||||
req, _ := http.NewRequest("GET", "/", nil)
|
||||
err := m.SaveSession(req, nil, session)
|
||||
|
||||
assert.NoError(t, err)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("DeleteSession succeeds", func(t *testing.T) {
|
||||
m := new(SessionManager)
|
||||
m.On("DeleteSession", mock.Anything, mock.Anything).Return(nil)
|
||||
|
||||
req, _ := http.NewRequest("GET", "/", nil)
|
||||
err := m.DeleteSession(req, nil)
|
||||
|
||||
assert.NoError(t, err)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
}
|
||||
|
||||
func TestCache(t *testing.T) {
|
||||
t.Run("Get returns value", func(t *testing.T) {
|
||||
m := new(Cache)
|
||||
m.On("Get", "key").Return("value", true)
|
||||
|
||||
result, found := m.Get("key")
|
||||
|
||||
assert.True(t, found)
|
||||
assert.Equal(t, "value", result)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("Get returns not found", func(t *testing.T) {
|
||||
m := new(Cache)
|
||||
m.On("Get", "missing").Return(nil, false)
|
||||
|
||||
result, found := m.Get("missing")
|
||||
|
||||
assert.False(t, found)
|
||||
assert.Nil(t, result)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("SetWithTTL is callable", func(t *testing.T) {
|
||||
m := new(Cache)
|
||||
m.On("SetWithTTL", "key", "value", 5*time.Minute).Return()
|
||||
|
||||
m.SetWithTTL("key", "value", 5*time.Minute)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("Delete is callable", func(t *testing.T) {
|
||||
m := new(Cache)
|
||||
m.On("Delete", "key").Return()
|
||||
|
||||
m.Delete("key")
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
}
|
||||
|
||||
func TestHTTPClient(t *testing.T) {
|
||||
t.Run("Do returns response", func(t *testing.T) {
|
||||
m := new(HTTPClient)
|
||||
expectedResp := &http.Response{StatusCode: 200}
|
||||
|
||||
m.On("Do", mock.AnythingOfType("*http.Request")).Return(expectedResp, nil)
|
||||
|
||||
req, _ := http.NewRequest("GET", "https://example.com", nil)
|
||||
result, err := m.Do(req)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 200, result.StatusCode)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("Do returns error", func(t *testing.T) {
|
||||
m := new(HTTPClient)
|
||||
expectedErr := errors.New("connection refused")
|
||||
|
||||
m.On("Do", mock.Anything).Return(nil, expectedErr)
|
||||
|
||||
req, _ := http.NewRequest("GET", "https://example.com", nil)
|
||||
result, err := m.Do(req)
|
||||
|
||||
assert.Nil(t, result)
|
||||
assert.Equal(t, expectedErr, err)
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
}
|
||||
|
||||
func TestLogger(t *testing.T) {
|
||||
t.Run("Debug is callable", func(t *testing.T) {
|
||||
m := new(Logger)
|
||||
m.On("Debug", "test message").Return()
|
||||
|
||||
m.Debug("test message")
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("Error is callable", func(t *testing.T) {
|
||||
m := new(Logger)
|
||||
m.On("Error", "error message").Return()
|
||||
|
||||
m.Error("error message")
|
||||
m.AssertExpectations(t)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// SessionData represents session data for testing
|
||||
type SessionData struct {
|
||||
Email string
|
||||
AccessToken string
|
||||
RefreshToken string
|
||||
IDToken string
|
||||
Expiry int64
|
||||
Nonce string
|
||||
State string
|
||||
CodeVerifier string
|
||||
RedirectURL string
|
||||
Claims map[string]interface{}
|
||||
}
|
||||
|
||||
// SessionManager is a testify mock for session management
|
||||
type SessionManager struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// GetSession retrieves a session from the request
|
||||
func (m *SessionManager) GetSession(r *http.Request) (*SessionData, error) {
|
||||
args := m.Called(r)
|
||||
if args.Get(0) == nil {
|
||||
return nil, args.Error(1)
|
||||
}
|
||||
return args.Get(0).(*SessionData), args.Error(1)
|
||||
}
|
||||
|
||||
// SaveSession saves a session to the response
|
||||
func (m *SessionManager) SaveSession(r *http.Request, w http.ResponseWriter, session *SessionData) error {
|
||||
args := m.Called(r, w, session)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
// DeleteSession removes a session
|
||||
func (m *SessionManager) DeleteSession(r *http.Request, w http.ResponseWriter) error {
|
||||
args := m.Called(r, w)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
// SetAccessToken sets the access token in the session
|
||||
func (m *SessionManager) SetAccessToken(session *SessionData, token string) error {
|
||||
args := m.Called(session, token)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
// SetRefreshToken sets the refresh token in the session
|
||||
func (m *SessionManager) SetRefreshToken(session *SessionData, token string) error {
|
||||
args := m.Called(session, token)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
// SetIDToken sets the ID token in the session
|
||||
func (m *SessionManager) SetIDToken(session *SessionData, token string) error {
|
||||
args := m.Called(session, token)
|
||||
return args.Error(0)
|
||||
}
|
||||
|
||||
// GetAccessToken gets the access token from the session
|
||||
func (m *SessionManager) GetAccessToken(session *SessionData) string {
|
||||
args := m.Called(session)
|
||||
return args.String(0)
|
||||
}
|
||||
|
||||
// GetRefreshToken gets the refresh token from the session
|
||||
func (m *SessionManager) GetRefreshToken(session *SessionData) string {
|
||||
args := m.Called(session)
|
||||
return args.String(0)
|
||||
}
|
||||
|
||||
// GetIDToken gets the ID token from the session
|
||||
func (m *SessionManager) GetIDToken(session *SessionData) string {
|
||||
args := m.Called(session)
|
||||
return args.String(0)
|
||||
}
|
||||
|
||||
// IsExpired checks if the session is expired
|
||||
func (m *SessionManager) IsExpired(session *SessionData) bool {
|
||||
args := m.Called(session)
|
||||
return args.Bool(0)
|
||||
}
|
||||
|
||||
// CleanupOldCookies removes old/stale cookies
|
||||
func (m *SessionManager) CleanupOldCookies(r *http.Request, w http.ResponseWriter) {
|
||||
m.Called(r, w)
|
||||
}
|
||||
Reference in New Issue
Block a user