authutil

package module
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

README

auth

go auth module

Documentation

Index

Constants

View Source
const (
	AuthUtilErrorHttpHeaderAuthorizationInvalid = "http header: Authorization's value invalid"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

func (*Auth) Init

func (auth *Auth) Init(publicKeyFilePath string, privateKeyFilePath string) error

func (*Auth) InitForAuth added in v1.0.8

func (auth *Auth) InitForAuth(publicKeyFilePath string) error

func (*Auth) Middleware

func (auth *Auth) Middleware() func(http.Handler) http.Handler

func (*Auth) SignToken

func (auth *Auth) SignToken(userId string, expireDuration time.Duration) (jwtToken string, err error)

func (*Auth) UserFromJwt

func (auth *Auth) UserFromJwt(tokenString string) (user *User, err error)

type User

type User struct {
	Id    string `json:"id"`
	Token string
}

func GetUser

func GetUser(ctx context.Context) (*User, error)

Jump to

Keyboard shortcuts

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