|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Coudflare Access SSO |
| 3 | + * Cloudflare Access SSO |
4 | 4 | * |
5 | 5 | * @package CloudflareAccessSSO |
6 | 6 | * @link https://github.com/jamesmorrison/cloudflare-access-sso |
7 | 7 | * @author James Morrison |
8 | 8 | * @copyright James Morrison 2023 |
9 | 9 | * @license GPL v2 or later |
10 | 10 | * |
11 | | - * Plugin Name: Cloudflare Access SSO |
12 | | - * Description: Facilitates automatic login to WordPress when domain is protected with Cloudflare Access |
13 | | - * Version: 0.1.0 |
14 | | - * Plugin URI: https://github.com/jamesmorrison/cloudflare-access-sso |
15 | | - * Author: James Morrison |
16 | | - * Author URI: https://jamesmorrison.uk/ |
17 | | - * Text Domain: cloudflare-access-sso |
18 | | - * Domain Path: /languages/ |
| 11 | + * Plugin Name: Cloudflare Access SSO |
| 12 | + * Description: Facilitates automatic login to WordPress when domain is protected with Cloudflare Access |
| 13 | + * Version: 1.0.0 |
| 14 | + * Plugin URI: https://github.com/jamesmorrison/cloudflare-access-sso |
| 15 | + * Author: James Morrison |
| 16 | + * Author URI: https://jamesmorrison.uk/ |
| 17 | + * Text Domain: cloudflare-access-sso |
| 18 | + * Domain Path: /languages/ |
| 19 | + * License: GPL v2 or later |
| 20 | + * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
19 | 21 | * |
20 | 22 | * This program is free software; you can redistribute it and/or modify |
21 | 23 | * it under the terms of the GNU General Public License as published by |
|
31 | 33 | // Security check |
32 | 34 | defined( 'ABSPATH' ) || exit; |
33 | 35 |
|
34 | | -// The Cloudflare Team Name is required. |
| 36 | +// The Cloudflare Team Name is required |
35 | 37 | if ( ! defined( 'CF_ACCESS_TEAM_NAME' ) ) { |
36 | 38 | error_log( 'Cloudflare Access SSO Error: CF_ACCESS_TEAM_NAME is not defined.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log |
37 | 39 | return; |
38 | 40 | } |
39 | 41 |
|
40 | | -// The Cloudflare Application ID is required. |
| 42 | +// The Cloudflare Application ID is required |
41 | 43 | if ( ! defined( 'CF_ACCESS_AUD' ) ) { |
42 | 44 | error_log( 'Cloudflare Access SSO Error: CF_ACCESS_AUD is not defined.' ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log |
43 | 45 | return; |
44 | 46 | } |
45 | 47 |
|
46 | | -// Default to not enforcing SSO (which redirects wp-login => wp-admin) |
47 | | -if ( ! defined( 'CF_ACCESS_ENFORCE_SSO' ) ) { |
48 | | - define( 'CF_ACCESS_ENFORCE_SSO', false ); |
49 | | -} |
50 | | - |
51 | 48 | // Default to 3 attempts to complete authentication |
52 | 49 | if ( ! defined( 'CF_ACCESS_ATTEMPTS' ) ) { |
53 | 50 | define( 'CF_ACCESS_ATTEMPTS', 3 ); |
|
58 | 55 | define( 'CF_ACCESS_LEEWAY', 60 ); |
59 | 56 | } |
60 | 57 |
|
61 | | - |
62 | | -// Useful global constants. |
63 | | -define( 'CLOUDFLARE_ACCESS_SSO_PLUGIN_VERSION', '0.1.0' ); |
| 58 | +// Useful global constants |
| 59 | +define( 'CLOUDFLARE_ACCESS_SSO_PLUGIN_VERSION', '1.0.0' ); |
64 | 60 | define( 'CLOUDFLARE_ACCESS_SSO_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
65 | 61 | define( 'CLOUDFLARE_ACCESS_SSO_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
66 | 62 | define( 'CLOUDFLARE_ACCESS_SSO_PLUGIN_INC', CLOUDFLARE_ACCESS_SSO_PLUGIN_PATH . 'includes/' ); |
67 | 63 |
|
68 | | -// Require Composer autoloader if it exists. |
| 64 | +// Require Composer autoloader if it exists |
69 | 65 | if ( file_exists( CLOUDFLARE_ACCESS_SSO_PLUGIN_PATH . 'vendor/autoload.php' ) ) { |
70 | 66 | require_once CLOUDFLARE_ACCESS_SSO_PLUGIN_PATH . 'vendor/autoload.php'; |
71 | 67 | } |
72 | 68 |
|
73 | | -// Include files. |
| 69 | +// Include files |
74 | 70 | require_once CLOUDFLARE_ACCESS_SSO_PLUGIN_INC . '/core.php'; |
75 | 71 |
|
76 | | -// Activation/Deactivation. |
| 72 | +// Activation / Deactivation |
77 | 73 | register_activation_hook( __FILE__, '\CloudflareAccessSSO\Core\activate' ); |
78 | 74 | register_deactivation_hook( __FILE__, '\CloudflareAccessSSO\Core\deactivate' ); |
79 | 75 |
|
80 | | -// Bootstrap. |
| 76 | +// Bootstrap |
81 | 77 | CloudflareAccessSSO\Core\setup(); |
0 commit comments