auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

func New

func New(cfg Config) *Auth

New builds a new auth struct for handling JWT tokens.

func (*Auth) GenerateJWT

func (a *Auth) GenerateJWT(username string, password string) (string, time.Time, error)

GenerateJWT creates a new JWT token.

func (*Auth) ParseJWT

func (a *Auth) ParseJWT(tokenString string) (string, string, error)

ParseJWT gets a token string and extracts the data.

type Config

type Config struct {
	PrivateKey string `koanf:"private_key"`
	ExpireTime int    `koanf:"expire_time"`
}

Config stores data for jwt tokens.

Jump to

Keyboard shortcuts

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