onelogin / drupal-saml

MIT License
14 stars 17 forks source link

Drupal 8 Support #31

Open dolceficante opened 7 years ago

dolceficante commented 7 years ago

Are there current plans to port this module for Drupal 8?

pitbulk commented 7 years ago

There is no plan right now, I can put in the queue of pending task, but cant provide a date.

safetypins commented 7 years ago

I'm going to be working on a major Drupal 8 conversion in the next year, and we'll want to include this module. So I'll be working on a Drupal 8 version of this module when that happens. I'm also not sure of a specific date.

pitbulk commented 7 years ago

Nice, let me know if you need some help related to SAML and let me know the progress.

pitbulk commented 7 years ago

We should review this: https://www.drupal.org/node/2836229

safetypins commented 7 years ago

Do you have any suggestions for testing the module in a local dev environment? Specifically, I'm wondering if there's a way to setup a test SAML Service on my laptop to send post SAML objects to my local dev web server where I'm working on the code.

safetypins commented 7 years ago

Just looked at the SAML Service Provider module, and that looks very promising.

pitbulk commented 7 years ago

You should sign for a Onelogin's developer account and configure a SAML test Connector, connecting it with the Drupal SP module.

dolceficante commented 7 years ago

Using a tool like https://ngrok.com/ will definitely help with your localhost development. It will allow you to inspect the requests back and forth from the SAML service and great for debugging a localhost (by giving you a public address that the service can call and route to your local) Good luck!

AngelAlvarado commented 7 years ago

Maybe it's over-engineering it but Simplesamlphp let's you create a local IdP or SP in a trice (in case ngrok does not work for you). If you decide to go with it, check out this tutorial.

safetypins commented 7 years ago

So, I've worked through some of the errors I found working with the SAML SP module on d.o. Now I'm getting some errors thrown by the php-saml library: sp_certs_not_found_and_required, contact_not_enought_data, organization_not_enought_data.

It turns out the security settings had been turned on (must have been enabled during install), but for some reason the author has written the settings form to always require a certificate and key file locations. Under what circumstances should the certificate and key file locations be required? Which security settings being enabled would require the certificate and key files? All, some, or is there a specific minimum settings that require settings? From looking at the php-saml library, it looks like any one of the security settings being enabled means that the library needs certificates.

As a follow up question, can I create an X.509 certificate and key on my test server that can be validated by onelogin? I've created rsa keys before, but I've never created a self-signed certificate. If it's possible, can you point me to a walkthrough?

pitbulk commented 7 years ago

SP public certificate/private key are required if the SP will use signature or encryption in the message that send. Since is not mandatory to sign/encrypt at the SP side, those valued should be optional.

In order to generate self-signed certs you can use this online tool: https://www.samltool.com/self_signed_certs.php

safetypins commented 7 years ago

Okay, So I've moved on to processing the SAML Response. But in attempting to replicate the process of the acs_consume() function from the D7 module, I've run into a problem right with how the OneLogin_Saml2_Response class is operating on the response. The saml:NameId property is being reported as empty ($auth->getNameId() returns nothing). However, when I inspect the SAML response manually I see that there is content there.

Can you think of a reason why the OneLogin_Saml2_Response class wouldn't be able to extract the NameId property value?

pitbulk commented 7 years ago

Can you provide the encoded SAMLResponse?

safetypins commented 7 years ago

PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWw9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3NlcnRpb24iIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2wiIElEPSJSZTc0MDYxMjIxODg2YzJhZTNlN2E2ZDI1YmM0ZDFhZDUzNjc1YWRmNCIgVmVyc2lvbj0iMi4wIiBJc3N1ZUluc3RhbnQ9IjIwMTctMDItMjdUMjE6NTI6MTNaIiBEZXN0aW5hdGlvbj0ie3JlY2lwaWVudH0iPjxzYW1sOklzc3Vlcj5odHRwczovL2FwcC5vbmVsb2dpbi5jb20vc2FtbC9tZXRhZGF0YS82MjgzODk8L3NhbWw6SXNzdWVyPjxzYW1scDpTdGF0dXM+PHNhbWxwOlN0YXR1c0NvZGUgVmFsdWU9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpzdGF0dXM6U3VjY2VzcyIvPjwvc2FtbHA6U3RhdHVzPjxzYW1sOkFzc2VydGlvbiB4bWxuczpzYW1sPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXNzZXJ0aW9uIiB4bWxuczp4cz0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTU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VSZXN0cmljdGlvbj48c2FtbDpBdWRpZW5jZT57YXVkaWVuY2V9PC9zYW1sOkF1ZGllbmNlPjwvc2FtbDpBdWRpZW5jZVJlc3RyaWN0aW9uPjwvc2FtbDpDb25kaXRpb25zPjxzYW1sOkF1dGhuU3RhdGVtZW50IEF1dGhuSW5zdGFudD0iMjAxNy0wMi0yN1QyMTo1MjoxMloiIFNlc3Npb25Ob3RPbk9yQWZ0ZXI9IjIwMTctMDItMjhUMjE6NTI6MTNaIiBTZXNzaW9uSW5kZXg9Il9jY2ZkYTNmMC1kZjNhLTAxMzQtMjRiYS0wYTBjNzk0Yjc2NmYiPjxzYW1sOkF1dGhuQ29udGV4dD48c2FtbDpBdXRobkNvbnRleHRDbGFzc1JlZj51cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YWM6Y2xhc3NlczpQYXNzd29yZFByb3RlY3RlZFRyYW5zcG9ydDwvc2FtbDpBdXRobkNvbnRleHRDbGFzc1JlZj48L3NhbWw6QXV0aG5Db250ZXh0Pjwvc2FtbDpBdXRoblN0YXRlbWVudD48L3NhbWw6QXNzZXJ0aW9uPjwvc2FtbHA6 UmVzcG9uc2U+Cgo=

pitbulk commented 7 years ago

I was able to decode it here: https://www.samltool.com/base64.php

And was able to get the NameID at: https://www.samltool.com/attributes.php

samltool.com uses php-saml. Have you checked that the SAMLResponse was validated correctly and the settings are ok. Aftet the processResponse, check that the getErrors method replies an empty array.

safetypins commented 7 years ago

When I was looking at the code for the response class, it looked like the "Processing" happened as part of the initialization of the SAMLResponse. Do I need to do that separately?

safetypins commented 7 years ago

$auth->getErrors() returned an empty array. Is there another place to look for errors?

pitbulk commented 7 years ago

Check this piece of code: https://github.com/onelogin/php-saml#attribute-consumer-serviceacs-endpointsacsphp

You need to initialize the auth object, call the processResponse and later check if the getErrors returns empty array.

safetypins commented 7 years ago

Great, thanks!

cweagans commented 7 years ago

You may want to be aware of https://www.drupal.org/project/samlauth