Skip to content

feat: Add helpers for setting typ and cty header parameters#498

Open
Arabasta wants to merge 1 commit into
golang-jwt:mainfrom
Arabasta:main
Open

feat: Add helpers for setting typ and cty header parameters#498
Arabasta wants to merge 1 commit into
golang-jwt:mainfrom
Arabasta:main

Conversation

@Arabasta

@Arabasta Arabasta commented Mar 7, 2026

Copy link
Copy Markdown

Currently applications must mutate the Token.Header map directly to set header parameters typ RFC7519 Section 5.1 and cty RFC7519 Section 5.2.

Example:

    token.Header["typ"] = "JWT"

This PR adds helper methods:

    token.SetType("at+jwt")
    token.SetContentType("JWT")

These modify Token.Header internally and do not change signing or validation behavior.

This improves discoverability for these registered header parameters.

Happy to adjust naming or placement if a different approach is preferred.

Closes #497

Related discussion: #238

@Arabasta Arabasta requested review from mfridman and oxisto as code owners March 7, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add helpers for setting typ and cty header parameters

1 participant