auth

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Unlicense Imports: 10 Imported by: 0

Documentation

Overview

Package auth provides authentication and authorization middleware for HTTP handlers.

Index

Constants

View Source
const (
	// AccessTokenCookieName is the name of the access token cookie.
	AccessTokenCookieName = "wits-access-token"
	// RefreshTokenCookieName is the name of the refresh token cookie.
	RefreshTokenCookieName = "wits-refresh-token"
	// WitsSessionName is the name of the session cookie.
	WitsSessionName = "wits-session"
)

Variables

This section is empty.

Functions

func EchoJWTConfig

func EchoJWTConfig() echojwt.Config

EchoJWTConfig returns the configuration for the echo-jwt middleware.

func SignToken

func SignToken(user types.AuthenticatedUser, secret []byte) (string, error)

SignToken signs a JWT token for the given user with the specified secret.

Types

type WitsCustomClaims

type WitsCustomClaims struct {
	Email string `json:"email"`
	jwt.RegisteredClaims
}

WitsCustomClaims are custom claims extending default ones. See https://github.com/golang-jwt/jwt for more examples

Jump to

Keyboard shortcuts

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