sync

package
v0.45.7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package sync provides optional Auth0 user synchronization helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultUserMapper

func DefaultUserMapper(ctx context.Context, user *management.User) (*auth.User, error)

DefaultUserMapper provides a baseline Auth0 -> local user mapping.

Types

type Auth0IdentifierStore deprecated added in v0.44.0

type Auth0IdentifierStore = auth.IdentifierStore

Deprecated: use auth.IdentifierStore for provider-neutral identifier mapping.

type Config

type Config struct {
	Users           auth.Users
	IdentifierStore auth.IdentifierStore
	Provider        string
	UserMapper      UserMapper
}

Config configures the Auth0 sync service.

type IdentifierModel

type IdentifierModel = authrepo.IdentifierModel

type IdentifierStore

type IdentifierStore = authrepo.IdentifierStore

func NewIdentifierStore

func NewIdentifierStore(db *bun.DB) *IdentifierStore

type ManagementClient

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

ManagementClient wraps the Auth0 management API client.

func NewManagementClient

func NewManagementClient(ctx context.Context, cfg ManagementConfig) (*ManagementClient, error)

NewManagementClient creates a new management client wrapper.

func (*ManagementClient) GetUser

func (m *ManagementClient) GetUser(ctx context.Context, identifier string) (*management.User, error)

GetUser fetches an Auth0 user by identifier.

func (*ManagementClient) RawClient

func (m *ManagementClient) RawClient() *management.Management

RawClient exposes the underlying management client.

func (*ManagementClient) UpdateUser

func (m *ManagementClient) UpdateUser(ctx context.Context, identifier string, user *management.User) error

UpdateUser updates an Auth0 user.

type ManagementConfig

type ManagementConfig struct {
	Domain       string
	ClientID     string
	ClientSecret string
	Client       *management.Management
}

ManagementConfig configures the Auth0 management client.

type Service

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

Service synchronizes Auth0 users into the local store.

func NewService

func NewService(cfg Config) *Service

NewService creates a new sync service.

func (*Service) SyncByID

func (s *Service) SyncByID(ctx context.Context, mgmt *ManagementClient, identifier string) (*auth.User, error)

SyncByID fetches an Auth0 user and synchronizes it into the local store.

func (*Service) SyncUser

func (s *Service) SyncUser(ctx context.Context, user *management.User) (*auth.User, error)

SyncUser upserts the Auth0 user into the local user store.

type UserMapper

type UserMapper func(ctx context.Context, user *management.User) (*auth.User, error)

UserMapper maps an Auth0 management user into a local auth.User.

Jump to

Keyboard shortcuts

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