goauth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package goauth provides adapters that wrap github.com/goliatone/go-auth repositories so they satisfy go-users interfaces without extra plumbing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserFromDomain

func UserFromDomain(user *types.AuthUser) *auth.User

UserFromDomain converts a go-users AuthUser into the upstream go-auth model.

func UserToDomain

func UserToDomain(user *auth.User) *types.AuthUser

UserToDomain converts the go-auth user model into the go-users AuthUser.

Types

type UsersAdapter

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

UsersAdapter wraps go-auth Users repositories so they satisfy the go-users AuthRepository interface.

func NewUsersAdapter

func NewUsersAdapter(repo auth.Users, opts ...UsersAdapterOption) *UsersAdapter

NewUsersAdapter builds a UsersAdapter. Callers can override the transition policy (defaults to the upstream state machine rules) with WithPolicy.

func (*UsersAdapter) AllowedTransitions

func (a *UsersAdapter) AllowedTransitions(ctx context.Context, id uuid.UUID) ([]types.LifecycleTransition, error)

AllowedTransitions reports valid target states using the configured policy.

func (*UsersAdapter) Create

func (a *UsersAdapter) Create(ctx context.Context, input *types.AuthUser) (*types.AuthUser, error)

Create delegates to go-auth's repository.

func (*UsersAdapter) GetByID

func (a *UsersAdapter) GetByID(ctx context.Context, id uuid.UUID) (*types.AuthUser, error)

GetByID loads a user by UUID.

func (*UsersAdapter) GetByIdentifier

func (a *UsersAdapter) GetByIdentifier(ctx context.Context, identifier string) (*types.AuthUser, error)

GetByIdentifier loads a user using email/username/UUID.

func (*UsersAdapter) ResetPassword

func (a *UsersAdapter) ResetPassword(ctx context.Context, id uuid.UUID, passwordHash string) error

ResetPassword delegates to the upstream repository implementation.

func (*UsersAdapter) Update

func (a *UsersAdapter) Update(ctx context.Context, input *types.AuthUser) (*types.AuthUser, error)

Update delegates to go-auth's repository.

func (*UsersAdapter) UpdateStatus

func (a *UsersAdapter) UpdateStatus(ctx context.Context, actor types.ActorRef, id uuid.UUID, next types.LifecycleState, opts ...types.TransitionOption) (*types.AuthUser, error)

UpdateStatus transitions the user to the next lifecycle state.

type UsersAdapterOption

type UsersAdapterOption func(*UsersAdapter)

UsersAdapterOption customizes adapter construction.

func WithPolicy

func WithPolicy(policy types.TransitionPolicy) UsersAdapterOption

WithPolicy overrides the default transition policy.

Jump to

Keyboard shortcuts

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