From 0945b2e26aee8aa415545b7fa0d259ca045bb489 Mon Sep 17 00:00:00 2001 From: Mike Little Date: Fri, 9 Dec 2022 18:04:11 +0000 Subject: [PATCH 1/2] Remove WordPress as an SSO option --- composer.json | 3 +- docs/README.md | 1 - docs/wordpress.md | 26 ------------- inc/namespace.php | 9 +---- inc/wordpress/namespace.php | 75 ------------------------------------- load.php | 1 - 6 files changed, 2 insertions(+), 113 deletions(-) delete mode 100644 docs/wordpress.md delete mode 100644 inc/wordpress/namespace.php diff --git a/composer.json b/composer.json index 47b5b41..eeaa819 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,7 @@ "autoload": { "files": [ "inc/namespace.php", - "inc/saml/namespace.php", - "inc/wordpress/namespace.php" + "inc/saml/namespace.php" ] }, "require": { diff --git a/docs/README.md b/docs/README.md index 5d36180..21ce172 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,7 +11,6 @@ Once the CMS has a user record in the database, the user's session is authorized Supported authorization providers are: * [SAML 2.0](./saml-2-0.md) -* [WordPress](./wordpress.md) ## Hiding native login diff --git a/docs/wordpress.md b/docs/wordpress.md deleted file mode 100644 index 630ffe4..0000000 --- a/docs/wordpress.md +++ /dev/null @@ -1,26 +0,0 @@ -# WordPress - -The SSO module allows using a WordPress site as the authentication provider for the Altis site. This works via OAuth 2.0, as such the WordPress site you want to use as the authentication provider must be using the [OAuth 2.0 WordPress Plugin](https://github.com/WP-API/OAuth2). - -To enabled WordPress SSO, you must create an OAuth 2 application on the WordPress site, and set the Callback URL on the OAuth client to `$site_url/hm-delegated-auth-callback`, for example `https://my-site.altis.dev/hm-delegated-auth-callback`. Once you have published and approved the OAuth application on your WordPress site, take note of the Public Key for the client. - -Provide the REST BASE of your WordPress site (usually `https://examples.com/wp-json/`), along with the OAuth client id (public key) obtained in the previous step. This is done via the `sso.wordpress` setting option: - -```json -{ - "extra": { - "altis": { - "modules": { - "sso": { - "wordpress": { - "server-rest-base": "https://examples.com/wp-json/", - "oauth2-client-id": "XXXXXXXXXXX" - } - } - } - } - } -} -``` - -You can optionally configure the WordPress SSO provider to synchronize user roles from the WordPress site. When the `wordpress.sync-roles` setting is set to `true`, the user's role on the WordPress site will be used when creating the user on the Altis site. diff --git a/inc/namespace.php b/inc/namespace.php index da954c8..c6aac8f 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -21,9 +21,6 @@ function bootstrap() { if ( $config['saml'] ) { SAML\bootstrap(); } - if ( $config['wordpress'] ) { - WordPress\bootstrap(); - } add_action( 'login_form', __NAMESPACE__ . '\\output_sso_buttons' ); } @@ -35,7 +32,7 @@ function bootstrap() { */ function is_sso_active() : bool { $config = Altis\get_config()['modules']['sso']; - if ( $config['saml'] || $config['wordpress'] ) { + if ( $config['saml'] ) { return true; } return false; @@ -67,10 +64,6 @@ function output_sso_buttons() : void { - - - -