On our platform, we're using only external credentials and no on-site credentials, so it would be beneficial if we could initiate log-in via links instead of having to display the provider form in a block. This would allow, for example, the display of "log-in now" / "sign-up now" images/ads/etc shown to anonymous users to initiate log-in through an external IdP with no pause in flow (e.g. having to take the user to the log-in page just so they click on a button to log-in through a third party).
#3011413: Autologin when one client enabled makes a similar request, but handles it differently -- in that scenario, the goal is for a single-provider configuration to automatically initiate log-in through that provider. This request is different in that it does not preclude the possibility that there are several providers configured, allowing the providers to be triggered via URLs tailored for each specific provider. In this way, it's similar to the kc_idp_hint parameter Keycloak supports for identity brokering, as I mentioned in comment #7 on the other issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 3030651-url-initiated-login-19.patch | 16.83 KB | pfrilling |
| #3 | openid_connect-add_url_initiated_provider_login_support-3030651-3-7.x.patch | 9.36 KB | guypaddock |
Issue fork openid_connect-3030651
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
guypaddock commentedI know that policy tends to be that new features have to start on 8.x and be back-ported to 7.x. Unfortunately, we aren't developing here on 7.x yet and we needed this feature for 7.x. So, attached, please find a patch for 7.x.
I'm not marking the issue as "Needs review" since I don't have an 8.x patch.
Comment #3
guypaddock commentedRealized that the previous patch broke account linking (i.e. linking an existing account to an external account).
The revised patch is attached, along with an interdiff.
Comment #4
leeomaraDo you think that this feature should follow (or support) the Initiating Login from a Third Party spec from OpenID Connect Core? From my reading, it looks like the Relying Party (Drupal) would need to accept an
issURL parameter (the full URL of the OpenID Provider) at the login initiation endpoint.Comment #5
pfrillingAttached is a patch that follows the specifications from OpenID Connect Core for the 8.x branch.
Let me know if you have any changes/questions/thoughts.
Comment #6
pfrillingI made a few adjustments to the patch in #5 to allow for extending the controller class a little easier.
Comment #7
pfrillingRe-rolled the patch and updated the session unit test.
Comment #8
jcnventuraThe use of Nullable parameters forces this to specify a minimum version of php to >=7.1 in the module's composer.json.
Comment #9
sorinb commented@pfrilling was this tested by any chance with OKTA provider?
I get a redirect to: openid-connect/okta?iss=https%3A%2F%2Fdigital-phoenix.okta.com
And it results in you're not authorized to access this page.
Just curious if you're by any chance trying with same provider I do?
Comment #10
jedihe commentedComment #11
jedihe commentedRe-rolled #7 onto 2.x. Pushed to MR, and I'm also attaching the patch. No idea if it's possible to generate an interdiff, given how many little things changed from 1.x to 2.x.
#8 is already resolved in branch 2.x.
Comment #12
jedihe commentedI was not able to test properly, as I don't yet know how to set the 'state' token. My attempts seemed to trigger a forbidden AccessResult.
Will now open the MR to trigger tests, including a new commit I pushed after #11.
Comment #14
jedihe commentedThis is the important @todo:
Comment #15
jcnventura@jedihe, any chance I can ask for you to adapt this to the latest code? The merge request doesn't seem to be applicable anymore.
And I've been changing a lot of stuff that probably has an impact on this code. If you manage to get it to work again, I think this would be a nice feature to have.
Regarding the @todo.. Yes, 2.x is the one to favor. The 1.x version will not get any new features anymore.
Comment #16
jedihe commentedHi @jcnventura! I'm quite busy right now, but if I manage to find some time for contribution, I'll be looking into this one :).
Comment #17
jedihe commentedHi @jcnventura! I managed to update the MR branch with current 2.x and get the unit tests passing (including the new one). I also tried to update some code in OpenIDConnectRedirectController, but I didn't actually test if the various controller methods in it continue working fine.
So, the MR was updated with latest work in 2.x branch, but manual testing is now needed to verify it works and no regressions were introduced.
Comment #18
turneyj commentedAny updates on this MR?
Comment #19
pfrillingI was able to get this patch to apply against the 2.x branch and confirm that it is working with Okta as the IDP. I manually tested logging in from Drupal and also logging in from Okta and both directions seem to be working well. I re-worked the target_link_uri logic and confirm that is working too.
Let me know if you'd like me to force push these changes to the merge request branch that @jedihe created.
Comment #20
joelsteidl commented#19 is doing the trick for me. It took me a moment to figure out I was putting the iss querystring param in the wrong place.
Comment #21
pfrillingThanks for the review @joelsteidl. Marking this as RTBC.
Comment #23
pfrillingLooks good. Merged.
Comment #25
rroblik commentedThanks for the work but lack of documentation ...
How to get the OID login url and/or the Response object to use it in a custom event subscriber ?