authtoken

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package authtoken creates JWT tokens to secure the websockets connections

Index

Constants

View Source
const (

	// DefaultExpiry for the auth token
	DefaultExpiry = maxExpiry
)

Variables

This section is empty.

Functions

func Create

func Create(user string, s time.Duration) string

Create a new token, that uses a short lifetime, think one request. WARNING: It should only be used to establish the websocket connection once, because we can't revoke and don't check for deleted users.

Types

type EpinioClaims

type EpinioClaims struct {
	jwt.RegisteredClaims
	Username string `json:"user"`
}

EpinioClaims are the values we store in the JWT

func Validate

func Validate(t string) (*EpinioClaims, error)

Validate makes sure the token is created by and not expired

Jump to

Keyboard shortcuts

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