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.')); } ?>

HTTP Authentication Options

For the Login URI and Logout URI options, you can use the following variables to support your installation:

You can also use %host_encoded%, %site_encoded%, and %redirect_encoded% for URL-encoded values.

group); ?> page); ?>

options['allow_wp_auth']; $this->_display_checkbox_field('allow_wp_auth', $allow_wp_auth); ?> Should the plugin fallback to WordPress authentication if none is found from the server? options['login_uri'] == htmlspecialchars_decode(wp_login_url())) { echo '
WARNING: You must set the login URI below to your external authentication system. Otherwise you will not be able to login!'; } } /* * Display the authentication label field, describing the authentication system * in use. */ function _display_option_auth_label() { $auth_label = $this->options['auth_label']; $this->_display_input_text_field('auth_label', $auth_label); ?> Default is 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.
Example: %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.
Example: %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.
Example: 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?
Created users will obtain the role defined under "New User Default Role" on the General Options page. options['auto_create_email_domain']; $this->_display_input_text_field('auto_create_email_domain', $auto_create_email_domain); ?> When a new user logs in, this domain is used for the initial email address on their account. The user can change his or her email address by editing their profile.
value="1" />