plugin = $plugin; $this->group = $group; $this->page = $page; $this->options = $options; $this->title = $title; add_action('admin_init', array($this, 'register_options')); add_action('admin_menu', array($this, 'add_options_page')); } /* * Register the options for this plugin so they can be displayed and updated below. */ function register_options() { register_setting($this->group, $this->group, array($this, 'sanitize_settings')); $section = 'http_authentication_main'; add_settings_section($section, 'Main Options', array($this, '_display_options_section'), $this->page); add_settings_field('http_authentication_allow_wp_auth', 'Allow WordPress authentication?', array($this, '_display_option_allow_wp_auth'), $this->page, $section, array('label_for' => 'http_authentication_allow_wp_auth')); add_settings_field('http_authentication_auth_label', 'Authentication label', array($this, '_display_option_auth_label'), $this->page, $section, array('label_for' => 'http_authentication_auth_label')); add_settings_field('http_authentication_login_uri', 'Login URI', array($this, '_display_option_login_uri'), $this->page, $section, array('label_for' => 'http_authentication_login_uri')); add_settings_field('http_authentication_logout_uri', 'Logout URI', array($this, '_display_option_logout_uri'), $this->page, $section, array('label_for' => 'http_authentication_logout_uri')); add_settings_field('http_authentication_additional_server_keys', '$_SERVER variables', array($this, '_display_option_additional_server_keys'), $this->page, $section, array('label_for' => 'http_authentication_additional_server_keys')); add_settings_field('http_authentication_auto_create_user', 'Automatically create accounts?', array($this, '_display_option_auto_create_user'), $this->page, $section, array('label_for' => 'http_authentication_auto_create_user')); add_settings_field('http_authentication_auto_create_email_domain', 'Email address domain', array($this, '_display_option_auto_create_email_domain'), $this->page, $section, array('label_for' => 'http_authentication_auto_create_email_domain')); } /* * Set the database version on saving the options. */ function sanitize_settings($input) { $output = $input; $output['db_version'] = $this->plugin->db_version; $output['allow_wp_auth'] = isset($input['allow_wp_auth']) ? (bool) $input['allow_wp_auth'] : false; $output['auto_create_user'] = isset($input['auto_create_user']) ? (bool) $input['auto_create_user'] : false; return $output; } /* * Add an options page for this plugin. */ function add_options_page() { add_options_page($this->title, $this->title, 'manage_options', $this->page, array($this, '_display_options_page')); } /* * Display the options for this plugin. */ function _display_options_page() { if (! current_user_can('manage_options')) { wp_die(__('You do not have sufficient permissions to access this page.')); } ?>
For the Login URI and Logout URI options, you can use the following variables to support your installation:
%host%
- The current value of $_SERVER['HTTP_HOST']
%base%
- The base domain URL (everything before the path)%site%
- The WordPress home URI%redirect%
- The return URI provided by WordPressYou can also use %host_encoded%
, %site_encoded%
, and %redirect_encoded%
for URL-encoded values.
HTTP authentication
; override to use the name of your single sign-on system.
options['login_uri'];
$this->_display_input_text_field('login_uri', $login_uri);
?>
Default is
; override to direct users to a single sign-on system. See above for available variables.%base%/Shibboleth.sso/Login?target=%redirect_encoded%
options['logout_uri'];
$this->_display_input_text_field('logout_uri', $logout_uri);
?>
Default is
; override to e.g. remove a cookie. See above for available variables.%base%/Shibboleth.sso/Logout?return=%redirect_encoded%
options['additional_server_keys'];
$this->_display_input_text_field('additional_server_keys', $additional_server_keys);
?>
$_SERVER
variables in addition to REMOTE_USER
and REDIRECT_REMOTE_USER
to check for the username value, separated by a comma. Use this to e.g. support personal X.509 certificates for authentication.SSL_CLIENT_S_DN_CN
options['auto_create_user'];
$this->_display_checkbox_field('auto_create_user', $auto_create_user);
?>
Should a new user be created automatically if not already in the WordPress database?