Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip reusing old token in embed mode with delegated auth #10113

Merged
merged 3 commits into from
Dec 5, 2023

Conversation

LukasHirt
Copy link
Collaborator

@LukasHirt LukasHirt commented Dec 4, 2023

Description

When Web is included in an iframe in embed mode with delegated authentication, skip reusing the old token. The parent application is responsible for handling the token and we do not really care about reloading there which the reuse seems to be intended to handle. If the old token is reused, it can lead to an error when fetching user with expired token. That will then lead to a redirect to access denied page once the delegated access_token is received.

Motivation and Context

Fixing a bug which leads to access denied page.

How Has This Been Tested?

  • test environment: local
  • test case 1: embed web in an iframe with delegated auth, postMessage with valid token, wait for the token to expire, remove the iframe, build the iframe again with expired token, postMessage with new valid token

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Open tasks:

  • add tests
  • add changelog

@LukasHirt LukasHirt added Status:In-Progress Category:Defect Existing functionality is not working as expected labels Dec 4, 2023
@LukasHirt LukasHirt self-assigned this Dec 4, 2023

This comment was marked as outdated.

@LukasHirt
Copy link
Collaborator Author

I have also added a few logs into the code so that it is easier to debug the embed mode.

@LukasHirt LukasHirt force-pushed the fix/delegate-auth-error branch from 63fcd28 to 2494d73 Compare December 4, 2023 18:26
@LukasHirt LukasHirt added Status:Needs-Review Needs review from a maintainer and removed Status:In-Progress labels Dec 4, 2023
Copy link
Member

@kulmann kulmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added two commits myself to fast-track this...
1: no extra changelog item needed as the delegated authentication was never publicly released. I just added the PR url to an existing changelog item
2: I reduced the log level of your new log messages to debug to not spam the browser console.

Otherwise perfect, thanks for jumping on this quickly 👍

@kulmann kulmann enabled auto-merge (squash) December 5, 2023 10:31
Copy link

sonarcloud bot commented Dec 5, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

53.8% 53.8% Coverage
0.0% 0.0% Duplication

@kulmann kulmann merged commit 4ffb707 into master Dec 5, 2023
4 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix/delegate-auth-error branch December 5, 2023 11:04
AlexAndBear pushed a commit that referenced this pull request Dec 13, 2023
* fix: skip reusing old token in embed mode with delegated auth

---------

Co-authored-by: Benedikt Kulmann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category:Defect Existing functionality is not working as expected Status:Needs-Review Needs review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants