Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow IDP to initiate login #297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

schiessle
Copy link
Member

if the user starts the login process on the IDP, we always assume that
the first configured IDP is used (this doesn't work for multiple IDP's
for now) and tries to login the user.

Steps to test:

  • Setup an IDP, e.g. onelogin
  • Go directly to the IDP (not to the Nextcloud)
  • Select there the "Nextcloud app"
  • You will be redirected to Nextcloud

-> Current behavior: You will see an error page
-> with this PR: you should be logged in

@schiessle schiessle requested a review from rullzer January 16, 2019 15:58
if the user starts the login process on the IDP, we always assume that
the first configured IDP is used (this doesn't work for multiple IDP's
for now) and tries to login the user.

Signed-off-by: Bjoern Schiessle <[email protected]>
@schiessle schiessle force-pushed the allow-to-initiate-login-from-idp branch from 1272bde to d468228 Compare January 24, 2019 15:10
@nbitouze nbitouze mentioned this pull request Apr 17, 2019
@nbitouze
Copy link

Thank you for this PR, we would be interested in this!

There is a related discussion at #208. It is suggested that the @OnlyUnauthenticatedUsers annotation be removed from assertionConsumerService() to avoid getting a "User is already logged in" error.

I am also wondering whether the SAML best practice for the $this->session->set('user_saml.OriginalUrl', $this->request->getParam('originalUrl', '')); functionality would be to use a request parameter (as in the current pull request) or an SAML attribute (like $auth->getAttribute('originalUrl').

@kvn
Copy link

kvn commented Feb 12, 2020

@blizzz can we help to get this reviewed and merged? IdP initiated login is currently broken. Many thanks!

@mateuszdrab
Copy link

Just like @kvn, I'd like to add myself to this request.

Copy link
Member

@blizzz blizzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard coded ID 1 looks suspicious to me, otherwise 💄

Comment on lines 245 to +246
$idp = $this->session->get('user_saml.Idp');
$idp = $idp === null ? 1 : $idp;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$idp = $this->session->get('user_saml.Idp');
$idp = $idp === null ? 1 : $idp;
$idp = $this->session->get('user_saml.Idp') ?: 1;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not assume that 1 is always a valid id.

@@ -243,11 +243,17 @@ public function getMetadata($idp) {
public function assertionConsumerService() {
$AuthNRequestID = $this->session->get('user_saml.AuthNRequestID');
$idp = $this->session->get('user_saml.Idp');
$idp = $idp === null ? 1 : $idp;
$auth = new Auth($this->SAMLSettings->getOneLoginSettingsArray($idp));

if(is_null($AuthNRequestID) || $AuthNRequestID === '' || is_null($idp)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_null($idp) will now never be true, can be removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants