[MGNLSSO-162] The SSO module doesn't consider the context path ot the default base URL Created: 29/Jul/22  Updated: 16/Feb/23  Resolved: 03/Aug/22

Status: Closed
Project: Single Sign On
Component/s: None
Affects Version/s: 2.0.5
Fix Version/s: 3.0.0, 2.0.6

Type: Bug Priority: Major
Reporter: Adrien Manzoni Assignee: Mikaël Geljić
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: SSO maintenance
Story Points: 1
Team: AdminX

 Description   

Steps to reproduce

  1. Configure a base URL with a context path (ie: https://dev.parkwood.magnolia-platform.com/author)
  2. In the config.yml, define the callbackURL relative (ie: /.auth)
  3. The module will build a full callback url like 
    https://dev.parkwood.magnolia-platform.com/.auth
    instead of https://dev.parkwood.magnolia-platform.com/author/.auth

Expected results

https://dev.parkwood.magnolia-platform.com/author/.auth

Actual results

https://dev.parkwood.magnolia-platform.com/.auth

Workaround

Use the absolute URL to define the callbackURL but that makes the yaml file environment dependent

Development notes

Line of code : https://git.magnolia-cms.com/projects/ENTERPRISE/repos/magnolia-sso/browse/magnolia-sso/src/main/java/info/magnolia/sso/Pac4jConfigProvider.java#330



 Comments   
Comment by Mikaël Geljić [ 29/Jul/22 ]

Found another workaround meanwhile: set callbackUrl without leading slash .auth AND set defaultBaseUrl with trailing slash .../author/

This is caused by peculiarities within the URL class itself, which is mostly implemented according to RFC2396:

If the spec's path component [the relative path in our case] begins with a slash character "/" then the path is treated as absolute and the spec path replaces the context path.

And likewise according to the RFC if the path is relative, merging begins after the last slash in the base URL. .../author is understood as a file so it tries to resolve from its parent directory.

Comment by Mikaël Geljić [ 02/Aug/22 ]

As you said nguyen.phung :bow: —I removed SSO from changelogs so the Magnolia Release field is no longer confusing.

Comment by Viet Nguyen [ 02/Aug/22 ]

Thanks all

Generated at Mon Feb 12 10:51:41 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.