tests

package
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryStorage

type InMemoryStorage struct {
	// contains filtered or unexported fields
}

func NewInMemoryStorage

func NewInMemoryStorage() *InMemoryStorage

func (*InMemoryStorage) Close

func (s *InMemoryStorage) Close() error

func (*InMemoryStorage) Delete

func (s *InMemoryStorage) Delete(_ context.Context, key string) error

func (*InMemoryStorage) Get

func (s *InMemoryStorage) Get(_ context.Context, key string) (any, error)

func (*InMemoryStorage) Incr

func (s *InMemoryStorage) Incr(_ context.Context, _ string, _ *time.Duration) (int, error)

func (*InMemoryStorage) Scan

func (s *InMemoryStorage) Scan(_ context.Context, prefix string) ([]string, error)

func (*InMemoryStorage) Set

func (s *InMemoryStorage) Set(_ context.Context, key string, value any, _ *time.Duration) error

func (*InMemoryStorage) TTL

type MockBlacklistService

type MockBlacklistService struct{ mock.Mock }

func (*MockBlacklistService) BlacklistAllSessionTokens

func (m *MockBlacklistService) BlacklistAllSessionTokens(ctx context.Context, sessionID string, expiresAt time.Time) error

func (*MockBlacklistService) BlacklistToken

func (m *MockBlacklistService) BlacklistToken(ctx context.Context, jti string, expiresAt time.Time) error

func (*MockBlacklistService) CleanupExpired

func (m *MockBlacklistService) CleanupExpired(ctx context.Context) error

func (*MockBlacklistService) IsBlacklisted

func (m *MockBlacklistService) IsBlacklisted(ctx context.Context, jti string) (bool, error)

type MockCacheService

type MockCacheService struct{ mock.Mock }

func (*MockCacheService) CacheJWKS

func (m *MockCacheService) CacheJWKS(ctx context.Context, set jwk.Set) error

func (*MockCacheService) FetchJWKSFromDatabase

func (m *MockCacheService) FetchJWKSFromDatabase(ctx context.Context) (jwk.Set, error)

func (*MockCacheService) GetCachedJWKS

func (m *MockCacheService) GetCachedJWKS(ctx context.Context) (jwk.Set, error)

func (*MockCacheService) GetJWKSWithFallback

func (m *MockCacheService) GetJWKSWithFallback(ctx context.Context) (jwk.Set, error)

func (*MockCacheService) InvalidateCache

func (m *MockCacheService) InvalidateCache(ctx context.Context) error

type MockJWKSRepository

type MockJWKSRepository struct{ mock.Mock }

func (*MockJWKSRepository) GetJWKSKeyByID

func (m *MockJWKSRepository) GetJWKSKeyByID(ctx context.Context, id string) (*jwtservicesTypes.JWKS, error)

func (*MockJWKSRepository) GetJWKSKeys

func (m *MockJWKSRepository) GetJWKSKeys(ctx context.Context) ([]*jwtservicesTypes.JWKS, error)

func (*MockJWKSRepository) MarkKeyExpired

func (m *MockJWKSRepository) MarkKeyExpired(ctx context.Context, id string, expiresAt time.Time) error

func (*MockJWKSRepository) PurgeExpiredKeys

func (m *MockJWKSRepository) PurgeExpiredKeys(ctx context.Context) error

func (*MockJWKSRepository) StoreJWKSKey

func (m *MockJWKSRepository) StoreJWKSKey(ctx context.Context, key *jwtservicesTypes.JWKS) error

func (*MockJWKSRepository) UpdateJWKSKey

func (m *MockJWKSRepository) UpdateJWKSKey(ctx context.Context, key *jwtservicesTypes.JWKS) error

type MockJWTService

type MockJWTService struct{ mock.Mock }

func (*MockJWTService) ValidateToken

func (m *MockJWTService) ValidateToken(ctx context.Context, token string) (*models.Actor, error)

type MockKeyService

type MockKeyService struct{ mock.Mock }

func (*MockKeyService) GenerateKeysIfMissing

func (m *MockKeyService) GenerateKeysIfMissing(ctx context.Context) error

func (*MockKeyService) GetActiveKey

func (m *MockKeyService) GetActiveKey(ctx context.Context) (*jwtservicesTypes.JWKS, error)

func (*MockKeyService) IsKeyRotationDue

func (m *MockKeyService) IsKeyRotationDue(ctx context.Context, rotationInterval time.Duration) bool

func (*MockKeyService) RotateKeysIfNeeded

func (m *MockKeyService) RotateKeysIfNeeded(ctx context.Context, rotationInterval time.Duration, gracePeriod time.Duration, invalidateCacheFunc func(context.Context) error) (bool, error)

