Add M365 Login plugin: Microsoft Entra ID sign-in for existing users
Adds a WordPress plugin that places a customisable "Sign in with Microsoft" button on wp-login.php and signs existing users in via the OpenID Connect authorization code flow with PKCE. Users are matched by e-mail address only; no accounts are created. Security: single-use state/nonce bound to an HttpOnly cookie, ID token signature verification against Microsoft's JWKS (RS256 only) with issuer/audience/tenant/expiry/nonce checks, optional tenant pinning, account binding to the Microsoft object ID, e-mail domain allow-list, client secret encrypted at rest (AES-256-GCM). Admin: settings screen with connection, button and security tabs, live button preview, colour presets, media-library icon picker, redirect URI copy button and tenant connectivity test. Packaging for WordPress.org: readme.txt with External services section, GPL-2.0 license, uninstall.php, POT + German translations, .distignore, build script, PHPCS config and CI running Plugin Check. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JJxAHYdMfKPoN4koRc4Ci2
This commit is contained in:
commit
3e3e87b399
35 changed files with 5413 additions and 0 deletions
45
uninstall.php
Normal file
45
uninstall.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* Removes all plugin data on uninstall.
|
||||
*
|
||||
* @package M365_Login
|
||||
*/
|
||||
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
/**
|
||||
* Deletes options, transients and user meta for one site.
|
||||
*/
|
||||
function m365_login_uninstall_site() {
|
||||
global $wpdb;
|
||||
|
||||
delete_option( 'm365_login_settings' );
|
||||
|
||||
// Transients: state records and JWKS cache.
|
||||
$wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s",
|
||||
$wpdb->esc_like( '_transient_m365_login_' ) . '%',
|
||||
$wpdb->esc_like( '_transient_timeout_m365_login_' ) . '%'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ( is_multisite() ) {
|
||||
$m365_login_site_ids = get_sites( array( 'fields' => 'ids', 'number' => 0 ) );
|
||||
foreach ( $m365_login_site_ids as $m365_login_site_id ) {
|
||||
switch_to_blog( $m365_login_site_id );
|
||||
m365_login_uninstall_site();
|
||||
restore_current_blog();
|
||||
}
|
||||
} else {
|
||||
m365_login_uninstall_site();
|
||||
}
|
||||
|
||||
// User meta is global.
|
||||
delete_metadata( 'user', 0, '_m365_login_oid', '', true );
|
||||
delete_metadata( 'user', 0, '_m365_login_last_login', '', true );
|
||||
Loading…
Add table
Add a link
Reference in a new issue