service

package
v0.0.0-...-c0ea003 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	Role   string
	UserID string
	jwt.StandardClaims
}

type GatewayService

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

func (*GatewayService) ActivateUser

func (k *GatewayService) ActivateUser(userId string) error

This wrapper is almost too thin

func (*GatewayService) Authorize

func (k *GatewayService) Authorize(resource string, method string, tokenString string) bool

func (*GatewayService) AuthorizeWithoutToken

func (k *GatewayService) AuthorizeWithoutToken(resource string, method string) bool

func (*GatewayService) RegisterUser

func (k *GatewayService) RegisterUser(userData models.UserRegistration) (int, error)

RegisterUser Deprecated

func (*GatewayService) RenewToken

func (k *GatewayService) RenewToken(refreshToken string) string

func (*GatewayService) ValidateToken

func (k *GatewayService) ValidateToken(tokenString string) (jwt.Claims, error)

func (*GatewayService) VerifyUser

func (k *GatewayService) VerifyUser(tokenString string) (bool, error)

type IGatewayService

type IGatewayService interface {
	// Validate a user-token
	ValidateToken(token string) (jwt.Claims, error)

	// Authorize a user to a certain resource
	Authorize(resource string, method string, token string) bool

	// AuthorizeWithoutToken is for guest users
	AuthorizeWithoutToken(resource string, method string) bool

	// Activate a user. This is done by the url given on Email
	ActivateUser(userId string) error

	// If a user does not exist in the database, make it
	VerifyUser(tokenString string) (bool, error)
}

func NewGatewayService

func NewGatewayService(
	storageAdapter persist.Adapter,
	userRepository repository.IUserServiceRepository,
	authenticationProvider string,
) IGatewayService

type VerificationClaims

type VerificationClaims struct {
	jwt.StandardClaims
	UserID string
}

Jump to

Keyboard shortcuts

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