Drupal 7 redirect after authenticating via simplesamlphp

76 views
Skip to first unread message

adam.b...@uk.coop

unread,
Feb 6, 2018, 8:02:07 AM2/6/18
to SimpleSAMLphp
Hi all.

Not sure if it fully applies to this forum but need a bit of assistance with Simplesamlphp.

I have installed and configured simplesamlphp on my Drupal 7 website by installing and configuring simplesaml in the root directory, I have also installed the simplesamlphp_auth module in Drupal 7. 

On my website the user must authenticate themselves via Simplesaml to be able to gain access to a members area.

Currently the user can login via a 'federated login' and is authenticated successfully but they are redirected to a default 'user details' page.

What I actually need is for the user to be redirected to the members area as soon as they have logged in.

Is there a bit of code I should be changing in the simplesaml Drupal 7 module for it to point to the members area after login?

All help is welcome.  Thanks in advanced.

Ed van Leeuwen

unread,
Feb 12, 2018, 1:52:08 PM2/12/18
to SimpleSAMLphp
I think I experience the same problem. I am trying to authenticate Nextcloud to Drupal. When I access the Nextcloud-page, it is redirected properly to the Drupal login page.

After entering the account details, the account page is shown in stead of returning to the Nextcloud instance.

In the Drupal watchdog, I have noted the following:

Notice: Undefined variable: attributes in sspmod_drupalauth_Auth_Source_External->getUser() (regel 289 van /var/simplesamlphp/modules/drupalauth/lib/Auth/Source/External.php).

Could this be related? If not, what am I missing?

Peter Schober

unread,
Feb 13, 2018, 3:44:09 PM2/13/18
to SimpleSAMLphp
* Ed van Leeuwen <ewavan...@gmail.com> [2018-02-12 19:52]:
> I think I experience the same problem. I am trying to authenticate
> Nextcloud to Drupal. When I access the Nextcloud-page, it is redirected
> properly to the Drupal login page.

With Drupal being the IDP using some SimpleSAMLphp code, and Nextcloud
as an SP, using whatever SAML implementation they added?

> After entering the account details, the account page is shown in
> stead of returning to the Nextcloud instance.

What "the account page"? From Drupal?

> In the Drupal watchdog, I have noted the following:
>
> *Notice*: Undefined variable: attributes in
> *sspmod_drupalauth_Auth_Source_External->getUser()* (regel *289* van
> */var/simplesamlphp/modules/drupalauth/lib/Auth/Source/External.php*).
>
> Could this be related? If not, what am I missing?

Note that the drupalauth module https://github.com/Sanchiz/drupalauth
for SimpleSAMLphp is not distributed (or supported) by the
SimpleSAMLphp project. Still people on this list might be able to
help, of course.

Did you perform the required setup in config/authsources.php mentioned
in the https://github.com/Sanchiz/drupalauth/blob/master/README.md as
well as in the comments near the beginnig of this file?
https://github.com/Sanchiz/drupalauth/blob/master/lib/Auth/Source/External.php

-peter

Ed van Leeuwen

unread,
Feb 18, 2018, 9:33:06 AM2/18/18
to SimpleSAMLphp


Op dinsdag 13 februari 2018 21:44:09 UTC+1 schreef Peter Schober:
With Drupal being the IDP using some SimpleSAMLphp code, and Nextcloud
as an SP, using whatever SAML implementation they added?

It is an additonal module (https://apps.nextcloud.com/apps/user_saml), which says:

The following providers are supported and tested at the moment:

  • SAML 2.0

    • OneLogin
    • Shibboleth
    • Active Directory Federation Services (ADFS)
  • Authentication via Environment Variable

    • Kerberos (mod_auth_kerb)
    • Any other provider that authenticates using the environment variable
 
 

> After entering the account details, the account page is shown in
> stead of returning to the Nextcloud instance.

What "the account page"? From Drupal?

Yes.
 

> In the Drupal watchdog, I have noted the following:
>
> *Notice*: Undefined variable: attributes in
> *sspmod_drupalauth_Auth_Source_External->getUser()* (regel *289* van
> */var/simplesamlphp/modules/drupalauth/lib/Auth/Source/External.php*).
>
> Could this be related? If not, what am I missing?

Note that the drupalauth module https://github.com/Sanchiz/drupalauth
for SimpleSAMLphp is not distributed (or supported) by the
SimpleSAMLphp project. Still people on this list might be able to
help, of course.

Did you perform the required setup in config/authsources.php mentioned
in the https://github.com/Sanchiz/drupalauth/blob/master/README.md as
well as in the comments near the beginnig of this file?
https://github.com/Sanchiz/drupalauth/blob/master/lib/Auth/Source/External.php

Yes, the configuration is set up according to these instructions.in he SimplaeSAML config, the authorization sources are visible.
 

James Juopperi

unread,
Feb 23, 2018, 1:26:09 PM2/23/18
to SimpleSAMLphp
Not sure if you were able to solve the user being directed to the user profile page after logging in
in to drupal using simplesamlphp, but below is how I redirect the user after login.

It can be accomplished using the trigger module (drupal 7 core module)

After enabling the trigger module (can't remember if it is enabled by default)

Navigate to admin/config/system/actions

Create an andvanced action to "Redirect to URL"
-- Set the URL to the page that you want the user redirected.

Navigate to admin/structure/trigger/user

Assign the action you created above to the trigger "AFTER A USER HAS LOGGED IN"

Once the trigger is in place a user should be redirected to the URL you set in the "action"

Reply all
Reply to author
Forward
0 new messages