auth

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package auth provides shared authentication compatibility layer generation for validation and testing. This package centralizes auth SQL generation to eliminate duplication across plugins and validation systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompatibilityGenerator

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

CompatibilityGenerator generates authentication compatibility SQL for validation environments. Creates mock schemas, roles, and functions that allow migrations to be validated without actual auth services.

func NewCompatibilityGenerator

func NewCompatibilityGenerator(service ServiceType) *CompatibilityGenerator

NewCompatibilityGenerator creates a new auth compatibility generator

func (*CompatibilityGenerator) Generate

func (g *CompatibilityGenerator) Generate() string

Generate returns the complete compatibility SQL for the configured service

func (*CompatibilityGenerator) GenerateAuth0Compatibility

func (g *CompatibilityGenerator) GenerateAuth0Compatibility() string

GenerateAuth0Compatibility creates Auth0 authentication compatibility layer

func (*CompatibilityGenerator) GenerateClerkCompatibility

func (g *CompatibilityGenerator) GenerateClerkCompatibility() string

GenerateClerkCompatibility creates Clerk authentication compatibility layer This includes:

  • auth schema
  • Common roles (anon, authenticated, service_role)
  • Mock auth.jwt() function with Clerk JWT v2 organization structure
  • Helper functions (current_user_id, current_organization_id, etc.)

func (*CompatibilityGenerator) GenerateFirebaseCompatibility

func (g *CompatibilityGenerator) GenerateFirebaseCompatibility() string

GenerateFirebaseCompatibility creates Firebase authentication compatibility layer

func (*CompatibilityGenerator) GenerateNextAuthCompatibility

func (g *CompatibilityGenerator) GenerateNextAuthCompatibility() string

GenerateNextAuthCompatibility creates NextAuth authentication compatibility layer

func (*CompatibilityGenerator) GenerateSupabaseCompatibility

func (g *CompatibilityGenerator) GenerateSupabaseCompatibility() string

GenerateSupabaseCompatibility creates Supabase authentication compatibility layer This includes:

  • auth schema
  • auth.users table stub for foreign key references
  • Supabase roles (anon, authenticated, service_role)
  • Mock auth.uid() and auth.jwt() functions
  • Supabase Realtime publication

type ServiceType

type ServiceType string

ServiceType represents different authentication service providers

const (
	ServiceClerk    ServiceType = "clerk"
	ServiceSupabase ServiceType = "supabase"
	ServiceAuth0    ServiceType = "auth0"
	ServiceNextAuth ServiceType = "nextauth"
	ServiceFirebase ServiceType = "firebase"
)

func GetServiceFromString

func GetServiceFromString(s string) (ServiceType, error)

GetServiceFromString converts string to ServiceType

Jump to

Keyboard shortcuts

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