jwe

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: Apache-2.0 Imports: 11 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOriginRefererMismatch = errors.New("origin/referer don't match target")
	ErrOriginRefererNotFound = errors.New("origin and referer not specified")
	ErrSchemeNotDefined      = errors.New("scheme not defined in X-Forwarded-Proto or in the URL")
	ErrHostNotDefined        = errors.New("host not defined in X-Forwarded-Host or Host headers")
)

Functions

func GetIP

func GetIP(r *http.Request) string

GetIP gets a requests IP address by reading off the forwarded-for header (for proxies) and falls back to use the remote address.

func GetOriginOrReferer

func GetOriginOrReferer(r *http.Request) (string, error)

func GetTarget

func GetTarget(r *http.Request) (string, error)

func ParseAndTruncateUrlToSchemeAndHost

func ParseAndTruncateUrlToSchemeAndHost(s string) (string, error)

Types

type Claims

type Claims = jwt.Claims

type ErrKeyNotFound

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

func (*ErrKeyNotFound) Error

func (e *ErrKeyNotFound) Error() string

type JWEService

type JWEService interface {
	Start(r *http.Request) (*jwt.Claims, error)

	Serialize(claims *jwt.Claims, private interface{}) (string, error)
	Parse(r *http.Request, token string, private interface{}) (*jwt.Claims, error)

	SerializeEncrypted(claims *jwt.Claims, private interface{}) (string, error)
	ParseEncrypted(r *http.Request, token string, private interface{}) (*jwt.Claims, error)
}

func NewJWEService

func NewJWEService(time stime.TimeService, expiration time.Duration, keyService webkeys.WebKeysService) JWEService

Jump to

Keyboard shortcuts

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