authentication

package
v0.0.0-...-a62c012 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationHandler

type AuthenticationHandler struct {
	user.UserService
	AuthenticationService
	config.Config
	*validator.Validate
}

func NewAuthenticationHandler

func NewAuthenticationHandler(userService user.UserService, authenticationService AuthenticationService, config config.Config, validate *validator.Validate) AuthenticationHandler

func (*AuthenticationHandler) Login

func (h *AuthenticationHandler) Login(ctx *gin.Context)

type AuthenticationRequest

type AuthenticationRequest struct {
	UserID                int64     `json:"userId"`
	AccessToken           string    `json:"accessToken"`
	RefreshToken          string    `json:"refreshToken"`
	AccessTokenExpiresAt  time.Time `json:"accessTokenExpiresAt"`
	RefreshTokenExpiresAt time.Time `json:"refreshTokenExpiresAt"`
}

type AuthenticationResponse

type AuthenticationResponse struct {
	AccessToken          string    `json:"accessToken"`
	RefreshToken         string    `json:"refreshToken"`
	IdToken              string    `json:"idToken"`
	AccessTokenExpiresAt time.Time `json:"accessTokenExpiresAt"`
}

type AuthenticationService

type AuthenticationService interface {
	CreateAuthentication(ctx context.Context, req AuthenticationRequest) (db.AuthenticationToken, error)
	GetByAccessToken(ctx context.Context, token string) (db.AuthenticationToken, error)
}

func NewAuthenticationService

func NewAuthenticationService(datastore db.DataStore) AuthenticationService

type AuthenticationServiceImpl

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

func (*AuthenticationServiceImpl) CreateAuthentication

func (service *AuthenticationServiceImpl) CreateAuthentication(ctx context.Context, req AuthenticationRequest) (db.AuthenticationToken, error)

func (*AuthenticationServiceImpl) GetByAccessToken

func (service *AuthenticationServiceImpl) GetByAccessToken(ctx context.Context, token string) (db.AuthenticationToken, error)

type LoginRequest

type LoginRequest struct {
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required"`
}

Uses https://github.com/go-playground/validator for validation

Jump to

Keyboard shortcuts

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