Documentation ¶
Index ¶
- func AuthenticateJWTMiddleware(next http.Handler, secretKey string) http.Handler
- func AuthenticateJWTToken(secretKey string, req *http.Request) (map[string]interface{}, error)
- func Decrypt(encryptedKey []byte) ([]byte, error)
- func EncodeJWT(secretKey string, claims Claims) (string, error)
- func Encrypt(key []byte) ([]byte, error)
- func ExtractJWTToken(req *http.Request) (string, error)
- func NewRandomKey() []byte
- type Claims
- type StandardClaims
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateJWTMiddleware ¶
AuthenticateJWTMiddleware wraps AuthenticateJWTToken to provide middleware this is just an example to show how it can be used as a middleware
func AuthenticateJWTToken ¶
AuthenticateJWTToken is the main function to verify the JWT token from a request and it returns the claims
func EncodeJWT ¶
EncodeJWT serialize data into a jwt token using a secret This secret must match with the client's secret who's generating the token
func Encrypt ¶
Encrypt will encrypt a raw string to an encrypted value an encrypted value has an IV (nonce) + actual encrypted value when we decrypt, we only decrypt the latter part
func ExtractJWTToken ¶
ExtractJWTToken extracts bearer token from Authorization header
Types ¶
type StandardClaims ¶
type StandardClaims jwt.StandardClaims
StandardClaims wraps jwt standard claims type