Documentation
¶
Index ¶
- type GCMEncryptor
- type LimitedRedisClient
- type MockRedisAdapterOption
- type MockRedisClient
- func (m *MockRedisClient) Del(_ context.Context, keys ...string) *redis.IntCmd
- func (m *MockRedisClient) ExpireAt(ctx context.Context, key string, tm time.Time) *redis.BoolCmd
- func (m *MockRedisClient) HGetAll(_ context.Context, key string) *redis.MapStringStringCmd
- func (m *MockRedisClient) HSet(_ context.Context, key string, values ...any) *redis.IntCmd
- func (m *MockRedisClient) Persist(ctx context.Context, key string) *redis.BoolCmd
- type RedisAdapter
- func (r RedisAdapter) GetAccessToken(ctx context.Context, tokenID string) (models.AuthToken, error)
- func (r RedisAdapter) GetIDToken(ctx context.Context, tokenID string) (models.AuthToken, error)
- func (r RedisAdapter) GetRefreshToken(ctx context.Context, tokenID string) (models.AuthToken, error)
- func (r RedisAdapter) GetSession(ctx context.Context, sessionID string) (models.Session, error)
- func (r RedisAdapter) RemoveSession(ctx context.Context, sessionID string) error
- func (r RedisAdapter) SetAccessToken(ctx context.Context, token models.AuthToken) error
- func (r RedisAdapter) SetAccessTokenExpiry(ctx context.Context, token models.AuthToken, expiresAt time.Time) error
- func (r RedisAdapter) SetIDToken(ctx context.Context, token models.AuthToken) error
- func (r RedisAdapter) SetIDTokenExpiry(ctx context.Context, token models.AuthToken, expiresAt time.Time) error
- func (r RedisAdapter) SetRefreshToken(ctx context.Context, token models.AuthToken) error
- func (r RedisAdapter) SetRefreshTokenExpiry(ctx context.Context, token models.AuthToken, expiresAt time.Time) error
- func (r RedisAdapter) SetSession(ctx context.Context, session models.Session) error
- type RedisAdapterOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GCMEncryptor ¶
type GCMEncryptor struct {
// contains filtered or unexported fields
}
func NewGCMEncryptor ¶
func NewGCMEncryptor(secret string) (GCMEncryptor, error)
type LimitedRedisClient ¶
type LimitedRedisClient interface { // EXPIREAT key unix-time-seconds ExpireAt(ctx context.Context, key string, tm time.Time) *redis.BoolCmd // DEL key [key ...] Del(ctx context.Context, keys ...string) *redis.IntCmd // PERSIST key Persist(ctx context.Context, key string) *redis.BoolCmd // HGETALL key HGetAll(ctx context.Context, key string) *redis.MapStringStringCmd // HSET key field value [field value ...] HSet(ctx context.Context, key string, values ...any) *redis.IntCmd }
LimitedRedisClient is the limited set of functionality expected from the redis client in this adapter. This allows for easy mocking and swapping of the client. The universal redis client interface is way too big.
type MockRedisAdapterOption ¶
type MockRedisAdapterOption func(r *RedisAdapter)
func WithEncryption ¶
func WithEncryption(key string) MockRedisAdapterOption
type MockRedisClient ¶
type MockRedisClient struct {
// contains filtered or unexported fields
}
Implements the LimitedRedis client struct Only suitable for testing The value set for the IntCmd or similar results is always 1 regardless of how many records were affected Contexts are completely ignored
func (*MockRedisClient) Del ¶
func (m *MockRedisClient) Del(_ context.Context, keys ...string) *redis.IntCmd
func (*MockRedisClient) HGetAll ¶
func (m *MockRedisClient) HGetAll(_ context.Context, key string) *redis.MapStringStringCmd
type RedisAdapter ¶
type RedisAdapter struct {
// contains filtered or unexported fields
}
func NewMockRedisAdapter ¶
func NewMockRedisAdapter(options ...MockRedisAdapterOption) RedisAdapter
func NewRedisAdapter ¶
func NewRedisAdapter(options ...RedisAdapterOption) (*RedisAdapter, error)
func (RedisAdapter) GetAccessToken ¶
GetAccessToken reads the associated ID, access token value, expiration, tokenID and refresh URL of an access token from Redis
func (RedisAdapter) GetIDToken ¶
func (RedisAdapter) GetRefreshToken ¶
func (r RedisAdapter) GetRefreshToken(ctx context.Context, tokenID string) (models.AuthToken, error)
GetRefreshToken reads the associated ID, refresh token value, expiration and tokenID of a refresh token from Redis
func (RedisAdapter) GetSession ¶
func (RedisAdapter) RemoveSession ¶
func (r RedisAdapter) RemoveSession(ctx context.Context, sessionID string) error
func (RedisAdapter) SetAccessToken ¶
SetAccessToken writes the associated ID, access token value, expiration, tokenID and refresh URL of an access token to Redis.
func (RedisAdapter) SetAccessTokenExpiry ¶
func (RedisAdapter) SetIDToken ¶
func (RedisAdapter) SetIDTokenExpiry ¶
func (RedisAdapter) SetRefreshToken ¶
SetRefreshToken writes the associated ID, access token value, expiration and tokenID of a refresh token to Redis
func (RedisAdapter) SetRefreshTokenExpiry ¶
func (RedisAdapter) SetSession ¶
type RedisAdapterOption ¶
type RedisAdapterOption func(*RedisAdapter) error
func WithEcryption ¶
func WithEcryption(secretKey string) RedisAdapterOption
func WithRedisConfig ¶
func WithRedisConfig(redisConfig config.RedisConfig) RedisAdapterOption