tokenizer

package
v0.0.1-alpha5 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisClient

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

RedisClient holds our redis connexion

func NewRedisClient

func NewRedisClient(config *context.Config) *RedisClient

NewRedisClient creates a new redis connexion

func (*RedisClient) GenerateToken

func (client *RedisClient) GenerateToken(userID string) (string, error)

GenerateToken generate a random string

func (*RedisClient) GetUserID

func (client *RedisClient) GetUserID(token string) (string, error)

GetUserID token retrieves the value of the token from our storage

func (*RedisClient) Ping

func (client *RedisClient) Ping() (string, error)

Ping pings redis to see if we are connected

type Strategy

type Strategy interface {
	GenerateToken(userID string) (string, error)
	GetUserID(token string) (string, error)
}

Strategy holds our strategies

type Tokenizer

type Tokenizer struct {
	Strategy Strategy
}

Tokenizer holds the strategy

func (*Tokenizer) GenerateToken

func (t *Tokenizer) GenerateToken(userID string) (string, error)

GenerateToken return our GenerateToken strategy

func (*Tokenizer) GetUserID

func (t *Tokenizer) GetUserID(token string) (string, error)

GetUserID return our GetUserID strategy

Jump to

Keyboard shortcuts

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