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

Function signToken

parser_test.go:499–510  ·  view source on GitHub ↗

signToken creates and returns a signed JWT token using signingMethod.

(claims jwt.Claims, signingMethod jwt.SigningMethod)

Source from the content-addressed store, hash-verified

497
498// signToken creates and returns a signed JWT token using signingMethod.
499func signToken(claims jwt.Claims, signingMethod jwt.SigningMethod) string {
500 var privateKey any
501 switch signingMethod {
502 case jwt.SigningMethodRS256:
503 privateKey = jwtTestRSAPrivateKey
504 case jwt.SigningMethodES256:
505 privateKey = jwtTestEC256PrivateKey
506 default:
507 return ""
508 }
509 return test.MakeSampleToken(claims, signingMethod, privateKey)
510}
511
512func TestParser_Parse(t *testing.T) {
513 // Iterate over test data set and run tests

Callers 4

TestParser_ParseFunction · 0.70
TestSetPaddingFunction · 0.70
BenchmarkParseUnverifiedFunction · 0.70

Calls 1

MakeSampleTokenFunction · 0.92

Tested by

no test coverage detected