diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ad9475 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Development artifacts +.DS_Store +.vscode +/vendor/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..b7c2018 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +## INTRODUCTION + +The PSUL User Auth module is a alter user and authentication for PSU Library +sites. + +The primary use case for this module is: + +- Ensure username set after authentication is NOT the email. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..8a5c75c --- /dev/null +++ b/composer.json @@ -0,0 +1,14 @@ +{ + "name": "psul-libraries/psul_user_auth", + "description": "Adds functionality to alter users and user authentication", + "type": "drupal-module", + "license": "GPL-2.0-or-later", + "authors": [ + { + "name": "Mike Henninger", + "email": "msh6004@psu.edu" + } + ], + "minimum-stability": "dev", + "require": {} +} diff --git a/psul_user_auth.info.yml b/psul_user_auth.info.yml new file mode 100644 index 0000000..4531985 --- /dev/null +++ b/psul_user_auth.info.yml @@ -0,0 +1,8 @@ +name: 'PSUL User Auth' +type: module +description: 'Adds functionality to alter users and user authentication' +package: PSU Libraries +core_version_requirement: ^10 || ^11 +dependencies: + - drupal:user + - openid_connect:openid_connect diff --git a/psul_user_auth.module b/psul_user_auth.module new file mode 100644 index 0000000..6b15dbc --- /dev/null +++ b/psul_user_auth.module @@ -0,0 +1,52 @@ +get('openid_connect', $account->id(), 'oidc_name'); + + if (empty($oidc_name) || strpos($oidc_name, 'oidc_') === 0) { + return; + } + + // Always display the oidc_name if it is set. + $name = $oidc_name; +}