auth

package
v0.0.0-...-1969f72 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUserResolver

func CreateUserResolver(_ context.Context, userInput model.UserInput) (*model.AuthData, error)

func JwtValidate

func JwtValidate(stringToken string, env *env.Env) (*jwt.Token, error)

****** Method to validate and return *jwt.Token pointer

func LoginWithEmailAndPasswordResolver

func LoginWithEmailAndPasswordResolver(_ context.Context, email string, password string) (*model.AuthData, error)

Types

type Repository

type Repository interface {
	SigninWithEmailAndPassword(email string, password string) (string, error)
	SignupWithEmailAndPassword(entities.User) (string, error)
	RestoreAccount(email string) error
}

Repository interface allows us to access the CRUD Operations in mongo here.

func NewRepo

func NewRepo(pgClient *pg.PgClient, env *env.Env) Repository

NewRepo is the single instance repo that is being created.

type Service

type Service interface {
	LoginWithEmailAndPassword(email string, password string) (string, error)
	RegisterWithEmailAndPassword(user entities.User) (string, error)
	RestoreAccount(email string) error
}

Service is an interface from which our api module can access our repository of all our models

func New

func New(pgClient *pg.PgClient, env *env.Env) Service

New is used to create a Router & single instance of the service

func NewService

func NewService(r Repository) Service

NewService is used to create a single instance of the service

type SessionClaims

type SessionClaims struct {
	Iss   uuid.UUID `json:"iss"`
	Email string    `json:"email"`
	Exp   int64     `json:"exp"`
	jwt.RegisteredClaims
}

Types definitions

type SessionKeyString

type SessionKeyString string

Session key type

Jump to

Keyboard shortcuts

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