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.

Add ability to add custom TokenReplayValidator or TokenReplayCache

See original GitHub issue

@Revsgaard

I reviewed the code in Saml2ResponseSecurityTokenHandler.cs although there is a DetectReplayedTokens config setting that gets into the TokenValidationParametes, the default behavior for token replay validation is to bypass the validation if there are no validators and no token replay cache is set.

However there is no way the code lets you set those values, they are not exposed anywhere.

if (TokenValidationParameters.ValidateTokenReplay)
{      
    ValidateTokenReplay(saml2SecurityToken.Assertion.Conditions.NotBefore, tokenString, TokenValidationParameters); 
}

There is no way I could set the Replay cache or validator in the TokenValidationParameters as it is not exposed anywhere. So, the DetectReplayedTokens setting is of not much help.

This method in SAML2Request.cs needs an update?

public static Saml2IdentityConfiguration GetIdentityConfiguration(Saml2Configuration config)

Thanks for your work on the library and any insight into this issue.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Revsgaardcommented, Mar 9, 2021

The feature is released in version 4.4.0-beta1. Please let me know if it works for you.

0reactions
Revsgaardcommented, Mar 9, 2021

Thank you for your reply and the ITokenReplayCache implementation. Maybe I can use it at some point or someone else.

I’ll release the change sune either in an ordinary version or beta version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add ability to add custom TokenReplayValidator or ...
Add ability to add custom TokenReplayValidator or TokenReplayCache. ... bypass the validation if there are no validators and no token replay cache is...
Read more >
c# - .Net Core API JWT Token Validation
Add custom validation to JWT token for ASP.NET Core? ... How to validate JWT Token in aspnet.core web api? 1 · JWT Token...
Read more >
TokenValidationParameters Class
Gets or sets the IDictionary<TKey,TValue> that contains a collection of custom key/value pairs. This allows addition of parameters that could be used in...
Read more >
Add custom information in Access tokens
We are facing a specific scenario in the application where we have to add custom information to an access token. I have read...
Read more >
Customize tokens returned from Okta with custom claims
This guide explains how you can add custom claims to ID tokens and access ... Move on to the section for the claim...
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