幻想世界轻小说的OpenIDConnect登录插件(异世界百科用户中心专用)
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Tim Nolte d4f0f4b51f
3.9.0 Feature & Bugfix Release (#394)
* Update openid-connect-generic-client-wrapper.php

Add openid-connect-generic-session-expired action before to allow consumers to act on the refresh token expiration

* Implement singleton pattern for OpenID_Connect_Generic class

This will allow developers who want to be able to call methods belonging to this class (or methods belonging to any of this class's properties) to do so, without having to create a new instance, and therefore repeat all the bootstrapping.

Instead, they will just be able to call OpenID_Connect_Generic::instance() to retrieve the singleton.

* Add functions.php file for global functions

These will act as wrappers for methods you would otherwise call by getting the Open_ID_Connect_Generic singleton and then calling the appropriate method.

* Make client_wrapper a public property

This allows us to access client_wrapper methods via the singleton of Open_ID_Connect_Generic.

* Support aggregated claims (#254)

* use tabs instead of spaces

* added define config with OIDC_LOGIN_TYPE and OIDC_CLIENT_SCOPE

scopes are needed when logging in so this is a no-brainer and this
can be deployed using deployments

login type can be defined here when you want to enforce SSO from the
deployment.

* More define-driven settings

* fix linting

* fix code analysis errors

* fix more linting, add more exception handling

* Added the OIDC_CREATE_IF_DOES_NOT_EXIST define

* Added documentation and phpstan defines

* Added data in environment_settings

* Fixes QS not being added to the redirect URL

* fix #178
Update last-token-response user meta after refresh

* add a basic method to refresh user claim outside of this plugin

* fix return doc

* add a basic method to refresh user claim outside of this plugin

* fix return doc

* Revert "fix return doc"

This reverts commit e19d6f3ffd3f7684dd843408ec911c4b6d614328.

* Revert "add a basic method to refresh user claim outside of this plugin"

This reverts commit 1a5fa9b045c7b50a17dc3cfd5482fc33be9aa6ee.

* Initial Codepsaces Development Environment

* Adds Gitpod Support Alongside Codespaces Support

* Only load admin CSS when showing settings page

* Updates Development Environment for PHP & WordPress

- Updates local development environment to use a Composer Docker
  container.
- Updates VS Code/Codespaces devcontainer to bullseye/PHP 7.4.
- Updates VS Code/Codespaces devcontainer & GitPod starting commands.
- Updates build environment to use PHP 7.4 & Composer 2.
- Updates build environment Composer packages.
- Updates Composer WordPress install to use the johnpbloch packages.

* Fixes Running PHPStan in Docker & Static Analysis Issues

- Updates the PHP/Composer Docker image memory limit to
  allow PHPStand to run properly.
- Fixes static analysis issues reported by PHPStan.
- Updates PHPStan & extensions to latest versions.
- Updates PHPStan configuration for latest version.

* Update GitHub Actions for PHP/Composer/WordPress Changes

- Updates GitHub Actions to use Composer v2.
- Updates GitHub Actions to use PHP 7.4.
- Updates GitHub Actions to use WordPress 5.7 as stable.

* Updates WordPress Version Composer Dependencies

- Updates the installed WordPress version to 5.7.
- Updates the installed WordPress stubs version to 5.7.

* Fixes GitHub Actions for Composer 2 Changes

* Fixes GitHub Actions for PHP Unit testing

- Changes PHPUnit switch to dev-master for PHP 8.0.

* Updates GrumPHP & GrumPHP Unit Testing PHP 8 Support

- Updates GrumPHP to a newer version.
- Updates Unit Testing PHP 8.0 to use GrumPHP dev-master.

* Updates Unit Testing for PHPUnit Testing w/ PHP8

* Updates Unit Testing Composer Updates to Run w/ PHP 8

* Updates Composer PHPUnit for PHP 8 Override

* Multisite/network configurations use your current blog as the default when using the WP_User_Query which means if a user already exists, from a different blog, you will not find them, but also can't create a new account because they already exist.  This overrides your current blog and will search 'all'

* CodeSpaces Dev Container Updates & Composer Updates

* Updating GrumPHP & Composer Dependencies

* Updates NPM Modules & Changes Plugin Instance Visibility

* Updates @wordpress/scripts & ~wordpress/env to the latest versions.
* Changes the visibility of the plugin class instance attribute.

* Bump tar from 4.4.13 to 4.4.19

Bumps [tar](https://github.com/npm/node-tar) from 4.4.13 to 4.4.19.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v4.4.13...v4.4.19)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump hosted-git-info from 2.8.8 to 2.8.9

Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

---
updated-dependencies:
- dependency-name: hosted-git-info
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump lodash from 4.17.19 to 4.17.21

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump ssri from 6.0.1 to 6.0.2

Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: ssri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump path-parse from 1.0.6 to 1.0.7

Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump ws from 6.2.1 to 6.2.2

Bumps [ws](https://github.com/websockets/ws) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/6.2.1...6.2.2)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* coding standards issues

* Fix wordpress coding standards issues

* Redone acr-values-support

acr-values support

* Fix code-standard errors

Fixed reported code-standard issues found

* Update openid-connect-generic-client.php

fixing code-indentment after report

* Update openid-connect-generic-client-wrapper.php

fix for reported code-standard errors

* Update openid-connect-generic-settings-page.php

Fixing code-standard reported errors

* Update openid-connect-generic-client.php

re-aligned line 225 ( indentment error)

* Refactors new ACR Handling Code for Better Code Quality

* Fixes some incorrect ACR handling code that incorrectly
  added the ACR when it wasn't set.
* Adds missing settings disable handling when ACR constant
  is set.
* Refactors code for simplicity and code quality.

* Fixes #243 Nickname from Claim Regression

* Fixes the regression caused by the code changes in 3.8.0
  which resulted in not performing proper fallbacks for
  missing cliams such as the nickname.
* Fixes invalid Node version in NVM configuration.

* Fixes Indentity Mapping & Creation Issues

* Fixes issues with improperly handling combinations of the
  "Link Existing Users", "Create user if does not exist", and
  "Identify with User Name" configuration options.
* Addresses issues related to case sensitivity of usernames
  when attempting to "Link Existing Users".
* Fixes typos and formatting on the plugin Settings screen.

* Dependabot Security Related Fixes & Refactoring

* Update to require Node v14 & NPM 6.14.15.
* Updates to Grunt 1.4.1.
* Forces resolution of dependencies for security fixes.
* Update @wordpress packages to their latest versions.
* Refactors the NPM & Composer scripts.

* Updates WP to Latest Dev Standard for Local Development

* Refactors Callable Refresh User Claims Function & Action

* Moves `openid-connect-generic-update-user-using-current-claim` action
  to within update user metadata during login.
* Adds a new publicly callable method that uses the plugin singleton.

* Prep for 3.9.0 Release

Co-authored-by: jkouris <35877237+jkouris@users.noreply.github.com>
Co-authored-by: Rob Skilling <rob@dxw.com>
Co-authored-by: Martin Schanzenbach <schanzen@gnunet.org>
Co-authored-by: Chloé "Matcha" Desoutter <chloe.desoutter@bluenove.com>
Co-authored-by: Martin <schanzen@users.noreply.github.com>
Co-authored-by: Sylwester Kardziejonek <sylwester.kardziejonek@gmail.com>
Co-authored-by: Nicolas Dhers <nicolas@rkcreation.fr>
Co-authored-by: Tom McCaffery <tom@weareadjacent.com>
Co-authored-by: Dan <dan@testinnovators.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: John Kouris <jkouris@everyincome.com>
Co-authored-by: Glowsome <administrator@comsolve.nl>
3 years ago
.devcontainer 3.9.0 Feature & Bugfix Release (#394) 3 years ago
.github 3.9.0 Feature & Bugfix Release (#394) 3 years ago
.vscode 3.9.0 Feature & Bugfix Release (#394) 3 years ago
css Release/3.8.3 (#290) 4 years ago
includes 3.9.0 Feature & Bugfix Release (#394) 3 years ago
languages 3.9.0 Feature & Bugfix Release (#394) 3 years ago
scripts Initial Coding Standards & Static Analysis Chanages. 5 years ago
tests 3.9.0 Feature & Bugfix Release (#394) 3 years ago
tools 3.9.0 Feature & Bugfix Release (#394) 3 years ago
.editorconfig Initial Coding Standards & Static Analysis Chanages. 5 years ago
.gitattributes Adds Node/NPM Excludes for Git Exports (#231) 5 years ago
.gitignore Improve Local Dev Setup by Reducing Setup Commands (#226) 5 years ago
.gitpod.yml 3.9.0 Feature & Bugfix Release (#394) 3 years ago
.npmrc Adds Node/NPM Environment Requirements 5 years ago
.nvmrc 3.9.0 Feature & Bugfix Release (#394) 3 years ago
.wp-env.json 3.9.0 Feature & Bugfix Release (#394) 3 years ago
CHANGELOG.md 3.9.0 Feature & Bugfix Release (#394) 3 years ago
Gruntfile.js 3.8.2 Security Release (#284) 4 years ago
HOWTO.md 3.9.0 Feature & Bugfix Release (#394) 3 years ago
README.md 3.9.0 Feature & Bugfix Release (#394) 3 years ago
composer.json 3.9.0 Feature & Bugfix Release (#394) 3 years ago
composer.lock 3.9.0 Feature & Bugfix Release (#394) 3 years ago
docker-compose.wp-env.yml 3.9.0 Feature & Bugfix Release (#394) 3 years ago
docker-compose.yml 3.9.0 Feature & Bugfix Release (#394) 3 years ago
grumphp.yml.dist 3.8.2 Security Release (#284) 4 years ago
openid-connect-generic.php 3.9.0 Feature & Bugfix Release (#394) 3 years ago
package-lock.json 3.9.0 Feature & Bugfix Release (#394) 3 years ago
package.json 3.9.0 Feature & Bugfix Release (#394) 3 years ago
phpcs.xml.dist 3.9.0 Feature & Bugfix Release (#394) 3 years ago
phpstan.neon.dist 3.9.0 Feature & Bugfix Release (#394) 3 years ago
phpunit.xml.dist Initial Coding Standards & Static Analysis Chanages. 5 years ago
readme.txt 3.9.0 Feature & Bugfix Release (#394) 3 years ago

README.md

OpenID Connect Generic Client

Contributors: daggerhart, tnolte
Donate link: http://www.daggerhart.com/
Tags: security, login, oauth2, openidconnect, apps, authentication, autologin, sso
Requires at least: 4.9
Tested up to: 5.9.2
Stable tag: 3.9.0
Requires PHP: 7.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

A simple client that provides SSO or opt-in authentication against a generic OAuth2 Server implementation.

Description

This plugin allows to authenticate users against OpenID Connect OAuth2 API with Authorization Code Flow. Once installed, it can be configured to automatically authenticate users (SSO), or provide a "Login with OpenID Connect" button on the login form. After consent has been obtained, an existing user is automatically logged into WordPress, while new users are created in WordPress database.

Much of the documentation can be found on the Settings > OpenID Connect Generic dashboard page.

Please submit issues to the Github repo: https://github.com/daggerhart/openid-connect-generic

Installation

  1. Upload to the /wp-content/plugins/ directory
  2. Activate the plugin
  3. Visit Settings > OpenID Connect and configure to meet your needs

Frequently Asked Questions

What is the client's Redirect URI?

Most OAuth2 servers will require whitelisting a set of redirect URIs for security purposes. The Redirect URI provided by this client is like so: https://example.com/wp-admin/admin-ajax.php?action=openid-connect-authorize

Replace example.com with your domain name and path to WordPress.

Can I change the client's Redirect URI?

Some OAuth2 servers do not allow for a client redirect URI to contain a query string. The default URI provided by this module leverages WordPress's admin-ajax.php endpoint as an easy way to provide a route that does not include HTML, but this will naturally involve a query string. Fortunately, this plugin provides a setting that will make use of an alternate redirect URI that does not include a query string.

On the settings page for this plugin (Dashboard > Settings > OpenID Connect Generic) there is a checkbox for Alternate Redirect URI. When checked, the plugin will use the Redirect URI https://example.com/openid-connect-authorize.

Changelog

3.9.0

  • Feature: @matchaxnb - Added support for additional configuration constants.
  • Feature: @schanzen - Added support for agregated claims.
  • Fix: @rkcreation - Fixed access token not updating user metadata after login.
  • Fix: @danc1248 - Fixed user creation issue on Multisite Networks.
  • Feature: @RobjS - Added plugin singleton to support for more developer customization.
  • Feature: @jkouris - Added action hook to allow custom handling of session expiration.
  • Fix: @tommcc - Fixed admin CSS loading only on the plugin settings screen.
  • Feature: @rkcreation - Added method to refresh the user claim.
  • Feature: @Glowsome - Added acr_values support & verification checks that it when defined in options is honored.
  • Fix: @timnolte - Fixed regression which caused improper fallback on missing claims.
  • Fix: @slykar - Fixed missing query string handling in redirect URL.
  • Fix: @timnolte - Fixed issue with some user linking and user creation handling.
  • Improvement: @timnolte - Fixed plugin settings typos and screen formatting.
  • Security: @timnolte - Updated build tooling security vulnerabilities.
  • Improvement: @timnolte - Changed build tooling scripts.

3.8.5

  • Fix: @timnolte - Fixed missing URL request validation before use & ensure proper current page URL is setup for Redirect Back.
  • Fix: @timnolte - Fixed Redirect URL Logic to Handle Sub-directory Installs.
  • Fix: @timnolte - Fixed issue with redirecting user back when the openid_connect_generic_auth_url shortcode is used.

3.8.4

  • Fix: @timnolte - Fixed invalid State object access for redirection handling.
  • Improvement: @timnolte - Fixed local wp-env Docker development environment.
  • Improvement: @timnolte - Fixed Composer scripts for linting and static analysis.

3.8.3

  • Fix: @timnolte - Fixed problems with proper redirect handling.
  • Improvement: @timnolte - Changes redirect handling to use State instead of cookies.
  • Improvement: @timnolte - Refactored additional code to meet coding standards.

3.8.2

  • Fix: @timnolte - Fixed reported XSS vulnerability on WordPress login screen.

3.8.1

  • Fix: @timnolte - Prevent SSO redirect on password protected posts.
  • Fix: @timnolte - CI/CD build issues.
  • Fix: @timnolte - Invalid redirect handling on logout for Auto Login setting.

3.8.0

  • Feature: @timnolte - Ability to use 6 new constants for setting client configuration instead of storing in the DB.
  • Improvement: @timnolte - Plugin development & contribution updates.
  • Improvement: @timnolte - Refactored to meet WordPress coding standards.
  • Improvement: @timnolte - Refactored to provide localization.

3.7.1

  • Fix: Release Version Number.

3.7.0

  • Feature: @timnolte - Ability to enable/disable token refresh. Useful for IDPs that don't support token refresh.
  • Feature: @timnolte - Support custom redirect URL(redirect_to) with the authentication URL & login button shortcodes.
    • Supports additional attribute overrides including login button_text, endpoint_login, scope, redirect_uri.

3.6.0

  • Improvement: @RobjS - Improved error messages during login state failure.
  • Improvement: @RobjS - New developer filter for login form button URL.
  • Fix: @cs1m0n - Only increment username during new user creation if the "Link existing user" setting is enabled.
  • Fix: @xRy-42 - Allow periods and spaces in usernames to match what WordPress core allows.
  • Feature: @benochen - New setting named "Create user if does not exist" determines whether new users are created during login attempts.
  • Improvement: @flat235 - Username transliteration and normalization.

3.5.1

  • Fix: @daggerhart - New approach to state management using transients.

3.5.0

  • Readme fix: @thijskh - Fix syntax error in example openid-connect-generic-login-button-text
  • Feature: @slavicd - Allow override of the plugin by posting credentials to wp-login.php
  • Feature: @gassan - New action on use login
  • Fix: @daggerhart - Avoid double question marks in auth url query string
  • Fix: @drzraf - wp-cli bootstrap must not inhibit custom rewrite rules
  • Syntax change: @mullikine - Change PHP keywords to comply with PSR2

3.4.1

  • Minor documentation update and additional error checking.

3.4.0

  • Feature: @drzraf - New filter hook: ability to filter claim and derived user data before user creation.
  • Feature: @anttileppa - State time limit can now be changed on the settings page.
  • Fix: @drzraf - Fix PHP notice when using traditional login, $token_response may be empty.
  • Fix: @drzraf - Fixed a notice when cookie does not contain expected redirect_url

3.3.1

  • Prefixing classes for more efficient autoloading.
  • Avoid altering global wp_remote_post() parameters.
  • Minor metadata updates for wp.org

3.3.0

  • Fix: @pjeby - Handle multiple user sessions better by using the WP_Session_Tokens object. Predecessor to fixes for multiple other issues: #49, #50, #51

3.2.1

  • Bug fix: @svenvanhal - Exit after issuing redirect. Fixes #46

3.2.0

  • Feature: @robbiepaul - trigger core action wp_login when user is logged in through this plugin
  • Feature: @moriyoshi - Determine the WP_User display name with replacement tokens on the settings page. Tokens can be any property of the user_claim.
  • Feature: New setting to set redirect URL when session expires.
  • Feature: @robbiepaul - New filter for modifying authentication URL
  • Fix: @cedrox - Adding id_token_hint to logout URL according to spec
  • Bug fix: Provide port to the request header when requesting the user_claim

3.1.0

  • Feature: @rwasef1830 - Refresh tokens
  • Feature: @rwasef1830 - Integrated logout support with end_session endpoint
  • Feature: May use an alternate redirect_uri that doesn't rely on admin-ajax
  • Feature: @ahatherly - Support for IDP behind reverse proxy
  • Bug fix: @robertstaddon - case insensitive check for Bearer token
  • Bug fix: @rwasef1830 - "redirect to origin when auto-sso" cookie issue
  • Bug fix: @rwasef1830 - PHP Warnings headers already sent due to attempts to redirect and set cookies during login form message
  • Bug fix: @rwasef1830 - expire session when access_token expires if no refresh token found
  • UX fix: @rwasef1830 - Show login button on error redirect when using auto-sso

3.0.8

  • Feature: @wgengarelly - Added openid-connect-generic-update-user-using-current-claim action hook allowing other plugins/themes to take action using the fresh claims received when an existing user logs in.

3.0.7

  • Bug fix: @wgengarelly - When requesting userinfo, send the access token using the Authorization header field as recommended in section 5.3.1 of the specs.

3.0.6

  • Bug fix: @robertstaddon - If "Link Existing Users" is enabled, allow users who login with OpenID Connect to also log in with WordPress credentials

3.0.5

  • Feature: @robertstaddon - Added [openid_connect_generic_login_button] shortcode to allow the login button to be placed anywhere
  • Feature: @robertstaddon - Added setting to "Redirect Back to Origin Page" after a successful login instead of redirecting to the home page.

3.0.4

  • Feature: @robertstaddon - Added setting to allow linking existing WordPress user accounts with newly-authenticated OpenID Connect login

3.0.3

  • Using WordPresss's is_ssl() for setcookie()'s "secure" parameter
  • Bug fix: Incrementing username in case of collision.
  • Bug fix: Wrong error sent when missing token body

3.0.2

  • Added http_request_timeout setting

3.0.1

  • Finalizing 3.0.x api

3.0

  • Complete rewrite to separate concerns
  • Changed settings keys for clarity (requires updating settings if upgrading from another version)
  • Error logging

2.1

  • Working my way closer to spec. Possible breaking change. Now checking for preferred_username as priority.
  • New username determination to avoid collisions

2.0

Complete rewrite