iam

package
v0.0.0-...-5c3d8b3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoggingService

type LoggingService struct {
	iam.IAM
	// contains filtered or unexported fields
}

LoggingService represents iam logging service

func NewLoggingService

func NewLoggingService(svc iam.IAM, logger twisk.Logger) *LoggingService

NewLoggingService creates new Template logging service

func (*LoggingService) Auth

func (ls *LoggingService) Auth(ctx context.Context, req *iam.AuthReq) (resp *iam.AuthResp, err error)

Auth logging

func (*LoggingService) Refresh

func (ls *LoggingService) Refresh(ctx context.Context, req *iam.RefreshReq) (resp *iam.RefreshResp, err error)

Refresh token logging

type Securer

type Securer interface {
	MatchesHash(string, string) bool
}

Securer represents password securing service

type Service

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

Service represents IAM application service

func New

func New(db *pg.DB, tg TokenGenerator, udb UserDB, sec Securer) *Service

New instantiates new IAM service

func (*Service) Auth

func (s *Service) Auth(c context.Context, req *iam.AuthReq) (*iam.AuthResp, error)

Auth tries to authenticate user given username and password

func (*Service) Refresh

func (s *Service) Refresh(c context.Context, req *iam.RefreshReq) (*iam.RefreshResp, error)

Refresh refreshes user's jwt token

type TokenGenerator

type TokenGenerator interface {
	GenerateToken(*twisk.AuthUser) (string, error)
}

TokenGenerator generates new jwt token

type UserDB

type UserDB interface {
	FindByAuth(orm.DB, string) (*twisk.User, error)
	FindByToken(orm.DB, string) (*twisk.User, error)
	UpdateLastLogin(orm.DB, *twisk.User) error
}

UserDB represents user database interface

Directories

Path Synopsis
platform

Jump to

Keyboard shortcuts

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