jwt

package
v0.0.0-...-8d3e6cf Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJwtSession

func NewJwtSession(secret []byte, expire time.Duration, storage nosql.IStorage) (sessions.ISessions, error)

NewJwtSession creates new jwt storage

Types

type SessionJwt

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

SessionJwt implements storage interface using jwt-token mechanism where all optional data stored on the user side.

func (*SessionJwt) Create

func (j *SessionJwt) Create(data map[string]interface{}) (sessions.Token, error)

Create generates new jwt token and return it as a signed string

func (*SessionJwt) Delete

func (j *SessionJwt) Delete(token sessions.Token) error

Delete token associated id in storage if it present

func (*SessionJwt) Get

func (j *SessionJwt) Get(token sessions.Token) (map[string]interface{}, error)

Get validates token, checks expiration, checks storage for such token if it present and return data form given token

func (*SessionJwt) RefreshToken

func (j *SessionJwt) RefreshToken(oldToken sessions.Token) (sessions.Token, error)

RefreshToken refresh given token

Jump to

Keyboard shortcuts

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