utils

package
v0.0.0-...-ee9e9f6 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2016 License: GPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePassword

func ComparePassword(a, b []byte) bool

Function used to compare the password hash

Types

type EasyJWT

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

The signer need to know the secret

func NewEasyJWT

func NewEasyJWT(secret []byte) *EasyJWT

Return a new signer gived the secret. This signer use the HS256 method.

func (*EasyJWT) Sign

func (ejwt *EasyJWT) Sign(s *SessionToken) (string, error)

Sign a new token and return the corrisponding jwt string.

func (*EasyJWT) Validate

func (ejwt *EasyJWT) Validate(tokenString string) (*SessionToken, error)

Parse and validate a jwt from his string

type SessionToken

type SessionToken struct {
	UserId      string
	Code        string
	SessionType string
}

Struct tha t holds the token informations

Jump to

Keyboard shortcuts

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