oauth2

package
v0.0.0-...-e4f806a Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyJWKS error = errors.New("JWKS is empty")
View Source
var ErrInvalidFingerprint error = errors.New("invalid key fingerprint")
View Source
var ErrInvalidKeyType error = errors.New("invalid key type, must be RSA or EC")

Functions

func GenerateJWT

func GenerateJWT(oauth2jose *OAuth2Jose, claims *TokenClaims) jwt.Builder

func LoadOAuth2JoseFromURL

func LoadOAuth2JoseFromURL(oauth2jose *OAuth2Jose) error

func SetupOAuth2Jose

func SetupOAuth2Jose(oauth2jose *OAuth2Jose) error

Types

type JWKS

type JWKS struct {
	Keys []jose.JSONWebKey `json:"keys"`
}

type OAuth2Jose

type OAuth2Jose struct {
	Options     *Options
	Fingerprint string
	RSAKey      *rsa.PrivateKey
	ECDSAKey    *ecdsa.PrivateKey
	JWK         *jose.JSONWebKey
	JWKS        []byte
	SigningKey  *jose.SigningKey
	Signer      jose.Signer
	Logger      *logrus.Logger
}

type Options

type Options struct {
	PrivateKeyPath     string
	PrivateKeyPassword string
	JWKSURL            string
}

type TokenClaims

type TokenClaims struct {
	*jwt.Claims
	Scope  string `json:"scope,omitempty"`
	Kid    string `json:"kid,omitempty"`
	Tenant string `json:"tenant,omitempty"`
}

func DecodeJWT

func DecodeJWT(oauth2jose *OAuth2Jose, tokenStr string) (*TokenClaims, error)

Jump to

Keyboard shortcuts

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