template-monorepo/internal/model/auth/domain/repository/login_session.go

30 lines
750 B
Go
Raw Normal View History

package repository
import (
"context"
"time"
authdomain "gateway/internal/model/auth/domain"
)
// LoginSession holds OAuth login-only state in Redis.
type LoginSession struct {
SessionID string
TenantID string
TenantSlug string
Provider string
RedirectURI string
}
// LoginSessionStore persists short-lived login sessions.
type LoginSessionStore interface {
Save(ctx context.Context, session *LoginSession, ttl time.Duration) error
Get(ctx context.Context, sessionID string) (*LoginSession, error)
Delete(ctx context.Context, sessionID string) error
}
// LoginSessionRedisKey re-exports the Redis key helper for tests.
func LoginSessionRedisKey(sessionID string) string {
return authdomain.LoginSessionRedisKey(sessionID)
}