Skip to content

Commit

Permalink
Merge pull request #5 from tkiehne/2_2_release
Browse files Browse the repository at this point in the history
2 2 release
  • Loading branch information
tkiehne authored Oct 13, 2020
2 parents c7221db + 6154a10 commit c1ff011
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 93 deletions.
32 changes: 0 additions & 32 deletions README-Original.md

This file was deleted.

23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
This module enables Drupal 8 to authenticate users using Shibboleth, and assign
their roles based on information in other identity management systems.

It is a fork of the module created by the University of Washington, to be found
at [https://github.com/jtyocum/uwauth](https://github.com/jtyocum/uwauth), as
allowed by its GPL-3.0+ license, as provided in the `LICENSE.txt` file.

The original `README.md file` has been renamed to `README-Original.md`.


## Operation

Expand Down Expand Up @@ -57,6 +51,23 @@ Such a mapping may look like this depending on your Shibboleth configuration:

## Installation

To install via Composer, add a repository to your composer.json then install as usual via Composer:

````
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/deohs/uwauth"
}
],
"require": {
"drupal/uwauth": "~2.2"
}
}
````


In addition to enabling the module, you need to modify the `.htaccess` at the
document root, or its equivalent in your vhost definition, to avoid having URLs
needed by the Shibboleth SP being rewritten.
Expand Down
24 changes: 24 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "drupal/uwauth",
"description": "Provides authentication and role assignment with Shibboleth, and UW Groups or Active Directory.",
"type": "drupal-module",
"homepage": "https://github.com/deohs/uwauth",
"authors": [
{
"name": "John Yocum (jtyocum)",
"role": "Creator"
},
{
"name": "Thomas Kiehne (tkiehne)",
"email": "[email protected]",
"homepage": "https://www.drupal.org/u/tkiehne",
"role": "Maintainer"
}
],
"support": {
"issues": "https://github.com/deohs/uwauth/issues",
"source": "https://github.com/deohs/uwauth"
},
"license": "GPL-3.0-or-later",
"minimum-stability": "dev"
}
2 changes: 1 addition & 1 deletion config/install/uwauth.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ auth:
- 'user.login'
- 'user.logout'
name_id: 'uid'
sp_endoint: '/Shibboleth.sso'
sp_endpoint: '/Shibboleth.sso'
mail:
valid_domains:
- 'uw.edu'
2 changes: 1 addition & 1 deletion config/schema/uwauth.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ uwauth.settings:
label: 'Attribute or variable mapped to the Shibboleth NameID'
nullable: false
translatable: false
sp_endoint:
sp_endpoint:
type: 'string'
label: 'Path used by the Shibboleth SP endpoint'
nullable: false
Expand Down
5 changes: 5 additions & 0 deletions src/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
*/
class Debug {

/**
* Debug flag.
*
* @var bool
*/
protected $verbose;

/**
Expand Down
16 changes: 8 additions & 8 deletions src/EventSubscriber/UwAuthSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class UwAuthSubscriber implements EventSubscriberInterface {
/**
* A hash of severity level by group sync method.
*
* @var array<string,string>
* @var arraystringstring
*/
protected $severity;

Expand All @@ -110,7 +110,7 @@ class UwAuthSubscriber implements EventSubscriberInterface {
* The current_route_match service.
* @param \Psr\Log\LoggerInterface $logger
* The logger.channel.uwauth logger channel.
* @param array<string,string> $severity
* @param arraystringstring $severity
* The severity levels to use for each role sync method.
*/
public function __construct(
Expand Down Expand Up @@ -213,7 +213,7 @@ private function fetchAdGroups(AccountInterface $account) {
* @param \Drupal\Core\Session\AccountInterface $account
* A user object.
*
* @return array<string>
* @return arraystring
* An array of group names.
*/
private function fetchGwsGroups(AccountInterface $account) {
Expand All @@ -239,7 +239,7 @@ private function fetchGwsGroups(AccountInterface $account) {
// Extract groups from response.
$uwgws_feed = simplexml_load_string(str_replace('xmlns=', 'ns=', $uwgws_response));
$uwgws_entries = $uwgws_feed->xpath("//a[@class='name']");
$uwgws_groups = array();
$uwgws_groups = [];
foreach ($uwgws_entries as $uwgws_entry) {
$uwgws_groups[] = (string) $uwgws_entry[0];
}
Expand Down Expand Up @@ -290,7 +290,7 @@ protected function getFilteredAttributes() {
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[KernelEvents::REQUEST][] = array('handle', 29);
$events[KernelEvents::REQUEST][] = ['handle', 29];
return $events;
}

Expand Down Expand Up @@ -416,7 +416,7 @@ private function loginUser($username, AttributeBagInterface $attributes) {
* @param \Drupal\Core\Session\AccountInterface $account
* A user object.
*
* @return array<string>
* @return arraystring
* An array of role names.
*/
private function mapGroupsRoles(AccountInterface $account) {
Expand All @@ -441,14 +441,14 @@ private function mapGroupsRoles(AccountInterface $account) {

// Group to Role maps are stored as a multi-line string, containing pipe-
// delimited key-value pairs.
$group_role_map = array();
$group_role_map = [];
foreach (preg_split("/((\r?\n)|(\r\n?))/", $this->settings->get('group.map')) as $entry) {
$pair = explode('|', $entry);
$group_role_map[(string) $pair[0]] = (string) $pair[1];
}

// Loop through group list, and extract matching roles.
$mapped_roles = array();
$mapped_roles = [];
foreach ($group_membership as $group) {
if (array_key_exists($group, $group_role_map)) {
$mapped_roles[] = (string) $group_role_map[$group];
Expand Down
Loading

0 comments on commit c1ff011

Please sign in to comment.