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

Metadata Editor: redirect to login URL if accessing the editor as anonymous user #1006

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

jahow
Copy link
Collaborator

@jahow jahow commented Sep 26, 2024

Description

This PR adds a common route guard for all routes in the ME app.

Also removed an unused component.

Architectural changes

none

Quality Assurance Checklist

  • Commit history is devoid of any merge commits and readable to facilitate reviews
  • If new logic ⚙️ is introduced: unit tests were added
  • If new user stories 🤏 are introduced: E2E tests were added
  • If new UI components 🕹️ are introduced: corresponding stories in Storybook were created
  • If breaking changes 🪚 are introduced: add the breaking change label
  • If bugs 🐞 are fixed: add the backport <release branch> label
  • The documentation website 📚 has received the love it deserves

Copy link
Contributor

github-actions bot commented Sep 26, 2024

Affected libs: ``,
Affected apps: metadata-editor,

  • 🚀 Build and deploy storybook and demo on GitHub Pages
  • 📦 Build and push affected docker images

},
],
},
{ path: 'sign-in', component: SignInPageComponent },
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this route was removed as it was obviously not needed anyway

component: DashboardPageComponent,
outlet: 'primary',
path: '',
canActivate: [AuthGuardService],
children: [
Copy link
Collaborator Author

@jahow jahow Sep 26, 2024

Choose a reason for hiding this comment

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

Adding a root route ( 🤔 ) makes it easier to apply the same guard to all routes

@coveralls
Copy link

Coverage Status

coverage: 84.949% (+3.6%) from 81.399%
when pulling 0bba5e3 on me-redirect-to-login
into f501972 on main.

Copy link
Contributor

github-actions bot commented Sep 26, 2024

📷 Screenshots are here!

it('redirects to the login page', () => {
cy.url().should(
'include',
'/catalog.signin?redirect=http://localhost:4200/catalog/search'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Out of curiosity, where does this redirect value come from? The referer? It's often needed to be redirected after successful login, but I don't see it written in our code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@LHBruneton-C2C LHBruneton-C2C left a comment

Choose a reason for hiding this comment

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

Thanks for this improvement.
There is still one corner case when the authentication might fail, when the user is already wrongly connected (XSFR cookie set on the wrong path from the legacy UI), and the redirection is not activated then.
Otherwise, all good !

@jahow jahow force-pushed the me-redirect-to-login branch from 0bba5e3 to c16c6bc Compare September 26, 2024 12:29
@jahow jahow force-pushed the me-redirect-to-login branch from c16c6bc to c95043b Compare September 26, 2024 12:58
@jahow jahow merged commit be95197 into main Sep 26, 2024
12 of 13 checks passed
@jahow jahow deleted the me-redirect-to-login branch September 26, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants