auth

package
v0.0.0-...-444ad2e Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: MIT Imports: 24 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(engine *gin.Engine, db *db.DB) (*Auth, error)

func (*Auth) GenerateTokenByUser

func (collectaAuth *Auth) GenerateTokenByUser(u *ent.Person) (string, error)

GenerateTokenByUser returns a jwt based on collecta claims

func (*Auth) Middleware

func (collectaAuth *Auth) Middleware() gin.HandlerFunc

Middleware decodes the share session cookie and packs the session into context

func (*Auth) RegisterCallbacks

func (collectaAuth *Auth) RegisterCallbacks(host string)

func (*Auth) UserOfContext

func (collectaAuth *Auth) UserOfContext(ctx context.Context) *ent.Person

UserOfContext finds the user from the context. REQUIRES Middleware to have run.

func (*Auth) VerifyJWTToken

func (collectaAuth *Auth) VerifyJWTToken(ctx context.Context, token string) (*ent.Person, error)

VerifyJWTToken is a util function to perform jwt token verification

Jump to

Keyboard shortcuts

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