services

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

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

func NewAuthService

func NewAuthService(user *repositories.UserRepository, refreshToken *repositories.RefreshTokenRepository, accessTokenSigningKey string) *AuthService

func (*AuthService) CreateUser

func (s *AuthService) CreateUser(ctx context.Context, user *entities.User) (*entities.User, error)

func (*AuthService) GenerateTokens added in v0.1.8

func (s *AuthService) GenerateTokens(ctx context.Context, userID uuid.UUID) (*AuthTokens, error)

func (*AuthService) GenerateTokensViaCredentials

func (s *AuthService) GenerateTokensViaCredentials(ctx context.Context, username string, password string) (*AuthTokens, error)

func (*AuthService) GenerateTokensViaRefreshToken

func (s *AuthService) GenerateTokensViaRefreshToken(ctx context.Context, token string) (*AuthTokens, error)

func (*AuthService) VerifyToken

func (s *AuthService) VerifyToken(ctx context.Context, accessToken string) (*entities.UserClaims, error)

type AuthTokens

type AuthTokens struct {
	AccessToken           string
	RefreshToken          string
	AccessTokenExpiresIn  time.Duration
	RefreshTokenExpiresIn time.Duration
}

type RefreshTokenWithSecret

type RefreshTokenWithSecret struct {
	Secret string
	*entities.RefreshToken
}

Jump to

Keyboard shortcuts

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