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

37 lines
1.0 KiB
Go
Raw Normal View History

package repository
import (
"context"
"time"
authdomain "gateway/internal/model/auth/domain"
)
// RegistrationSession holds OAuth pre-registration state in Redis.
type RegistrationSession struct {
SessionID string
TenantID string
TenantSlug string
InviteCode string
InviteNewUsersOnly bool
AcceptTermsVersion string
MarketingOptIn bool
Language string
Provider string
RedirectURI string
ClientIP string
UserAgent string
}
// RegistrationSessionStore persists short-lived registration sessions.
type RegistrationSessionStore interface {
Save(ctx context.Context, session *RegistrationSession, ttl time.Duration) error
Get(ctx context.Context, sessionID string) (*RegistrationSession, error)
Delete(ctx context.Context, sessionID string) error
}
// RegistrationSessionRedisKey re-exports the Redis key helper for tests.
func RegistrationSessionRedisKey(sessionID string) string {
return authdomain.RegistrationSessionRedisKey(sessionID)
}