Fix cookie check with yunohost on subdomain of other yunohost #233
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.
Problem
In case we have one yunohost instance on a subdomain of an other yunohost instance we have a cookie issue with SSOWAT. Note that this issue don't happen with the Yunohost portal API.
By example we have have one yunohost on example.com and an other on hello.example.com.
In this case, the browser will send 2 cookie for the key yunohost.portal. One for the domain '.example.com' and an other one for '.hello.example.com'.
Currently ssowat check the only first cookie, if the first one is the correct one it's good but it could also be the second and in this case the authentication fail.
Step to reproduce the issue
example.com
.sub.example.com
.sub.example.com
instance.example.com
and onsub.example.com
.sub.example.com
.You will see that you are redirected to the portal and you can't access to my_webapp because ssowat consider you are not authenticated because it check the wrong cookie. But the yunohost portal API check the good one so you can see the portal.
Expected
After the authentication you should be able to access to my_webapp.