iamserver

package
v0.0.0-...-eb9f531 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthInterceptor

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

func NewAuthInterceptor

func NewAuthInterceptor(jwt *jwt.JWT, acc *access.AccessConfig) *AuthInterceptor

func (*AuthInterceptor) Unary

func (interceptor *AuthInterceptor) Unary() grpc.UnaryServerInterceptor

type LoggingService

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

LoggingService represents iam logging service

func NewLoggingService

func NewLoggingService(svc iam.ResonateIAMServer, logger model.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(*model.AuthUser) (string, error)
}

TokenGenerator generates new jwt token

type UserDB

type UserDB interface {
	FindByAuth(orm.DB, string) (*model.User, error)
	FindByToken(orm.DB, string) (*model.User, error)
	UpdateLastLogin(orm.DB, *model.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