auth

package
v0.0.0-...-43028c6 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticationHook

func AuthenticationHook(strategies ...string) feathers.Hook

func Configure

func Configure(app *feathers.App, config map[string]interface{}) error

func HashPassword

func HashPassword(field string) feathers.Hook

HashPassword is a hool which hashes the password in the given field using bcrypt. If the field is not set or cannot be converted a error is retunred

func NewModel

func NewModel() interface{}

func Uuid4

func Uuid4() string

Types

type AuthService

type AuthService struct {
	*feathers.BaseService
	*feathers.ModelService
	// contains filtered or unexported fields
}

func NewAuthService

func NewAuthService(app *feathers.App, strategies map[string]AuthStrategy) *AuthService

func (*AuthService) Create

func (as *AuthService) Create(ctx context.Context, data map[string]interface{}, params feathers.Params) (interface{}, error)

func (*AuthService) DefaultConfig

func (as *AuthService) DefaultConfig() DefaultAuthConfig

func (*AuthService) Find

func (as *AuthService) Find(ctx context.Context, params feathers.Params) (interface{}, error)

func (*AuthService) Get

func (as *AuthService) Get(ctx context.Context, id string, params feathers.Params) (interface{}, error)

func (*AuthService) Patch

func (as *AuthService) Patch(ctx context.Context, id string, data map[string]interface{}, params feathers.Params) (interface{}, error)

func (*AuthService) Remove

func (as *AuthService) Remove(ctx context.Context, id string, params feathers.Params) (interface{}, error)

Remove TODO Add implementation

func (*AuthService) Update

func (as *AuthService) Update(ctx context.Context, id string, data map[string]interface{}, params feathers.Params) (interface{}, error)

type AuthStrategy

type AuthStrategy interface {
	Authenticate(ctx context.Context, data Model, params feathers.Params) (map[string]interface{}, error)
	SetApp(app *feathers.App)
	SetName(name string)
	SetConfiguration(config map[string]interface{})
}

type BaseAuthStrategy

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

func NewBaseAuthStrategy

func NewBaseAuthStrategy(name string, app *feathers.App) *BaseAuthStrategy

func (*BaseAuthStrategy) Config

func (bas *BaseAuthStrategy) Config(key string) (interface{}, bool)

func (*BaseAuthStrategy) DefaultConfig

func (bas *BaseAuthStrategy) DefaultConfig() DefaultAuthConfig

func (*BaseAuthStrategy) EntityService

func (bas *BaseAuthStrategy) EntityService() (feathers.Service, bool)

func (*BaseAuthStrategy) SetApp

func (bas *BaseAuthStrategy) SetApp(app *feathers.App)

func (*BaseAuthStrategy) SetConfiguration

func (bas *BaseAuthStrategy) SetConfiguration(config map[string]interface{})

func (*BaseAuthStrategy) SetName

func (bas *BaseAuthStrategy) SetName(name string)

func (*BaseAuthStrategy) StrategyConfig

func (bas *BaseAuthStrategy) StrategyConfig(config interface{}) error

type DefaultAuthConfig

type DefaultAuthConfig struct {
	Entity string `mapstructure:"entity" default:"entity"`
	Secret string `mapstructure:"secret"`
}

type JwtStrategy

type JwtStrategy struct {
	*BaseAuthStrategy
}

func NewJwtStrategy

func NewJwtStrategy() *JwtStrategy

func (*JwtStrategy) Authenticate

func (s *JwtStrategy) Authenticate(ctx context.Context, data Model, params feathers.Params) (map[string]interface{}, error)

type Model

type Model struct {
	Strategy string                 `mapstructure:"strategy" validate:"required"`
	Params   map[string]interface{} `mapstructure:",remain"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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