Skip to content

Commit ded0849

Browse files
committed
Initial
0 parents  commit ded0849

13 files changed

Lines changed: 841 additions & 0 deletions

.DS_Store

6 KB
Binary file not shown.

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Editor configuration normalization
2+
# @see http://editorconfig.org/
3+
4+
# This is the top-most .editorconfig file; do not search in parent directories.
5+
root = true
6+
7+
# All files.
8+
[*]
9+
end_of_line = LF
10+
indent_style = space
11+
indent_size = 4
12+
charset = utf-8
13+
trim_trailing_whitespace = true
14+
insert_final_newline = true
15+
16+
[{*.yml,*yaml}]
17+
indent_size = 2

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
composer.phar
2+
/vendor/
3+
composer.lock
4+
.bash_history
5+
/.phpunit.result.cache

CHANGELOG

Whitespace-only changes.

LICENSE.md

Lines changed: 478 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
## Introduction
2+
3+
[![Build Status](https://travis-ci.com/drupalauth/simplesamlphp-module-drupalauth.svg?branch=main)](https://travis-ci.com/drupalauth/simplesamlphp-module-drupalauth)
4+
5+
Drupal + SimpleSAMLphp + drupalauth = Complete SAML Identity Provider (IdP)
6+
7+
Users interact with Drupal to create accounts, manage accounts, and authenticate. SAML SPs interact with [SimpleSAMLphp](https://simplesamlphp.org/). Drupalauth ties Drupal to SimpleSAMLphp.
8+
9+
The drupalauth module for simpleSAMLphp makes it easy to create a SAML or Shibboleth identity provider (IdP) by enabling authentication of users against a Drupal site on the same server. This allows the administrator to leverage the user management and integration capabilities of [Drupal](http://drupal.org) for managing the identity life cycle.
10+
11+
**NOTE:** This is software establishes a SAML identity provider (IdP) using Drupal as the user database instead of LDAP. If you want to establish your Drupal site as a SAML service provider (SP) connected to a SAML or Shibboleth IdP, see the [simplesamlphp_auth](https://www.drupal.org/project/simplesamlphp_auth) module for Drupal.
12+
13+
### simpleSAMLphp module
14+
15+
This module for SimpleSAMLphp provides an Authentication Source for authenticating users against a local Drupal site. This allows the administrator to leverage the user management and integration capabilities of Drupal for managing the identity life cycle and the power of SimpleSAMLphp for identity integration. This is a simpleSAMLphp module, NOT a Drupal module.
16+
Download this module only if you want to use Drupal as Identity Provider.
17+
18+
19+
### Drupal modules
20+
21+
If you want to use Drupal as Identity Provide you should also install [drupalauth4ssp](https://www.drupal.org/project/drupalauth4ssp) that is available on Drupal.org. Please note that all issues related to Drupal functionality should be reported there.
22+
23+
If you want to connect your Drupal site as Service Provider to a SAML or Shibboleth IdP, use the [simplesamlphp_auth](http://drupal.org/project/simplesamlphp_auth) module for Drupal.
24+
25+
## Branch and version naming
26+
27+
Following [Semantic Versioning](https://semver.org/) is hard when you have multiple upstream dependencies.
28+
29+
So in a X.Y.Z version:
30+
31+
- X - major SimpleSAMLphp version
32+
- Y - major Drupal version
33+
- Z - inthis module incremental version
34+
35+
Example: for SimpleSAMLphp version 1.15.4 with Drupal version 8.5.6 and this module version 1 we will have tag 1.8.1.
36+
Same thing for Drupal 7 will be 1.7.1.
37+
38+
`main` at the moment corresponds to `2.10.*`. Branch `1.7` is respectfully for Drupal 7 (no Composer integration).
39+
40+
## Note on Drupal configuration
41+
42+
Disabling `discovery` cache will prevent this module from functioning.
43+
44+
See this issue <https://github.com/drupalauth/simplesamlphp-module-drupalauth/issues/71>, specifically
45+
[this comment](https://github.com/drupalauth/simplesamlphp-module-drupalauth/issues/71#issuecomment-815725363).
46+
47+
## Installation
48+
49+
### Requirements
50+
51+
1. Install Drupal 10.x
52+
2. Install simpleSAMLphp
53+
3. Install drupalauth - `composer require drupalauth/simplesamlphp-module-drupalauth`
54+
4. Configure SimpleSAMLphp to use something other than `phpsession` for session storage, e.g., SQL or memcache (See: `store.type` in `simplesamlphp/config/config.php`).
55+
5. Configure the authentication source in `simplesamlphp/config/authsources.php` as described below.
56+
57+
#### Authenticate against Drupal but use the SimpleSAMLphp login page
58+
59+
The advantage of this approach is that there is no obvious connection between SimpleSAMLphp IdP and the Drupal site.
60+
61+
**Details**
62+
63+
Configure the authentication source by putting following code into `simplesamlphp/config/authsources.php`
64+
65+
```php
66+
'drupal-userpass' => array(
67+
'drupalauth:UserPass',
68+
69+
// The filesystem path of the Drupal directory.
70+
'drupalroot' => '/var/www/drupal',
71+
72+
// Whether to turn on debug
73+
'debug' => true,
74+
75+
// Which attributes should be retrieved from the Drupal site.
76+
'attributes' => array(
77+
array('field_name' => 'uid', 'attribute_name' => 'uid'),
78+
array('field_name' => 'roles', 'attribute_name' => 'roles', 'field_property' => 'target_id'),
79+
array('field_name' => 'name', 'attribute_name' => 'cn'),
80+
array('field_name' => 'mail', 'attribute_name' => 'mail'),
81+
array('field_name' => 'field_first_name', 'attribute_name' => 'givenName'),
82+
array('field_name' => 'field_last_name', 'attribute_name' => 'sn'),
83+
array('field_name' => 'field_organization', 'attribute_name' => 'ou', 'field_property' => 'target_id'),
84+
),
85+
),
86+
```
87+
88+
Leave 'attributes' empty or unset to get all available field values. Attribute names in this case would be "$field_name:$property_name".
89+
90+
#### Authenticate against Drupal but use the Drupal login page
91+
92+
The advantage of this approach is that the SimpleSAMLphp IdP session is tied to a Drupal session. This allows the user who is already logged into the Drupal site to then navigate to a SAML SP that uses the IdP without the need to authenticate again.
93+
94+
**Details**
95+
96+
Configure the authentication source by putting following code into `simplesamlphp/config/authsources.php`
97+
98+
```php
99+
'drupal-userpass' => array('drupalauth:External',
100+
101+
// The filesystem path of the Drupal directory.
102+
'drupalroot' => '/var/www/drupal',
103+
104+
// Whether to turn on debug
105+
'debug' => true,
106+
107+
// the URL of the Drupal logout page
108+
'drupal_logout_url' => 'https://www.example.com/drupal/user/logout',
109+
110+
// the URL of the Drupal login page
111+
'drupal_login_url' => 'https://www.example.com/drupal/user/login',
112+
113+
// Which attributes should be retrieved from the Drupal site.
114+
'attributes' => array(
115+
array('field_name' => 'uid', 'attribute_name' => 'uid'),
116+
array('field_name' => 'roles', 'attribute_name' => 'roles', 'field_property' => 'target_id'),
117+
array('field_name' => 'name', 'attribute_name' => 'cn'),
118+
array('field_name' => 'mail', 'attribute_name' => 'mail'),
119+
array('field_name' => 'field_first_name', 'attribute_name' => 'givenName'),
120+
array('field_name' => 'field_last_name', 'attribute_name' => 'sn'),
121+
array('field_name' => 'field_organization', 'attribute_name' => 'ou', 'field_property' => 'target_id'),
122+
),
123+
),
124+
```

composer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "systemseed/simplesamlphp-module-rollbar",
3+
"description": "A SimpleSAMLphp module adding support for Rollbar logger handler.",
4+
"homepage": "https://github.com/systemseed/simplesamlphp-module-rollbar",
5+
"type": "simplesamlphp-module",
6+
"keywords": [
7+
"SimpleSAMLphp",
8+
"Rollbar",
9+
"Logger"
10+
],
11+
"license": "LGPL-2.1",
12+
"authors": [
13+
{
14+
"name": "Elaman Imashov",
15+
"email": "elaman@systemseed.com"
16+
},
17+
{
18+
"name": "Contributors",
19+
"homepage": "https://github.com/systemseed/simplesamlphp-module-rollbar/graphs/contributors",
20+
"role": "Contributors"
21+
}
22+
],
23+
"require": {
24+
"php": "^8.0",
25+
"rollbar/rollbar": "^4.0",
26+
"simplesamlphp/simplesamlphp": "^2.1",
27+
"simplesamlphp/composer-module-installer": "~1.0"
28+
},
29+
"require-dev": {
30+
"phpunit/phpunit": "^9.0 | ^10.0",
31+
"squizlabs/php_codesniffer": "^3.0"
32+
},
33+
"autoload-dev": {
34+
"classmap": ["src/", "tests/"]
35+
},
36+
"config": {
37+
"allow-plugins": {
38+
"simplesamlphp/composer-module-installer": true
39+
}
40+
}
41+
}

phpcs.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="drupalauth">
3+
<description>The coding standard for drupalauth.</description>
4+
5+
<rule ref="PSR12" />
6+
<file>./src</file>
7+
<file>./public</file>
8+
</ruleset>

phpunit.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
5+
>
6+
<testsuites>
7+
<testsuite name="drupalauth">
8+
<directory suffix="Test.php">tests/</directory>
9+
</testsuite>
10+
11+
</testsuites>
12+
13+
</phpunit>

scripts/phpunit.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
php -v
4+
rm -rf ./vendor composer.lock
5+
composer install
6+
7+
./vendor/bin/phpunit

0 commit comments

Comments
 (0)