MCPcopy
hub / github.com/golang-jwt/jwt / NewWithClaims

Function NewWithClaims

token.go:47–56  ·  view source on GitHub ↗

NewWithClaims creates a new [Token] with the specified signing method and claims. Additional options can be specified, but are currently unused.

(method SigningMethod, claims Claims, opts ...TokenOption)

Source from the content-addressed store, hash-verified

45// NewWithClaims creates a new [Token] with the specified signing method and
46// claims. Additional options can be specified, but are currently unused.
47func NewWithClaims(method SigningMethod, claims Claims, opts ...TokenOption) *Token {
48 return &Token{
49 Header: map[string]any{
50 "typ": "JWT",
51 "alg": method.Alg(),
52 },
53 Claims: claims,
54 Method: method,
55 }
56}
57
58// SignedString creates and returns a complete, signed JWT. The token is signed
59// using the SigningMethod specified in the token. Please refer to

Callers 1

NewFunction · 0.85

Calls 1

AlgMethod · 0.65

Tested by

no test coverage detected