hooks

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMFAHookRejectionMessage      = "Further MFA verification attempts will be rejected."
	DefaultPasswordHookRejectionMessage = "Further password verification attempts will be rejected."
)
View Source
const (
	// In Miliseconds
	DefaultTimeout = 2000
)
View Source
const (
	HookRejection = "reject"
)

Hook Names

View Source
const MinimumViableTokenSchema = `` /* 1019-byte string literal not displayed */

#nosec

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenClaims

type AccessTokenClaims struct {
	jwt.RegisteredClaims
	Email                         string                 `json:"email"`
	Phone                         string                 `json:"phone"`
	AppMetaData                   map[string]interface{} `json:"app_metadata"`
	UserMetaData                  map[string]interface{} `json:"user_metadata"`
	Role                          string                 `json:"role"`
	AuthenticatorAssuranceLevel   string                 `json:"aal,omitempty"`
	AuthenticationMethodReference []models.AMREntry      `json:"amr,omitempty"`
	SessionId                     string                 `json:"session_id,omitempty"`
	IsAnonymous                   bool                   `json:"is_anonymous"`
}

AccessTokenClaims is a struct thats used for JWT claims

type AuthHookError

type AuthHookError struct {
	HTTPCode int    `json:"http_code,omitempty"`
	Message  string `json:"message,omitempty"`
}

func (*AuthHookError) Error

func (a *AuthHookError) Error() string

type CustomAccessTokenInput

type CustomAccessTokenInput struct {
	UserID               uuid.UUID          `json:"user_id"`
	Claims               *AccessTokenClaims `json:"claims"`
	AuthenticationMethod string             `json:"authentication_method"`
}

type CustomAccessTokenOutput

type CustomAccessTokenOutput struct {
	Claims    map[string]interface{} `json:"claims"`
	HookError AuthHookError          `json:"error,omitempty"`
}

func (*CustomAccessTokenOutput) Error

func (ca *CustomAccessTokenOutput) Error() string

func (*CustomAccessTokenOutput) IsError

func (ca *CustomAccessTokenOutput) IsError() bool

type HTTPHookInput

type HTTPHookInput interface {
	IsHTTPHook()
}

type HookOutput

type HookOutput interface {
	IsError() bool
	Error() string
}

type HookType

type HookType string
const (
	PostgresHook HookType = "pg-functions"
)

type MFAVerificationAttemptInput

type MFAVerificationAttemptInput struct {
	UserID     uuid.UUID `json:"user_id"`
	FactorID   uuid.UUID `json:"factor_id"`
	FactorType string    `json:"factor_type"`
	Valid      bool      `json:"valid"`
}

type MFAVerificationAttemptOutput

type MFAVerificationAttemptOutput struct {
	Decision  string        `json:"decision"`
	Message   string        `json:"message"`
	HookError AuthHookError `json:"error"`
}

func (*MFAVerificationAttemptOutput) Error

func (*MFAVerificationAttemptOutput) IsError

func (mf *MFAVerificationAttemptOutput) IsError() bool

type PasswordVerificationAttemptInput

type PasswordVerificationAttemptInput struct {
	UserID uuid.UUID `json:"user_id"`
	Valid  bool      `json:"valid"`
}

type PasswordVerificationAttemptOutput

type PasswordVerificationAttemptOutput struct {
	Decision         string        `json:"decision"`
	Message          string        `json:"message"`
	ShouldLogoutUser bool          `json:"should_logout_user"`
	HookError        AuthHookError `json:"error"`
}

func (*PasswordVerificationAttemptOutput) Error

func (*PasswordVerificationAttemptOutput) IsError

type SMS

type SMS struct {
	OTP     string `json:"otp,omitempty"`
	SMSType string `json:"sms_type,omitempty"`
}

TODO(joel): Move this to phone package

type SendEmailInput

type SendEmailInput struct {
	User      *models.User     `json:"user"`
	EmailData mailer.EmailData `json:"email_data"`
}

type SendEmailOutput

type SendEmailOutput struct {
	HookError AuthHookError `json:"error,omitempty"`
}

func (*SendEmailOutput) Error

func (cs *SendEmailOutput) Error() string

func (*SendEmailOutput) IsError

func (cs *SendEmailOutput) IsError() bool

type SendSMSInput

type SendSMSInput struct {
	User *models.User `json:"user,omitempty"`
	SMS  SMS          `json:"sms,omitempty"`
}

type SendSMSOutput

type SendSMSOutput struct {
	HookError AuthHookError `json:"error,omitempty"`
}

func (*SendSMSOutput) Error

func (cs *SendSMSOutput) Error() string

func (*SendSMSOutput) IsError

func (cs *SendSMSOutput) IsError() bool

Jump to

Keyboard shortcuts

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