You are here

README.txt in SAML Service Provider 8.2

SAML Service Provider
=====================

This package provides two modules:
- SAML Service Provider API
- SAML Drupal Login


The API module lets other modules leverage SAML authentication.

The SAML Drupal Login module specifically enables Drupal to become a "Service
Provider" for an IDP, so users can authenticate to Drupal (without entering a
username or password) by delegating authenticate to a SAML IDP (Identity
Provider).


Dependencies
============
Requires the OneLogin SAML-PHP toolkit which is managed by composer.

You can either manually require the module with composer:
    composer config repositories.drupal composer https://packages.drupal.org/8
    composer require drupal/saml_sp
to have composer download the module and the library. Or you can download the
module manually modify the core composer.json, change this section
    {
      "extra": {
        "_readme": [
          "By default Drupal loads the autoloader from ./vendor/autoload.php.",
          "To change the autoloader you can edit ./autoload.php."
        ],
        "merge-plugin": {
            "include": [
            "core/composer.json",
            "modules/saml_sp/composer.json" // <-- add this line
          ],
          "recurse": false,
          "replace": false,
          "merge-extra": false
        }
      },
    }
to add the modules/saml_sp/composer.json and run
    composer update
this will cause the library to be downloaded and added to your composer autoload.php


TODO
====
For the 8.x-2.x version there are a number of items that are still incomplete
- Single Log Out (SLO)
- updating Drupal account with attributes from the IdP

SimpleSamlPHP Configuration
===========================

First, configure your IdP in Drupal:
Note: Multiple IdPs can be configured, but only one is chosen to be used for the
Drupal login. This is good for development purposes, because different
environments (local, development, staging, production etc.) can be configured
with different App names and exported to code with Features. Then each
environment chooses a different IdP configuration for the Drupal login.

Name = Human readable name for IdP.

App Name: will be used in the IdP configuration. For example
"demoLocalDrupal".

NameID field: this defaults to user mail and works for most configurations. In
that case the IdP is configure to use email address for NameID.
But if you need to support changing email on the IdP, then you need to add
a custom field to user profile and then choose that field here. It is
recommended to use "Hidden Field Widgets" module (https://www.drupal.org/project/hidden_field)
for that field so that users don't need to worry about it, ever.

IDP Login URL: e.g. http:///myIdp.example.com/simplesaml/saml2/idp/SSOService.php
IDP Logout URL: e.g. http:///myIdp.example.com/simplesaml/saml2/idp/SingleLogoutService.php

x.509 certificate: Should correspond to the "certificate" field in
saml20-idp-hostd.php

Here's a sample config for saml20-sp-remote.php (when email is used for NameID):

$metadata['demoLocalDrupal'] = array(
'AssertionConsumerService' => 'http://mydrupal.example.com/drupal7/?q=saml/consume',
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:email',
'simplesaml.nameidattribute' => 'uid',
'simplesaml.attributes' => FALSE,
);

Usage
=====

When everything is set and ready to go, the process begins from
http://www.yoursite.com/saml/drupal_login

A returnTo parameter can be appended to the url, if you want to redirect
the user somewhere else than the front page after login. For example the user
profile page http://www.yoursite.com/saml/drupal_login?returnTo=user

The login block and user login form will show a link with
"Log in using Single Sign-On" text on it. The user login page will return the
user to the profile page and the login block will return the user to the same page
where the login process was started from.

File

README.txt
View source
  1. SAML Service Provider
  2. =====================
  3. This package provides two modules:
  4. - SAML Service Provider API
  5. - SAML Drupal Login
  6. The API module lets other modules leverage SAML authentication.
  7. The SAML Drupal Login module specifically enables Drupal to become a "Service
  8. Provider" for an IDP, so users can authenticate to Drupal (without entering a
  9. username or password) by delegating authenticate to a SAML IDP (Identity
  10. Provider).
  11. Dependencies
  12. ============
  13. Requires the OneLogin SAML-PHP toolkit which is managed by composer.
  14. You can either manually require the module with composer:
  15. composer config repositories.drupal composer https://packages.drupal.org/8
  16. composer require drupal/saml_sp
  17. to have composer download the module and the library. Or you can download the
  18. module manually modify the core composer.json, change this section
  19. {
  20. "extra": {
  21. "_readme": [
  22. "By default Drupal loads the autoloader from ./vendor/autoload.php.",
  23. "To change the autoloader you can edit ./autoload.php."
  24. ],
  25. "merge-plugin": {
  26. "include": [
  27. "core/composer.json",
  28. "modules/saml_sp/composer.json" // <-- add this line
  29. ],
  30. "recurse": false,
  31. "replace": false,
  32. "merge-extra": false
  33. }
  34. },
  35. }
  36. to add the modules/saml_sp/composer.json and run
  37. composer update
  38. this will cause the library to be downloaded and added to your composer autoload.php
  39. TODO
  40. ====
  41. For the 8.x-2.x version there are a number of items that are still incomplete
  42. - Single Log Out (SLO)
  43. - updating Drupal account with attributes from the IdP
  44. SimpleSamlPHP Configuration
  45. ===========================
  46. First, configure your IdP in Drupal:
  47. Note: Multiple IdPs can be configured, but only one is chosen to be used for the
  48. Drupal login. This is good for development purposes, because different
  49. environments (local, development, staging, production etc.) can be configured
  50. with different App names and exported to code with Features. Then each
  51. environment chooses a different IdP configuration for the Drupal login.
  52. Name = Human readable name for IdP.
  53. App Name: will be used in the IdP configuration. For example
  54. "demoLocalDrupal".
  55. NameID field: this defaults to user mail and works for most configurations. In
  56. that case the IdP is configure to use email address for NameID.
  57. But if you need to support changing email on the IdP, then you need to add
  58. a custom field to user profile and then choose that field here. It is
  59. recommended to use "Hidden Field Widgets" module (https://www.drupal.org/project/hidden_field)
  60. for that field so that users don't need to worry about it, ever.
  61. IDP Login URL: e.g. http:///myIdp.example.com/simplesaml/saml2/idp/SSOService.php
  62. IDP Logout URL: e.g. http:///myIdp.example.com/simplesaml/saml2/idp/SingleLogoutService.php
  63. x.509 certificate: Should correspond to the "certificate" field in
  64. saml20-idp-hostd.php
  65. Here's a sample config for saml20-sp-remote.php (when email is used for NameID):
  66. $metadata['demoLocalDrupal'] = array(
  67. 'AssertionConsumerService' => 'http://mydrupal.example.com/drupal7/?q=saml/consume',
  68. 'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:email',
  69. 'simplesaml.nameidattribute' => 'uid',
  70. 'simplesaml.attributes' => FALSE,
  71. );
  72. Usage
  73. =====
  74. When everything is set and ready to go, the process begins from
  75. http://www.yoursite.com/saml/drupal_login
  76. A returnTo parameter can be appended to the url, if you want to redirect
  77. the user somewhere else than the front page after login. For example the user
  78. profile page http://www.yoursite.com/saml/drupal_login?returnTo=user
  79. The login block and user login form will show a link with
  80. "Log in using Single Sign-On" text on it. The user login page will return the
  81. user to the profile page and the login block will return the user to the same page
  82. where the login process was started from.