Problem/motivation
We have multilingual (negotiated by URL prefixes) site with URLs:
- www.example.com
- www.example.com/fi
- www.example.com/sv
- www.example.com/mypage
- www.example.com/fi/mypage
- www.example.com/sv/mypage
When I try this module with non-default language, I get an error from IdP stating that endpoint is not allowed. This is due to the metadata generation we used, that is generated with the active language.
However, ideally we would not specify each language as separate SPs for the IdP. Ideally we would specify allowed endpoints.
After reading through documentation for metadata document I found out that you may specify multiple elements for <md:SingleLogoutService> and <md:AssertionConsumerService> (that contains Location attribute).
These elements allows us to specify multiple endpoints for single SP and therefore allowing us to specify endpoints for each enabled language in Drupal.
Proposed solution
When having multiple langauges and generating <md:SingleLogoutService> and <md:AssertionConsumerService> elements to the metadata, loop over each language and generate element with each language.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | samlauth-2848809-15-2.x.patch | 1.95 KB | akalam |
| #13 | 22848809-login-logout-multilinual-fails-13-3.x.patch | 1.56 KB | roderik |
| #12 | 2848809-login-logout-multilinual-fails-12.patch | 1.68 KB | lpeabody |
Comments
Comment #2
imiksuAnd right after posting, I realised that generation was not overridden by this module. The original generation comes from the library directly. I'll rephrase this issue in their issue queue.
Comment #3
imiksuIssue posted in onelogin/php-saml.
Comment #4
imiksuOr unless, we start override those classes and implement it in the Drupal module?
Comment #5
roderikJust an attempt to summarize so far:
* so you suggest having multiple endpoints for the same SP, instead of having each language as separate SPs.
* pitbulk, in the github thread, suggests the opposite.
So far I can't work out a reason for preferring one over the other. But also... I can't work out a reason for having several URLs at all.
Here is my thought: your different-language websites don't care what "language" your SP is, do they? (All they do is direct you to the same URL at the IDP.) So your URLs should just always be www.example.com/saml/login, www.example.com/saml/acs, etc - regardless of language. And yes, after we get back, we may indeed need to do redirection to different pages... but I'm not sure that should be solved by having separate SP endpoints. Maybe we can take this up in #2670118: Make getPostLoginDestination / getPostLogoutDestination configurable - though I admit I don't know exactly how, yet.
If that's not true / you disagree: please enlighten me.
If that is true, then we need to see how to force those URLs, regardless of language. Unfortunately I still have quite little real world D8 experience, but reading UrlGenerator::generateFromRoute() leads me to believe we might be able to do something with 'path_processing' -- like adding the following to all /saml/ paths in samlauth.routing.yml:
(Example found in system.routing.yml, for update.php.)
Comment #6
imiksuAfter giving thoughts on your comments, I would like to get some more comments if this is really an issue in the end. But here's my comments:
I can think of multidomain sites, for instance different branding/categorisation for each domain. However, the proposed solution in this case wouldn't fit in that case.
You can work lot with the login/logout destinations and I've already have proven that you can go pretty advanced there with #2670118: Make getPostLoginDestination / getPostLogoutDestination configurable, but if you need to code to achieve your constraints that are presented by Drupal core multilingualism, I think it's not fear for site builders.
This sounds interesting, maybe this could help. As a matter of fact, I was first trying to look something like this in the first place, but failed to find this.
Comment #7
roderikI should have said "I can't work out a reason for having several
URLspaths". The multidomain case is still covered with the proposed solution.I hope you can try out the 'path_processing' sometime because I don't have a multilingual site yet.
As far as the logout destination goes... you're right about this not being fair to site owners. My feeling says "have a plugin architecture, and include a plugin for common multilngual scenario". I hope I will have time to test that before DDD Seville, but that will be latest.
Comment #8
roderikI'm wrong about the plugin architecture; that is overkill. I think a (relative) URL with token replacement is probably better suited for login/logout destinations - this can be discussed further in #2670118: Make getPostLoginDestination / getPostLogoutDestination configurable.
Until now I'm still fairly convinced that a single SP endpoint at the 'URL root' can be OK.
Comment #9
lpeabody commentedFollowing up on this because this is still an issue that multilingual sites are facing when using samlauth. I agree that it makes no sense to apply path processing to any of samlauth's /saml routing paths. Would be a pretty simple test, though admittedly I have no clue how to set this up locally to test with.
Comment #10
lpeabody commentedComment #11
lpeabody commentedComment #12
lpeabody commentedUploaded patch applies to 2.0-alpha1, but not 2.x-dev. I can at least confirm that I'm able to login/logout when the default language has a URL prefix configured for it. Need others to review and verify though.
Comment #13
roderikThanks. Here's a patch that applies to 3.x-dev. (Verified that it makes sense to apply path processing to these routes.)
I haven't tested this myself yet though, so I might let this stew for a bit (until someone else tests too, and/or I have an idea about how I can arrange automated tests).
Comment #14
lpeabody commentedI can confirm that the 3.x patch fixes this issue on multilingual sites using non-blank prefixes on all languages.
Comment #15
akalam commentedThe patch on #12 does not apply to the 2.x-dev version. Here there is a patch that applyes.
Comment #16
andypostComment #17
andypostComment #19
roderikThank you and sorry that it had to take so long before this was committed. This was the most significant outstanding issue in this module.