auth

package
v0.0.0-...-b033284 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWT

type JWT interface {
	GenerateToken(*model.User) (string, string, error)
}

JWT represents jwt interface

type Service

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

Service represents the auth application service

func NewAuthService

func NewAuthService(userRepo model.UserRepo, accountRepo model.AccountRepo, jwt JWT, m mail.Service, mob mobile.Service) *Service

NewAuthService creates new auth service

func (*Service) Authenticate

func (s *Service) Authenticate(c context.Context, email, password string) (*model.AuthToken, error)

Authenticate tries to authenticate the user provided by username and password

func (*Service) Mobile

func (s *Service) Mobile(c *gin.Context, m *request.MobileSignup) error

Mobile returns any error from creating a new user in our database with a mobile number

func (*Service) MobileVerify

func (s *Service) MobileVerify(c context.Context, countryCode, mobile, code string, signup bool) (*model.AuthToken, error)

MobileVerify verifies the mobile verification code, i.e. (6-digit) code

func (*Service) Refresh

func (s *Service) Refresh(c context.Context, refreshToken string) (*model.RefreshToken, error)

Refresh refreshes jwt token and puts new claims inside

func (*Service) Signup

func (s *Service) Signup(c *gin.Context, e *request.EmailSignup) error

Signup returns any error from creating a new user in our database

func (*Service) User

func (s *Service) User(c *gin.Context) *model.AuthUser

User returns user data stored in jwt token

func (*Service) Verify

func (s *Service) Verify(c context.Context, token string) error

Verify verifies the (verification) token and deletes it

Jump to

Keyboard shortcuts

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