Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractTokenFromBearerHeader(token string) []byte
- func GenerateNewPrivateKey(alg model.TokenSignatureAlgorithm) (interface{}, error)
- func LoadPrivateKeyFromPEMFile(file string) (interface{}, model.TokenSignatureAlgorithm, error)
- func LoadPrivateKeyFromPEMString(s string) (interface{}, model.TokenSignatureAlgorithm, error)
- func LoadPublicKeyFromPEM(file string) (interface{}, model.TokenSignatureAlgorithm, error)
- func LoadPublicKeyFromString(s string) (interface{}, model.TokenSignatureAlgorithm, error)
- func Make64ColsString(slice []byte) string
- func MarshalPrivateKeyToPEM(key interface{}) (string, error)
- func MarshalPublicKeyToPEM(key interface{}) (string, error)
- func ParseTokenWithPublicKey(t string, publicKey interface{}) (model.Token, error)
Constants ¶
View Source
const TokenHeaderKeyPrefix = "BEARER "
TokenHeaderKeyPrefix is a token prefix regarding RFCXXX.
Variables ¶
View Source
var ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
View Source
var TimeFunc = time.Now
TimeFunc provides the current time when parsing token to validate "exp" claim (expiration time). You can override it to use another time value. This is useful for testing or if your server uses a time zone different from your tokens'.
Functions ¶
func ExtractTokenFromBearerHeader ¶
ExtractTokenFromBearerHeader extracts token from the Bearer token header value.
func GenerateNewPrivateKey ¶
func GenerateNewPrivateKey(alg model.TokenSignatureAlgorithm) (interface{}, error)
func LoadPrivateKeyFromPEMFile ¶
func LoadPrivateKeyFromPEMFile(file string) (interface{}, model.TokenSignatureAlgorithm, error)
LoadPrivateKeyFromPEM loads private key from PEM file.
func LoadPrivateKeyFromPEMString ¶
func LoadPrivateKeyFromPEMString(s string) (interface{}, model.TokenSignatureAlgorithm, error)
func LoadPublicKeyFromPEM ¶
func LoadPublicKeyFromPEM(file string) (interface{}, model.TokenSignatureAlgorithm, error)
LoadPublicKeyFromPEM loads public key from file
func LoadPublicKeyFromString ¶
func LoadPublicKeyFromString(s string) (interface{}, model.TokenSignatureAlgorithm, error)
LoadPublicKeyFromString loads public key from string.
func Make64ColsString ¶
func MarshalPrivateKeyToPEM ¶
func MarshalPublicKeyToPEM ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.