jwt_

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Registered Claim Names
	ClaimsIssuer         = "iss" // RFC 7519, 4.1.1
	ClaimsSubject        = "sub" // RFC 7519, 4.1.2
	ClaimsAudience       = "aud" // RFC 7519, 4.1.3
	ClaimsExpirationTime = "exp" // RFC 7519, 4.1.4
	ClaimsNotBefore      = "nbf" // RFC 7519, 4.1.5
	ClaimsIssuedAt       = "iat" // RFC 7519, 4.1.6
	ClaimsJWTID          = "jti" // RFC 7519, 4.1.7
)

See: https://tools.ietf.org/html/rfc7519

View Source
const (
	// JOSE Header
	HeaderParameterType        = "type" // RFC 7231, 5.1
	HeaderParameterContentType = "cty"  // RFC 7231, 5.2

	// Replicating Claims as Header Parameters
	HeaderParameterIssuer         = ClaimsIssuer         // RFC 7231, 5.3 RFC 7519, 10.4.1
	HeaderParameterSubject        = ClaimsSubject        // RFC 7231, 5.3 RFC 7519, 10.4.1
	HeaderParameterAudience       = ClaimsAudience       // RFC 7231, 5.3 RFC 7519, 10.4.1
	HeaderParameterExpirationTime = ClaimsExpirationTime // RFC 7231, 5.3
	HeaderParameterNotBefore      = ClaimsNotBefore      // RFC 7231, 5.3
	HeaderParameterIssuedAt       = ClaimsIssuedAt       // RFC 7231, 5.3
	HeaderParameterJWTID          = ClaimsJWTID          // RFC 7231, 5.3
)
View Source
const (
	SigningMethodNone  = "none"
	SigningMethodHS256 = "HS256" // HS256: HMAC using SHA-256
	SigningMethodHS384 = "HS384" // HS384: HMAC using SHA-384
	SigningMethodHS512 = "HS512" // HS512: HMAC using SHA-512
	SigningMethodRS256 = "RS256" // RS256: RSASSA-PKCS-v1_5 using SHA-256
	SigningMethodRS384 = "RS384" // RS384: RSASSA-PKCS-v1_5 using SHA-384
	SigningMethodRS512 = "RS512" // RS512: RSASSA-PKCS-v1_5 using SHA-512
	SigningMethodPS256 = "PS256" // PS256: RSASSA-PSS using SHA-256 and MGF1 with SHA-256
	SigningMethodPS384 = "PS384" // PS384: RSASSA-PSS using SHA-384 and MGF1 with SHA-384
	SigningMethodPS512 = "PS512" // PS512: RSASSA-PSS using SHA-512 and MGF1 with SHA-512
	SigningMethodES256 = "ES256" // ES256: ECDSA using P-256 and SHA-256
	SigningMethodES384 = "ES384" // ES384: ECDSA using P-384 and SHA-384
	SigningMethodES512 = "ES512" // ES512: ECDSA using P-521 and SHA-512
)

https://jwt.io/

Variables

This section is empty.

Functions

func ClaimsText

func ClaimsText(name string) string

ClaimsText returns a text for the Claim Names. It returns the empty string if the code is "".

func HeaderParameterText

func HeaderParameterText(param string) string

HeaderParameterText returns a text for the Claim Names. It returns the empty string if the code is "".

Types

type AuthKey

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

func NewAuthKey

func NewAuthKey(alg string, privateKey []byte, publicKey []byte, password ...string) (*AuthKey, error)

SymmetricKey : privateKey else: privKey publicKey

func NewAuthKeyFromFile

func NewAuthKeyFromFile(alg string, privateKeyFile string, publicKeyFile string, password ...string) (*AuthKey, error)

func NewAuthKeyFromRandom

func NewAuthKeyFromRandom(alg string) (*AuthKey, error)

func (*AuthKey) GetSignedKey

func (a *AuthKey) GetSignedKey(token *jwt.Token) (interface{}, error)

func (*AuthKey) GetSignedMethod

func (a *AuthKey) GetSignedMethod() jwt.SigningMethod

func (*AuthKey) GetVerifiedKey

func (a *AuthKey) GetVerifiedKey(token *jwt.Token) (interface{}, error)

func (*AuthKey) IsECMAKey

func (a *AuthKey) IsECMAKey() bool

func (*AuthKey) IsRSAKey

func (a *AuthKey) IsRSAKey() bool

func (*AuthKey) IsSymmetricKey

func (a *AuthKey) IsSymmetricKey() bool

Jump to

Keyboard shortcuts

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