Add OneTimeUse support for SAML assertions#19144
Open
therepanic wants to merge 1 commit intospring-projects:mainfrom
Open
Add OneTimeUse support for SAML assertions#19144therepanic wants to merge 1 commit intospring-projects:mainfrom
therepanic wants to merge 1 commit intospring-projects:mainfrom
Conversation
This change will allow us to add `<OneTimeUse>` elements out of the box. To do this, we can pass the cache through `OpenSaml5AuthenticationProvider.AssertionValidator.Builder#replayCache` and add the condition itself directly when building the builder. I also created a package-private `SpringCacheReplayCache` that implements `ReplayCache` and is needed to work with the constructor of `OneTimeUseConditionValidator`. Closes: spring-projectsgh-19130 Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
therepanic
commented
May 2, 2026
Comment on lines
747
to
748
| this.conditions.add(new DelegationRestrictionConditionValidator()); | ||
| this.conditions.add(new ValidConditionValidator(OneTimeUse.DEFAULT_ELEMENT_NAME)); | ||
| this.conditions.add(new ProxyRestrictionConditionValidator()); |
Contributor
Author
There was a problem hiding this comment.
Given how validation works, I don't think it would be a bad idea to move the logic for adding OneTimeUse.DEFAULT_ELEMENT_NAME into the build method itself
therepanic
commented
May 2, 2026
Comment on lines
846
to
+851
| public AssertionValidator build() { | ||
| if (this.replayCache != null) { | ||
| this.conditions | ||
| .add(new OneTimeUseConditionValidator(new SpringCacheReplayCache(this.replayCache), null)); | ||
| } | ||
| else { |
Contributor
Author
There was a problem hiding this comment.
I think we can afford to ignore null since we set the duration manually in SpringCacheReplayCache#check?
Contributor
Author
|
I left a couple of comments on topics that interest me, PTAL. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change will allow us to add
<OneTimeUse>elements out of the box. To do this, we can pass the cache throughOpenSaml5AuthenticationProvider.AssertionValidator.Builder#replayCacheand add the condition itself directly when building the builder. I also created a package-privateSpringCacheReplayCachethat implementsReplayCacheand is needed to work with the constructor ofOneTimeUseConditionValidator.Closes: gh-19130