Problem/motivation

We have multilingual (negotiated by URL prefixes) site with URLs:

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.

Comments

iMiksu created an issue. See original summary.

imiksu’s picture

Status: Active » Postponed

And 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.

imiksu’s picture

Issue posted in onelogin/php-saml.

imiksu’s picture

Status: Postponed » Active

Or unless, we start override those classes and implement it in the Drupal module?

roderik’s picture

Just 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:

  options:
    default_url_options:
      path_processing: FALSE

(Example found in system.routing.yml, for update.php.)

imiksu’s picture

After 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:

But also... I can't work out a reason for having several URLs at all.

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.

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

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.

believe we might be able to do something with 'path_processing' -- like adding the following to all /saml/ paths in samlauth.routing.yml:

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.

roderik’s picture

I should have said "I can't work out a reason for having several URLs paths". 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.

roderik’s picture

I'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.

lpeabody’s picture

Following 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.

lpeabody’s picture

Version: 8.x-2.0-alpha0 » 8.x-2.0-alpha1
lpeabody’s picture

Assigned: Unassigned » lpeabody
lpeabody’s picture

Assigned: lpeabody » Unassigned
Status: Active » Needs review
StatusFileSize
new1.68 KB

Uploaded 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.

roderik’s picture

Version: 8.x-2.0-alpha1 » 8.x-3.x-dev
StatusFileSize
new1.56 KB

Thanks. 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).

lpeabody’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm that the 3.x patch fixes this issue on multilingual sites using non-blank prefixes on all languages.

akalam’s picture

StatusFileSize
new1.95 KB

The patch on #12 does not apply to the 2.x-dev version. Here there is a patch that applyes.

andypost’s picture

Issue tags: +Needs upgrade path
Parent issue: » #3098165: Path to beta release
andypost’s picture

Issue tags: +Needs tests

  • roderik committed 8699557 on 8.x-3.x authored by lpeabody
    Issue #2848809 by lpeabody: Login/logout fails with non-default language...
roderik’s picture

Status: Reviewed & tested by the community » Fixed

Thank you and sorry that it had to take so long before this was committed. This was the most significant outstanding issue in this module.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.