type MockRefreshTokenRepository

type MockRefreshTokenRepository struct{ mock.Mock }

func (*MockRefreshTokenRepository) CleanupExpiredTokens

func (m *MockRefreshTokenRepository) CleanupExpiredTokens(ctx context.Context) error

func (*MockRefreshTokenRepository) GetRefreshToken

func (m *MockRefreshTokenRepository) GetRefreshToken(ctx context.Context, tokenHash string) (*jwtservicesTypes.RefreshToken, error)

func (*MockRefreshTokenRepository) RevokeAllSessionTokens

func (m *MockRefreshTokenRepository) RevokeAllSessionTokens(ctx context.Context, sessionID string) error

func (*MockRefreshTokenRepository) RevokeRefreshToken

func (m *MockRefreshTokenRepository) RevokeRefreshToken(ctx context.Context, tokenHash string) error

func (*MockRefreshTokenRepository) SetLastReuseAttempt

func (m *MockRefreshTokenRepository) SetLastReuseAttempt(ctx context.Context, tokenHash string) error

func (*MockRefreshTokenRepository) StoreRefreshToken

func (m *MockRefreshTokenRepository) StoreRefreshToken(ctx context.Context, record *jwtservicesTypes.RefreshToken) error

type MockRefreshTokenService

type MockRefreshTokenService struct{ mock.Mock }

func (*MockRefreshTokenService) RefreshTokens

func (*MockRefreshTokenService) StoreInitialRefreshToken

func (m *MockRefreshTokenService) StoreInitialRefreshToken(ctx context.Context, refreshToken string, sessionID string, expiresAt time.Time) error

type MockSessionService

type MockSessionService struct{ mock.Mock }

func (*MockSessionService) Create

func (m *MockSessionService) Create(ctx context.Context, userID string, hashedToken string, ipAddress *string, userAgent *string, maxAge time.Duration) (*models.Session, error)

func (*MockSessionService) Delete

func (m *MockSessionService) Delete(ctx context.Context, ID string) error

func (*MockSessionService) DeleteAllByUserID

func (m *MockSessionService) DeleteAllByUserID(ctx context.Context, userID string) error

func (*MockSessionService) DeleteAllExpired

func (m *MockSessionService) DeleteAllExpired(ctx context.Context) error

func (*MockSessionService) DeleteOldestByUserID

func (m *MockSessionService) DeleteOldestByUserID(ctx context.Context, userID string, maxCount int) error

func (*MockSessionService) GetByID

func (m *MockSessionService) GetByID(ctx context.Context, id string) (*models.Session, error)

func (*MockSessionService) GetByToken

func (m *MockSessionService) GetByToken(ctx context.Context, hashedToken string) (*models.Session, error)

func (*MockSessionService) GetByUserID

func (m *MockSessionService) GetByUserID(ctx context.Context, userID string) (*models.Session, error)

func (*MockSessionService) GetDistinctUserIDs

func (m *MockSessionService) GetDistinctUserIDs(ctx context.Context) ([]string, error)

func (*MockSessionService) Update

func (m *MockSessionService) Update(ctx context.Context, session *models.Session) (*models.Session, error)

type MockTokenService

type MockTokenService struct{ mock.Mock }

func (*MockTokenService) GenerateMachineToken

func (m *MockTokenService) GenerateMachineToken(ctx context.Context, clientID string, organizationID string, scopes []string) (*jwtservicesTypes.TokenPair, error)

func (*MockTokenService) GenerateUserToken

func (m *MockTokenService) GenerateUserToken(ctx context.Context, userID string, sessionID string) (*jwtservicesTypes.TokenPair, error)

func (*MockTokenService) ValidateToken

func (m *MockTokenService) ValidateToken(ctx context.Context, token string) (*models.Actor, error)

type MockTokenServiceCore

type MockTokenServiceCore struct{ mock.Mock }

func (*MockTokenServiceCore) Decrypt

func (m *MockTokenServiceCore) Decrypt(encrypted string) (string, error)

func (*MockTokenServiceCore) Encrypt

func (m *MockTokenServiceCore) Encrypt(token string) (string, error)

func (*MockTokenServiceCore) Generate

func (m *MockTokenServiceCore) Generate() (string, error)

func (*MockTokenServiceCore) Hash

func (m *MockTokenServiceCore) Hash(token string) string

type NopTokenService

type NopTokenService struct{}

func (NopTokenService) Decrypt

func (NopTokenService) Decrypt(encrypted string) (string, error)

func (NopTokenService) Encrypt

func (NopTokenService) Encrypt(token string) (string, error)

func (NopTokenService) Generate

func (NopTokenService) Generate() (string, error)

func (NopTokenService) Hash

func (NopTokenService) Hash(token string) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL