authentication

package
v0.0.0-...-0ac0b20 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CookieName = "Helios_Authorization"

CookieName is the name of the cookie that contains the JWT token

View Source
const HeaderName = "Helios-Jwt-Assertion"

HeaderName is the name of the cookie that contains the JWT token

Variables

View Source
var ErrUnauthorized = errors.New("unauthorized request")

ErrUnauthorized is returned by the middleware when a request is not authorized

Functions

func IssueJWTWithSecret

func IssueJWTWithSecret(secret, email string, expires time.Time) (string, error)

IssueJWTWithSecret issues and sign a JWT with a secret

func ValidateJWTWithSecret

func ValidateJWTWithSecret(secret, tokenString string) bool

ValidateJWTWithSecret checks JWT signing algorithm as well the signature

Types

type Helios

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

Helios represents a middleware instance that can authenticate requests

func NewHeliosAuthentication

func NewHeliosAuthentication(provider providers.OAuth2Provider, jwtSecret string, jwtExpiration time.Duration) Helios

NewHeliosAuthentication creates a new authentication middleware instance

func (Helios) CallbackHandler

func (helios Helios) CallbackHandler(w http.ResponseWriter, r *http.Request)

CallbackHandler handles OAuth2 callback flow

func (Helios) Logout

func (helios Helios) Logout(w http.ResponseWriter, r *http.Request)

func (Helios) Middleware

func (helios Helios) Middleware(next http.Handler) http.Handler

Middleware checks if a request is authentic

type JWTConfig

type JWTConfig struct {
	Secret     string
	Expiration time.Duration
}

JWTConfig JWT configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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