{"modulePath":"github.com/vcabbage/kit","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package jwt\n\n## Constants\n\n```go\nconst (\n\t// JWTTokenContextKey holds the key used to store a JWT Token in the\n\t// context.\n\tJWTTokenContextKey contextKey = \"JWTToken\"\n\n\t// JWTClaimsContextKey holds the key used to store the JWT Claims in the\n\t// context.\n\tJWTClaimsContextKey contextKey = \"JWTClaims\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\t// ErrTokenContextMissing denotes a token was not passed into the parsing\n\t// middleware's context.\n\tErrTokenContextMissing = errors.New(\"token up for parsing was not passed through the context\")\n\n\t// ErrTokenInvalid denotes a token was not able to be validated.\n\tErrTokenInvalid = errors.New(\"JWT Token was invalid\")\n\n\t// ErrTokenExpired denotes a token's expire header (exp) has since passed.\n\tErrTokenExpired = errors.New(\"JWT Token is expired\")\n\n\t// ErrTokenMalformed denotes a token was not formatted as a JWT token.\n\tErrTokenMalformed = errors.New(\"JWT Token is malformed\")\n\n\t// ErrTokenNotActive denotes a token's not before header (nbf) is in the\n\t// future.\n\tErrTokenNotActive = errors.New(\"token is not valid yet\")\n\n\t// ErrUnexpectedSigningMethod denotes a token was signed with an unexpected\n\t// signing method.\n\tErrUnexpectedSigningMethod = errors.New(\"unexpected signing method\")\n)\n```\n\n## Functions\n\n```go\nfunc FromGRPCContext() grpc.ClientRequestFunc\n```\nFromGRPCContext moves JWT token from context to grpc metadata. Particularly useful for clients.\n\n```go\nfunc FromHTTPContext() http.RequestFunc\n```\nFromHTTPContext moves JWT token from context to request header. Particularly useful for clients.\n\n```go\nfunc NewParser(keyFunc jwt.Keyfunc, method jwt.SigningMethod, claims jwt.Claims) endpoint.Middleware\n```\nNewParser creates a new JWT token parsing middleware, specifying a jwt.Keyfunc interface, the signing method and the claims type to be used. NewParser adds the resulting  claims to endpoint context or returns error on invalid token. Particularly useful for servers.\n\n```go\nfunc NewSigner(kid string, key []byte, method jwt.SigningMethod, claims jwt.Claims) endpoint.Middleware\n```\nNewSigner creates a new JWT token generating middleware, specifying key ID, signing string, signing method and the claims you would like it to contain. Tokens are signed with a Key ID header (kid) which is useful for determining the key to use for parsing. Particularly useful for clients.\n\n```go\nfunc ToGRPCContext() grpc.ServerRequestFunc\n```\nToGRPCContext moves JWT token from grpc metadata to context. Particularly userful for servers.\n\n```go\nfunc ToHTTPContext() http.RequestFunc\n```\nToHTTPContext moves JWT token from request header to context. Particularly useful for servers.\n\n","path":"github.com/vcabbage/kit/auth/jwt","name":"jwt","synopsis":"","isRedistributable":true}
