V14: Untangle the preview functionality from the auth cookie#16308
Merged
iOvergaard merged 11 commits intoMay 17, 2024
Merged
Conversation
Migaroez
approved these changes
May 17, 2024
Contributor
There was a problem hiding this comment.
Works as described.
Made a few minor improvements
- Log the error in debug mode when the trycatch fails in UserBasedPreviewTokenGenerator.VerifyAsync
- Since the tokengenerator can fail to generate, it seems better to bubble this up instead of swallowing it, even if our implementation is unlikely to do it.
- Return an attempt instead of nullable object for TryGetPreviewClaimsIdentityAsync
Contributor
|
Remember to update the OpenAPI.json file, gents 😎 |
…eathttps/localhost44339/ure/untagle-preview-cookie-from-auth-cookie
…/untagle-preview-cookie-from-auth-cookie' into v14/feathttps/localhost44339/ure/untagle-preview-cookie-from-auth-cookie # Conflicts: # tests/Umbraco.Tests.Integration/ManagementApi/Preview/EnterPreviewTests.cs
Contributor
|
Nice catch on the httpOnly check in the test and updating the delete requirement! |
Contributor
Apparently, we made the same fixes, so my changes ended up not doing much at all in the end. But it's looking great now! |
…eathttps/localhost44339/ure/untagle-preview-cookie-from-auth-cookie
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.
Description
This PR redo how the preview cookie works, because it cannot get the auth cookie, as that is not long living.
Instead the preview cookie, saves a user key in an encrypted way (using IDateProtector). This user key is then used on preview requests to look up and ensure the user is still valid (approved and not locked out).
If the user is valid it is added to as a principal like before.
Test