Top Banner
Drupal and diversity of SSO systems Drupal Cafe Kyiv, 2015 Alexander Schedrov aka sanchiz Team Lead, FFW
52
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Drupal and diversity of Single sign-on systems

Drupal and diversity of SSO systems

Drupal Cafe Kyiv, 2015

Alexander Schedrov aka sanchiz Team Lead, FFW

Page 2: Drupal and diversity of Single sign-on systems

Alexander Schedrov aka sanchiz

Team Lead, FFW (ex ProPeople)

I love Open Source

I'm contributor to Open Source

That’s why I’m here

Ukraine, Kyiv

Page 3: Drupal and diversity of Single sign-on systems

What is SSO

Single sign-on (SSO) is a session/user authentication process that permits a user to enter one name and password

in order to access multiple applications.

Page 4: Drupal and diversity of Single sign-on systems
Page 5: Drupal and diversity of Single sign-on systems

Cases when SSO is right solution

• One authentication server and one set of credentials for all services/sites

• Add new production into existing network and connect your applications together

• Share user data across services

Page 6: Drupal and diversity of Single sign-on systems

Difference

Authentication: recognizes who you are.

Authorization: know what you are allowed to do, or what you allow others to do.

Page 7: Drupal and diversity of Single sign-on systems

In most cases SSO focus only on authentication

Page 8: Drupal and diversity of Single sign-on systems

1. Shared tables and cookies

Page 9: Drupal and diversity of Single sign-on systems
Page 10: Drupal and diversity of Single sign-on systems

Implementation// Current site database. $databases['default'] = array( 'default' => array( 'database' => 'current_database', 'username' => 'root', 'password' => 'root', 'host' => '127.0.0.1', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ), );

// Primary site database with users. $databases['primary_site'] = array( 'default' => array( 'database' => 'primary_database', 'username' => 'root', 'password' => 'root', 'host' => '127.0.0.1', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ), );

settings.php:

Page 11: Drupal and diversity of Single sign-on systems

// Value: "primary_database." $shared = $databases['primary_site']['default']['database'] . '.';

// Point tables to primary site. $databases['default']['default']['prefix'] = array( 'default' => '', 'authmap' => $shared, 'sessions' => $shared, 'permissions' => $shared, 'role' => $shared, 'users' => $shared, 'users_roles' => $shared, );

$cookie_domain = '.drupal.org';

https://www.drupal.org/node/22267

settings.php:

Page 12: Drupal and diversity of Single sign-on systems

CookiesCookies and sessions stored in Drupal database

Page 13: Drupal and diversity of Single sign-on systems

Advantages• Simple configuration

• Perfectly works for SSO for drupal sites

• Sharing and syncing data (fields)

• Cookie-based default authentication system

• The same UID

Page 14: Drupal and diversity of Single sign-on systems

Limitations• The same top-level domain

• Shared database credentials

• Unexpected results, depending on which tables you choose to share

• Security issues and security holes

• Broken version updates

Page 15: Drupal and diversity of Single sign-on systems

2. Bakery Single Sign-On System

Page 16: Drupal and diversity of Single sign-on systems

Implementation

• Enable “Bakery” module as admin

• Configure master site

• Configure slave sites

https://www.drupal.org/project/bakery

Page 17: Drupal and diversity of Single sign-on systems
Page 18: Drupal and diversity of Single sign-on systems
Page 19: Drupal and diversity of Single sign-on systems

Advantages

• Simple configuration

• Sites may be on different servers/hosting service

• Cookie-based

• Good documentation(even Vagrant box)

Page 20: Drupal and diversity of Single sign-on systems

Limitations• Logins are handled by the master site only

• The same top-level domain

• No data syncing

• Different UID

• Conflicts between accounts

• No fallback for specific users

Page 21: Drupal and diversity of Single sign-on systems

3. LDAP

Page 22: Drupal and diversity of Single sign-on systems

LDAP

The Lightweight Directory Access Protocol (LDAP) project provides integration with LDAP server

for authentication, user provisioning, authorization.

https://www.drupal.org/project/ldap

Page 23: Drupal and diversity of Single sign-on systems
Page 24: Drupal and diversity of Single sign-on systems

Submodules LDAP• ldap_servers

• ldap_users

• ldap_authentication

• ldap_authorization

• ldap_sso

• ldap_feeds

• ldap_views

Page 25: Drupal and diversity of Single sign-on systems

Provisioning, CRUD

Authentication

Page 26: Drupal and diversity of Single sign-on systems

LDAP provides• Provisioning from LDAP to Drupal

• Provisioning from Drupal to LDAP

• Syncing of data

• Syncing of roles and other attributes(depends on schema)

• User binding

Page 27: Drupal and diversity of Single sign-on systems

phpLDAPadmin if you have no UI

