auth

package
v0.0.0-...-a667b06 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(api app.Config) auth.Service

New returns the auth service implementation.

func UserID

func UserID(ctx context.Context) uint

UserID fetch the user id from passed context

func WithUserID

func WithUserID(ctx context.Context, id uint) context.Context

WithUserID adds user id in context passed to it

Types

type Service

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

func NewService

func NewService(api app.Config, name string) *Service

func (*Service) JWTAuth

func (s *Service) JWTAuth(ctx context.Context, jwt string, scheme *security.JWTScheme) (context.Context, error)

JWTAuth implements the authorization logic for services for the "jwt" security scheme.

func (*Service) Logger

func (s *Service) Logger(ctx context.Context) *log.Logger

Logger returns a logger with "user-id" added as a field

func (*Service) User

func (s *Service) User(ctx context.Context) (*model.User, error)

User fetch user id from the passed context verfies if it exists in db returns the User object

Jump to

Keyboard shortcuts

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