question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider adding a TokenType property to SecurityTokenDescriptor

See original GitHub issue

When creating an encrypted JWT using the CreateToken(SecurityTokenDescriptor tokenDescriptor) API, the headers added to SecurityTokenDescriptor.AdditionalHeaderClaims are only used for the JWE container and not the JWS. If you want to assign the JWS a specific typ, you must first create an unencrypted token with AdditionalHeaderClaims populated and then encrypt it manually, potentially with AdditionalHeaderClaims populated too if you want both the JWE and the JWS to have a typ header.

This procedure is a bit counter-intuitive and frankly error-prone. Things would be much simpler if SecurityTokenDescriptor had a TokenType property that would be used when creating both the JWS and the JWE.

/cc @brentschmaltz @mafurman

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
brentschmaltzcommented, May 4, 2020

@kevinchalet good idea. I marked this for 6.6.0.

0reactions
brentschmaltzcommented, Aug 24, 2020

Yep, overthinking it. We can cover it in comments.

@kevinchalet thanks for your help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SecurityTokenDescriptor.TokenType Property
Gets or sets the token type. If provided, this will be added as the value for the 'typ' header parameter. In the case...
Read more >
JWT token exception in ASP.Net (Lifetime validation failed. ...
So, I ended up not using the SecurityTokenDescriptor class because it expects DateTime objects to be assigned to Expirs and IssuedAt , or ......
Read more >
Spring Boot Token based Authentication with Spring ...
Configure Spring Datasource, JPA, App properties. Under src/main/resources folder, open application.properties, add some new lines. For PostgreSQL spring.
Read more >
netFramework/System.IdentityModel.Tokens.Jwt.xml 3.2.0
<param name="tokenType"> will be added as the value for the 'typ' claim in the ... Gets the key identifier for the security key...
Read more >
Tokens
Describes the types of tokens related to identity and authentication and how they are used by Auth0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found