Page 28: Drupal and diversity of Single sign-on systems

Advantages• A lot of development frameworks have

support for communication with LDAP

• Users can have complex group membership

• Integrated with Organic Groups

• You can build your own schema inside LDAP

• Flexible solution, API, docs

Page 29: Drupal and diversity of Single sign-on systems

Limitations

• Complex configuration

• Should be installed on separate server

• Very complex for small solutions

• Deployment requires some planning

Page 30: Drupal and diversity of Single sign-on systems

4. LDAP + CAS

Page 31: Drupal and diversity of Single sign-on systems

CAS

You can delegate authentication to CAS server.

It may replace Drupal authentication (ldap_authentication, ldap_authorization

and ldap_sso).

https://www.drupal.org/project/cas

https://wiki.jasig.org/display/CASC/phpCAS

Page 32: Drupal and diversity of Single sign-on systems
Page 33: Drupal and diversity of Single sign-on systems
Page 34: Drupal and diversity of Single sign-on systems

Advantages• Flexible solution

• CRUD and syncing

• CAS is the one who responsible about authentication

• You can easily change Identity Provider

• Different types of authentication: with and without redirection to dedicated page

Page 35: Drupal and diversity of Single sign-on systems

Limitations• Complex configuration, that includes LDAP

and CAS servers

• Hard to debug and find errors

• Very complex for small solutions

• Deployment requires some planning

• You need a lot of servers for development, test and production environments

Page 36: Drupal and diversity of Single sign-on systems

5. SimpleSAMLphp

Page 37: Drupal and diversity of Single sign-on systems

SimpleSAMLphpSimpleSAMLphp is an award-winning application

written in native PHP that deals with authentication and authorization.

https://www.drupal.org/project/simplesamlphp_auth

Page 38: Drupal and diversity of Single sign-on systems

Powerful and secure SAML

Security Assertion Markup Language is an XML-based, open-standard data format for exchanging authentication and authorization data between parties, in particular, between an identity provider

and a service provider.

Page 39: Drupal and diversity of Single sign-on systems

Terms

Identity Provider(IP) is responsible for providing identifiers for users looking to interact with a system and possibly providing other information about the user that

is known to the provider.

Service Provider(SP) is a system that communicate with Identity Provider and make an authentication

control.

Page 40: Drupal and diversity of Single sign-on systems
Page 41: Drupal and diversity of Single sign-on systems

Capabilities• SimpleSAMLphp has own storage for

sessions (Memcache, SQL, PHPsession)

• Work with Service Providers that supports SAML.

• Work with many Identity Providers and with IPs that supports SAML. LDAP, MySQL, files, Drupal database and so on.

Page 42: Drupal and diversity of Single sign-on systems

Configuration• Install simpleSAMLphp library

• Configure IP and SP

Page 43: Drupal and diversity of Single sign-on systems
Page 44: Drupal and diversity of Single sign-on systems
Page 45: Drupal and diversity of Single sign-on systems

The most popular cases in Drupal wold

• Drupal site as Identity Provider

• SimpleSAMLphp as Service Provider

• Dedicated MySQL database as Identity Provider

• SimpleSAMLphp as Service Provider

• Shibboleth as Identity Provider and Service Provider

Page 46: Drupal and diversity of Single sign-on systems

Advantages• It written on PHP

• Easy to debug

• May be as Service Provider and Identity Provider

• Drupal site may be as Identity Provider

• You can exclude roles, users from authentication process

Page 47: Drupal and diversity of Single sign-on systems

Limitations

• SimpleSAMLphp library and sites should be on the same server

• Login always will be via simpleSAMLphp page

• No easy way to save custom information into Identity Provider

Page 48: Drupal and diversity of Single sign-on systems

6. Custom solutions

Page 49: Drupal and diversity of Single sign-on systems

Reasons to use

Only when existing solutions don’t solve your problems.

Page 50: Drupal and diversity of Single sign-on systems

Custom Solutions

• Services

• oAuth and OpenID

• Custom code :)

Page 51: Drupal and diversity of Single sign-on systems

Shared tables Bakery LDAP LDAP +

CASSimpleSA

MLphp Custom

Simple ✓ ✓ × × × -

CRUD ✓ ✓ ✓ ✓ × -

Don’t needtop-level domain

× × ✓ ✓ ✓ -

Secure × ✓ ✓ ✓ ✓ -

Flexibility × × ✓ ✓ ✓ -

Extendable × × ✓ ✓ ✓ -

Different servers × × ✓ ✓ ✓ -

Page 52: Drupal and diversity of Single sign-on systems

Thank you!

Drupal.org: https://www.drupal.org/u/sanchiz GitHub: https://github.com/Sanchiz Blog: http://sanchiz.net Email: [email protected] Twitter: @alexschedrov