server

package
v0.0.0-...-5f73fe0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TRACE_NAME = "server"

	ERROR_StoreTokenToRedis          = "cannot store token to redis: %v"
	ERROR_MakeAccessToken            = "make access token: %v"
	ERROR_MakeRefreshToken           = "make refresh token: %v"
	ERROR_RefreshTokenNotFound       = "refresh token not found"
	ERROR_TokenNotFound              = "token not found"
	ERROR_ProvideAnyField            = "provide any field"
	ERROR_CannotDeleteTokenFromRedis = "cannot delete token from redis. Error: %v"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessClaims

type AccessClaims struct {
	UUID       string     `json:"session"`
	UserClaims UserClaims `json:"user_claims"`
	jwt.RegisteredClaims
}

type AuthTokens

type AuthTokens struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type RefreshClaims

type RefreshClaims struct {
	AccessUUID  string     `json:"access_uuid"`
	RefreshUUID string     `json:"refresh_uuid"`
	UserClaims  UserClaims `json:"user_claims"`
	jwt.RegisteredClaims
}

type Server

type Server struct {
	jwt_gRPC.UnimplementedAuthenticationServer
	// contains filtered or unexported fields
}

func New

func New(
	log *logger.Logger,
	config *config.AppConfig[time.Duration],
	r *redis.Client,
	public, private []byte,
) *Server

func (*Server) CreateTokens

func (*Server) GetUserId

func (*Server) RefreshTokens

func (*Server) RevokeTokens

type UserClaims

type UserClaims = map[string]string

Jump to

Keyboard shortcuts

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