tokenauth

package module
v0.4.16 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 5

README

README

This README would normally document whatever steps are necessary to get your application up and running.

What is this repository for?
How do I get set up?
  • Summary of set up
  • Configuration
  • Dependencies
  • Database configuration
  • How to run tests
  • Deployment instructions
Contribution guidelines
  • Writing tests
  • Code review
  • Other guidelines
Who do I talk to?
  • Repo owner or admin
  • Other community or team contact

Documentation

Index

Constants

View Source
const TokenDataContextKey = "tokenData"

Variables

This section is empty.

Functions

func CheckTokenMiddleware

func CheckTokenMiddleware(baseToken TokenBase) gin.HandlerFunc

Types

type RefreshToken

type RefreshToken struct {
	IssuedAt *time.Time
	UsedAt   *time.Time
}

type TokenBase

type TokenBase interface {
	CreateTokensPair(c context.Context, now time.Time, sessionId string, customerId string, protectedData map[string]interface{}, plainData map[string]interface{}) (string, string, error)
	ValidateAndGetData(c context.Context, now time.Time, token string) (map[string]interface{}, map[string]interface{}, error)
	ValidateAndUseRefreshToken(c context.Context, now time.Time, token string) (map[string]interface{}, map[string]interface{}, error)
	RemoveRefreshToken(c context.Context, now time.Time, token string) error
	RemoveRefreshTokenById(c context.Context, id string) error
}

func NewJwtToken

func NewJwtToken(credentials credentials.CredentialsGetter, cacheGetter cache.CacheStorageGetter, cacheSetter cache.CacheStorageSetter) TokenBase

Jump to

Keyboard shortcuts

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