| 1 |
<?php |
| 2 |
/** |
| 3 |
* Shibboleth Options - Admin |
| 4 |
* |
| 5 |
* @todo this file should be cleaned up and organized better |
| 6 |
* @package shibboleth |
| 7 |
*/ |
| 8 |
|
| 9 |
/** |
| 10 |
* Setup admin tabs for the Shibboleth option page. |
| 11 |
* |
| 12 |
* @param string $current the current tab. |
| 13 |
* @since 1.9 |
| 14 |
*/ |
| 15 |
function shibboleth_admin_tabs( $current = 'general' ) { |
| 16 |
$tabs = array( |
| 17 |
'general' => 'General', |
| 18 |
'user' => 'User', |
| 19 |
'authorization' => 'Authorization', |
| 20 |
'logging' => 'Logging', |
| 21 |
); |
| 22 |
echo '<h2 class="nav-tab-wrapper">'; |
| 23 |
foreach ( $tabs as $tab => $name ) { |
| 24 |
$class = ( $tab === $current ) ? ' nav-tab-active' : ''; |
| 25 |
echo '<a class="nav-tab' . esc_attr( $class ) . '" href="?page=shibboleth-options&tab=' . esc_attr( $tab ) . '">' . esc_html( $name ) . '</a>'; |
| 26 |
} |
| 27 |
echo '</h2>'; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Setup admin menus for Shibboleth options. |
| 32 |
* |
| 33 |
* @since ? |
| 34 |
*/ |
| 35 |
function shibboleth_admin_panels() { |
| 36 |
if ( ! is_multisite() ) { |
| 37 |
add_options_page( __( 'Shibboleth Options', 'shibboleth' ), __( 'Shibboleth', 'shibboleth' ), 'manage_options', 'shibboleth-options', 'shibboleth_options_page' ); |
| 38 |
} |
| 39 |
} |
| 40 |
add_action( 'admin_menu', 'shibboleth_admin_panels' ); |
| 41 |
|
| 42 |
/** |
| 43 |
* Setup multisite admin menus for Shibboleth options. |
| 44 |
* |
| 45 |
* @since ? |
| 46 |
*/ |
| 47 |
function shibboleth_network_admin_panels() { |
| 48 |
if ( is_multisite() ) { |
| 49 |
add_submenu_page( 'settings.php', __( 'Shibboleth Options', 'shibboleth' ), __( 'Shibboleth', 'shibboleth' ), 'manage_network_options', 'shibboleth-options', 'shibboleth_options_page' ); |
| 50 |
} |
| 51 |
} |
| 52 |
add_action( 'network_admin_menu', 'shibboleth_network_admin_panels' ); |
| 53 |
|
| 54 |
/** |
| 55 |
* WordPress options page to configure the Shibboleth plugin. |
| 56 |
* |
| 57 |
* @uses apply_filters() Calls 'shibboleth_plugin_path' |
| 58 |
* @since ? |
| 59 |
*/ |
| 60 |
function shibboleth_options_page() { |
| 61 |
global $wp_roles; |
| 62 |
$message = null; |
| 63 |
$type = null; |
| 64 |
|
| 65 |
if ( isset( $_POST['submit'] ) ) { |
| 66 |
check_admin_referer( 'shibboleth_update_options' ); |
| 67 |
|
| 68 |
if ( isset( $_GET['tab'] ) ) { |
| 69 |
$tab = $_GET['tab']; |
| 70 |
} else { |
| 71 |
$tab = 'general'; |
| 72 |
} |
| 73 |
|
| 74 |
switch ( $tab ) { |
| 75 |
case 'general': |
| 76 |
if ( ! defined( 'SHIBBOLETH_ATTRIBUTE_ACCESS_METHOD' ) ) { |
| 77 |
update_site_option( 'shibboleth_attribute_access_method', $_POST['attribute_access'] ); |
| 78 |
} |
| 79 |
if ( ! defined( 'SHIBBOLETH_ATTRIBUTE_ACCESS_METHOD_FALLBACK' ) ) { |
| 80 |
update_site_option( 'shibboleth_attribute_access_method_fallback', $_POST['attribute_access_fallback'] ); |
| 81 |
} |
| 82 |
if ( ! defined( 'SHIBBOLETH_ATTRIBUTE_CUSTOM_ACCESS_METHOD' ) ) { |
| 83 |
update_site_option( 'shibboleth_attribute_custom_access_method', $_POST['attribute_custom_access'] ); |
| 84 |
} |
| 85 |
if ( ! defined( 'SHIBBOLETH_LOGIN_URL' ) ) { |
| 86 |
update_site_option( 'shibboleth_login_url', $_POST['login_url'] ); |
| 87 |
} |
| 88 |
if ( ! defined( 'SHIBBOLETH_LOGOUT_URL' ) ) { |
| 89 |
update_site_option( 'shibboleth_logout_url', $_POST['logout_url'] ); |
| 90 |
} |
| 91 |
if ( ! defined( 'SHIBBOLETH_SPOOF_KEY' ) ) { |
| 92 |
update_site_option( 'shibboleth_spoof_key', $_POST['spoofkey'] ); |
| 93 |
} |
| 94 |
if ( ! defined( 'SHIBBOLETH_PASSWORD_CHANGE_URL' ) ) { |
| 95 |
update_site_option( 'shibboleth_password_change_url', $_POST['password_change_url'] ); |
| 96 |
} |
| 97 |
if ( ! defined( 'SHIBBOLETH_PASSWORD_RESET_URL' ) ) { |
| 98 |
update_site_option( 'shibboleth_password_reset_url', $_POST['password_reset_url'] ); |
| 99 |
} |
| 100 |
if ( ! defined( 'SHIBBOLETH_DEFAULT_TO_SHIB_LOGIN' ) ) { |
| 101 |
update_site_option( 'shibboleth_default_to_shib_login', ! empty( $_POST['default_login'] ) ); |
| 102 |
} |
| 103 |
if ( ! defined( 'SHIBBOLETH_AUTO_LOGIN' ) ) { |
| 104 |
update_site_option( 'shibboleth_auto_login', ! empty( $_POST['auto_login'] ) ); |
| 105 |
} |
| 106 |
if ( ! defined( 'SHIBBOLETH_BUTTON_TEXT' ) ) { |
| 107 |
update_site_option( 'shibboleth_button_text', $_POST['button_text'] ); |
| 108 |
} |
| 109 |
if ( ! defined( 'SHIBBOLETH_DISABLE_LOCAL_AUTH' ) ) { |
| 110 |
update_site_option( 'shibboleth_disable_local_auth', ! empty( $_POST['disable_local_auth'] ) ); |
| 111 |
} |
| 112 |
break; |
| 113 |
case 'user': |
| 114 |
if ( ! defined( 'SHIBBOLETH_HEADERS' ) ) { |
| 115 |
$shib_headers = (array) get_site_option( 'shibboleth_headers' ); |
| 116 |
$shib_headers = array_merge( $shib_headers, $_POST['headers'] ); |
| 117 |
/** |
| 118 |
* Filter shibboleth_form_submit_headers |
| 119 |
* |
| 120 |
* @param $shib_headers array |
| 121 |
* @since 1.4 |
| 122 |
* Hint: access $_POST within the filter. |
| 123 |
*/ |
| 124 |
$shib_headers = apply_filters( 'shibboleth_form_submit_headers', $shib_headers ); |
| 125 |
update_site_option( 'shibboleth_headers', $shib_headers ); |
| 126 |
} |
| 127 |
if ( ! defined( 'SHIBBOLETH_CREATE_ACCOUNTS' ) ) { |
| 128 |
update_site_option( 'shibboleth_create_accounts', ! empty( $_POST['create_accounts'] ) ); |
| 129 |
} |
| 130 |
if ( ! defined( 'SHIBBOLETH_AUTO_COMBINE_ACCOUNTS' ) ) { |
| 131 |
update_site_option( 'shibboleth_auto_combine_accounts', $_POST['auto_combine_accounts'] ); |
| 132 |
} |
| 133 |
if ( ! defined( 'SHIBBOLETH_MANUALLY_COMBINE_ACCOUNTS' ) ) { |
| 134 |
update_site_option( 'shibboleth_manually_combine_accounts', $_POST['manually_combine_accounts'] ); |
| 135 |
} |
| 136 |
break; |
| 137 |
case 'authorization': |
| 138 |
if ( ! defined( 'SHIBBOLETH_ROLES' ) ) { |
| 139 |
$shib_roles = (array) get_site_option( 'shibboleth_roles' ); |
| 140 |
$shib_roles = array_merge( $shib_roles, $_POST['shibboleth_roles'] ); |
| 141 |
/** |
| 142 |
* Filter shibboleth_form_submit_roles |
| 143 |
* |
| 144 |
* @param $shib_roles array |
| 145 |
* @since 1.4 |
| 146 |
* Hint: access $_POST within the filter. |
| 147 |
*/ |
| 148 |
$shib_roles = apply_filters( 'shibboleth_form_submit_roles', $shib_roles ); |
| 149 |
update_site_option( 'shibboleth_roles', $shib_roles ); |
| 150 |
} |
| 151 |
if ( ! defined( 'SHIBBOLETH_DEFAULT_ROLE' ) ) { |
| 152 |
update_site_option( 'shibboleth_default_role', $_POST['default_role'] ); |
| 153 |
} |
| 154 |
if ( ! defined( 'SHIBBOLETH_UPDATE_ROLES' ) ) { |
| 155 |
update_site_option( 'shibboleth_update_roles', ! empty( $_POST['update_roles'] ) ); |
| 156 |
} |
| 157 |
break; |
| 158 |
case 'logging': |
| 159 |
if ( ! defined( 'SHIBBOLETH_LOGGING' ) ) { |
| 160 |
if ( isset( $_POST['logging'] ) ) { |
| 161 |
update_site_option( 'shibboleth_logging', $_POST['logging'] ); |
| 162 |
} else { |
| 163 |
update_site_option( 'shibboleth_logging', array() ); |
| 164 |
} |
| 165 |
} |
| 166 |
break; |
| 167 |
} |
| 168 |
$type = 'updated'; |
| 169 |
$message = __( 'Settings saved.', 'shibboleth' ); |
| 170 |
|
| 171 |
if ( function_exists( 'add_settings_error' ) ) { |
| 172 |
add_settings_error( 'shibboleth_settings_updated', esc_attr( 'shibboleth_settings_updated' ), $message, $type ); |
| 173 |
settings_errors( 'shibboleth_settings_updated' ); |
| 174 |
} |
| 175 |
|
| 176 |
/** |
| 177 |
* Action shibboleth_form_submit |
| 178 |
* |
| 179 |
* @since 1.4 |
| 180 |
* Hint: use global $_POST within the action. |
| 181 |
*/ |
| 182 |
do_action( 'shibboleth_form_submit' ); |
| 183 |
|
| 184 |
} |
| 185 |
|
| 186 |
$shibboleth_plugin_path = apply_filters( 'shibboleth_plugin_path', plugins_url( 'shibboleth' ) ); |
| 187 |
|
| 188 |
?> |
| 189 |
<div class="wrap"> |
| 190 |
<form method="post"> |
| 191 |
|
| 192 |
<h1><?php esc_html_e( 'Shibboleth Options', 'shibboleth' ); ?></h1> |
| 193 |
|
| 194 |
<?php |
| 195 |
if ( isset( $_GET['tab'] ) ) { |
| 196 |
shibboleth_admin_tabs( $_GET['tab'] ); |
| 197 |
} else { |
| 198 |
shibboleth_admin_tabs( 'general' ); |
| 199 |
} |
| 200 |
if ( isset( $_GET['tab'] ) ) { |
| 201 |
$tab = $_GET['tab']; |
| 202 |
} else { |
| 203 |
$tab = 'general'; |
| 204 |
} |
| 205 |
|
| 206 |
switch ( $tab ) { |
| 207 |
case 'general': |
| 208 |
$constant = false; |
| 209 |
list( $login_url, $from_constant ) = shibboleth_getoption( 'shibboleth_login_url', false, false, true ); |
| 210 |
$constant = $constant || $from_constant; |
| 211 |
list( $logout_url, $from_constant ) = shibboleth_getoption( 'shibboleth_logout_url', false, false, true ); |
| 212 |
$constant = $constant || $from_constant; |
| 213 |
list( $password_change_url, $from_constant ) = shibboleth_getoption( 'shibboleth_password_change_url', false, false, true ); |
| 214 |
$constant = $constant || $from_constant; |
| 215 |
list( $password_reset_url, $from_constant ) = shibboleth_getoption( 'shibboleth_password_reset_url', false, false, true ); |
| 216 |
$constant = $constant || $from_constant; |
| 217 |
list( $attribute_access, $from_constant ) = shibboleth_getoption( 'shibboleth_attribute_access_method', false, false, true ); |
| 218 |
$constant = $constant || $from_constant; |
| 219 |
list( $attribute_access_fallback, $from_constant ) = shibboleth_getoption( 'shibboleth_attribute_access_method_fallback', false, false, true ); |
| 220 |
$constant = $constant || $from_constant; |
| 221 |
list( $attribute_custom_access, $from_constant ) = shibboleth_getoption( 'shibboleth_attribute_custom_access_method', false, false, true ); |
| 222 |
$constant = $constant || $from_constant; |
| 223 |
list( $spoofkey, $from_constant ) = shibboleth_getoption( 'shibboleth_spoof_key', false, false, true ); |
| 224 |
$constant = $constant || $from_constant; |
| 225 |
list( $default_login, $from_constant ) = shibboleth_getoption( 'shibboleth_default_to_shib_login', false, false, true ); |
| 226 |
$constant = $constant || $from_constant; |
| 227 |
list( $auto_login, $from_constant ) = shibboleth_getoption( 'shibboleth_auto_login', false, false, true ); |
| 228 |
$constant = $constant || $from_constant; |
| 229 |
list( $disable_local_auth, $from_constant ) = shibboleth_getoption( 'shibboleth_disable_local_auth', false, false, true ); |
| 230 |
$constant = $constant || $from_constant; |
| 231 |
list( $button_text, $from_constant ) = shibboleth_getoption( 'shibboleth_button_text', false, false, true ); |
| 232 |
$constant = $constant || $from_constant; |
| 233 |
?> |
| 234 |
|
| 235 |
<h3><?php esc_html_e( 'General Configuration', 'shibboleth' ); ?></h3> |
| 236 |
<?php if ( $constant ) { ?> |
| 237 |
<div class="notice notice-warning"> |
| 238 |
<p><?php echo wp_kses_post( __( '<strong>Note:</strong> Some options below are defined in the <code>wp-config.php</code> file as constants and cannot be modified from this page.', 'shibboleth' ) ); ?></p> |
| 239 |
</div> |
| 240 |
<?php } ?> |
| 241 |
<table class="form-table"> |
| 242 |
<tr valign="top"> |
| 243 |
<th scope="row"><label for="login_url"><?php esc_html_e( 'Login URL', 'shibboleth' ); ?></label></th> |
| 244 |
<td> |
| 245 |
<input type="text" id="login_url" name="login_url" value="<?php echo esc_url( $login_url ); ?>" size="50" <?php defined( 'SHIBBOLETH_LOGIN_URL' ) && disabled( $login_url, SHIBBOLETH_LOGIN_URL ); ?> /><br /> |
| 246 |
<?php |
| 247 |
esc_html_e( |
| 248 |
'This URL is constructed from values found in your main Shibboleth |
| 249 |
SP configuration file: your site hostname, the Sessions handlerURL, |
| 250 |
and the SessionInitiator Location.', |
| 251 |
'shibboleth' |
| 252 |
); |
| 253 |
?> |
| 254 |
<br /><?php esc_html_e( 'Wiki Documentation', 'shibboleth' ); ?>: |
| 255 |
<a href="https://spaces.internet2.edu/display/SHIB/SessionInitiator" target="_blank">Shibboleth 1.3</a> | |
| 256 |
<a href="https://spaces.internet2.edu/display/SHIB2/NativeSPSessionInitiator" target="_blank">Shibboleth 2</a> |
| 257 |
</td> |
| 258 |
</tr> |
| 259 |
<tr valign="top"> |
| 260 |
<th scope="row"><label for="logout_url"><?php esc_html_e( 'Logout URL', 'shibboleth' ); ?></label></th> |
| 261 |
<td> |
| 262 |
<input type="text" id="logout_url" name="logout_url" value="<?php echo esc_url( $logout_url ); ?>" size="50" <?php defined( 'SHIBBOLETH_LOGOUT_URL' ) && disabled( $logout_url, SHIBBOLETH_LOGOUT_URL ); ?> /><br /> |
| 263 |
<?php |
| 264 |
esc_html_e( |
| 265 |
'This URL is constructed from values found in your main Shibboleth |
| 266 |
SP configuration file: your site hostname, the Sessions handlerURL, |
| 267 |
and the LogoutInitiator Location (also known as the |
| 268 |
SingleLogoutService Location in Shibboleth 1.3).', |
| 269 |
'shibboleth' |
| 270 |
); |
| 271 |
?> |
| 272 |
<br /><?php esc_html_e( 'Wiki Documentation', 'shibboleth' ); ?>: |
| 273 |
<a href="https://spaces.internet2.edu/display/SHIB/SPMainConfig" target="_blank">Shibboleth 1.3</a> | |
| 274 |
<a href="https://spaces.internet2.edu/display/SHIB2/NativeSPLogoutInitiator" target="_blank">Shibboleth 2</a> |
| 275 |
</td> |
| 276 |
</tr> |
| 277 |
<tr valign="top"> |
| 278 |
<th scope="row"><label for="password_change_url"><?php esc_html_e( 'Password Change URL', 'shibboleth' ); ?></label></th> |
| 279 |
<td> |
| 280 |
<input type="text" id="password_change_url" name="password_change_url" value="<?php echo esc_url( $password_change_url ); ?>" size="50" <?php defined( 'SHIBBOLETH_PASSWORD_CHANGE_URL' ) && disabled( $password_change_url, SHIBBOLETH_PASSWORD_CHANGE_URL ); ?> /><br /> |
| 281 |
<?php esc_html_e( 'If this option is set, Shibboleth users will see a "change password" link on their profile page directing them to this URL.', 'shibboleth' ); ?> |
| 282 |
</td> |
| 283 |
</tr> |
| 284 |
<tr valign="top"> |
| 285 |
<th scope="row"><label for="password_reset_url"><?php esc_html_e( 'Password Reset URL', 'shibboleth' ); ?></label></th> |
| 286 |
<td> |
| 287 |
<input type="text" id="password_reset_url" name="password_reset_url" value="<?php echo esc_url( $password_reset_url ); ?>" size="50" <?php defined( 'SHIBBOLETH_PASSWORD_RESET_URL' ) && disabled( $password_reset_url, SHIBBOLETH_PASSWORD_RESET_URL ); ?> /><br /> |
| 288 |
<?php echo wp_kses_post( __( 'If this option is set, wp-login.php will send <b><i>ALL</i></b> users here to reset their password.', 'shibboleth' ) ); ?> |
| 289 |
</td> |
| 290 |
</tr> |
| 291 |
<tr valign="top"> |
| 292 |
<th scope="row"><label for="attribute_access"><?php esc_html_e( 'Attribute Access', 'shibboleth' ); ?></label></th> |
| 293 |
<td> |
| 294 |
<select id="attribute_access" name="attribute_access" <?php defined( 'SHIBBOLETH_ATTRIBUTE_ACCESS_METHOD' ) && disabled( $attribute_access, SHIBBOLETH_ATTRIBUTE_ACCESS_METHOD ); ?>> |
| 295 |
<option value="standard" <?php selected( $attribute_access, 'standard' ); ?>><?php esc_html_e( 'Environment Variables', 'shibboleth' ); ?></option> |
| 296 |
<option value="redirect" <?php selected( $attribute_access, 'redirect' ); ?>><?php esc_html_e( 'Redirected Environment Variables', 'shibboleth' ); ?></option> |
| 297 |
<option value="http" <?php selected( $attribute_access, 'http' ); ?>><?php esc_html_e( 'HTTP Headers', 'shibboleth' ); ?></option> |
| 298 |
<option value="custom" <?php selected( $attribute_access, 'custom' ); ?>><?php esc_html_e( 'Custom Prefix', 'shibboleth' ); ?></option> |
| 299 |
</select> |
| 300 |
<p> |
| 301 |
<?php |
| 302 |
echo wp_kses_post( |
| 303 |
__( |
| 304 |
'By default, attributes passed from your Shibboleth Service Provider will be accessed using standard environment variables. |
| 305 |
For most users, leaving these defaults is perfectly fine. If you are running a special server configuration that results in environment variables |
| 306 |
being sent with the prefix <code>REDIRECT_</code>, you should select the "Redirected Environment Variables" option. If you are running |
| 307 |
your Shibboleth Service Provider on a reverse proxy, you should select the "HTTP Headers" option and, if at all possible, add a spoofkey below. |
| 308 |
If you are running Shibboleth with a custom prefix, you should select the "Custom Prefix" option and complete the "Custom Attribute Access Prefix" field that appears below.', |
| 309 |
'shibboleth' |
| 310 |
) |
| 311 |
); |
| 312 |
?> |
| 313 |
</p> |
| 314 |
</td> |
| 315 |
</tr> |
| 316 |
<tr id="attribute_custom_access_row" <?php echo ( 'custom' === $attribute_access ? '' : 'style="display:none;"' ); ?>> |
| 317 |
<th scope="row"><label for="attribute_custom_access"><?php esc_html_e( 'Custom Attribute Access Prefix', 'shibboleth' ); ?></label></th> |
| 318 |
<td> |
| 319 |
<input type="text" id="attribute_custom_access" name="attribute_custom_access" value="<?php echo esc_attr( $attribute_custom_access ); ?>" size="50" <?php defined( 'SHIBBOLETH_ATTRIBUTE_CUSTOM_ACCESS_METHOD' ) && disabled( $attribute_custom_access, SHIBBOLETH_ATTRIBUTE_CUSTOM_ACCESS_METHOD ); ?> /><br /> |
| 320 |
<p> |
| 321 |
<?php |
| 322 |
echo wp_kses_post( |
| 323 |
__( |
| 324 |
'If you wish to use a custom attribute access prefix, enter it here. This field is case-insensitive. |
| 325 |
<br /><b>WARNING:</b> If you incorrectly set this option, you will force <b><i>ALL</i></b> attempts to authenticate with Shibboleth to fail.', |
| 326 |
'shibboleth' |
| 327 |
) |
| 328 |
); |
| 329 |
?> |
| 330 |
</p> |
| 331 |
</td> |
| 332 |
</tr> |
| 333 |
<tr id="spoofkey_row" <?php echo ( 'http' === $attribute_access ? '' : 'style="display:none;"' ); ?>> |
| 334 |
<th scope="row"><label for="spoofkey"><?php esc_html_e( 'Spoof Key', 'shibboleth' ); ?></label></th> |
| 335 |
<td> |
| 336 |
<input type="text" id="spoofkey" name="spoofkey" value="<?php echo esc_attr( $spoofkey ); ?>" size="50" <?php defined( 'SHIBBOLETH_SPOOF_KEY' ) && disabled( $spoofkey, SHIBBOLETH_SPOOF_KEY ); ?> /><br /> |
| 337 |
<p> |
| 338 |
<?php |
| 339 |
echo wp_kses_post( |
| 340 |
__( |
| 341 |
'For more details on setting a spoof key on the Shibboleth Service Provider, see <a href="https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPSpoofChecking">this wiki document</a>. |
| 342 |
<br /><b>WARNING:</b> If you incorrectly set this option, you will force <b><i>ALL</i></b> attempts to authenticate with Shibboleth to fail.', |
| 343 |
'shibboleth' |
| 344 |
) |
| 345 |
); |
| 346 |
?> |
| 347 |
</p> |
| 348 |
</td> |
| 349 |
</tr> |
| 350 |
<tr id="attribute_access_fallback_row" <?php echo 'standard' === $attribute_access ? 'style="display:none;"' : ''; ?>> |
| 351 |
<th scope="row"><label for="attribute_access_fallback"><?php esc_html_e( 'Enable Fallback Attribute Access', 'shibboleth' ); ?></label></th> |
| 352 |
<td> |
| 353 |
<input type="checkbox" id="attribute_access_fallback" name="attribute_access_fallback" <?php checked( (bool) $attribute_access_fallback ); ?> <?php defined( 'SHIBBOLETH_ATTRIBUTE_ACCESS_METHOD_FALLBACK' ) && disabled( $attribute_access_fallback, SHIBBOLETH_ATTRIBUTE_ACCESS_METHOD_FALLBACK ); ?> /> |
| 354 |
<label for="attribute_access_fallback"><?php esc_html_e( 'Allow the standard environment variables to be used as a fallback for attribute access.', 'shibboleth' ); ?></label> |
| 355 |
|
| 356 |
<p> |
| 357 |
<?php |
| 358 |
esc_html_e( |
| 359 |
'If set, this will fallback to standard environment variables when the selected |
| 360 |
attribute access method fails.', |
| 361 |
'shibboleth' |
| 362 |
); |
| 363 |
?> |
| 364 |
</p> |
| 365 |
</td> |
| 366 |
</tr> |
| 367 |
<tr> |
| 368 |
<th scope="row"><label for="default_login"><?php esc_html_e( 'Default Login Method', 'shibboleth' ); ?></label></th> |
| 369 |
<td> |
| 370 |
<input type="checkbox" id="default_login" name="default_login" <?php checked( (bool) $default_login ); ?> <?php defined( 'SHIBBOLETH_DEFAULT_TO_SHIB_LOGIN' ) && disabled( $default_login, SHIBBOLETH_DEFAULT_TO_SHIB_LOGIN ); ?> /> |
| 371 |
<label for="default_login"><?php esc_html_e( 'Use Shibboleth as the default login method for users.', 'shibboleth' ); ?></label> |
| 372 |
|
| 373 |
<p> |
| 374 |
<?php |
| 375 |
esc_html_e( |
| 376 |
'If set, this will cause all standard WordPress login links to initiate Shibboleth |
| 377 |
login instead of local WordPress authentication. Shibboleth login can always be |
| 378 |
initiated from the WordPress login form by clicking the "Log in with Shibboleth" link.', |
| 379 |
'shibboleth' |
| 380 |
); |
| 381 |
?> |
| 382 |
</p> |
| 383 |
</td> |
| 384 |
</tr> |
| 385 |
<tr> |
| 386 |
<th scope="row"><label for="auto_login"><?php esc_html_e( 'Automatic Login', 'shibboleth' ); ?></label></th> |
| 387 |
<td> |
| 388 |
<input type="checkbox" id="auto_login" name="auto_login" <?php checked( (bool) $auto_login ); ?> <?php defined( 'SHIBBOLETH_AUTO_LOGIN' ) && disabled( $auto_login, SHIBBOLETH_AUTO_LOGIN ); ?> /> |
| 389 |
<label for="auto_login"><?php esc_html_e( 'Use Shibboleth to auto-login users.', 'shibboleth' ); ?></label> |
| 390 |
|
| 391 |
<p> |
| 392 |
<?php |
| 393 |
echo wp_kses_post( |
| 394 |
__( |
| 395 |
'If set, this option checks to see if a Shibboleth session exists on every page load, and, |
| 396 |
if it does, forces a <code>wp_signon()</code> call and <code>wp_safe_redirect()</code> back to the <code>$_SERVER[\'REQUEST_URI\']</code>.', |
| 397 |
'shibboleth' |
| 398 |
) |
| 399 |
); |
| 400 |
?> |
| 401 |
</p> |
| 402 |
</td> |
| 403 |
</tr> |
| 404 |
<tr> |
| 405 |
<th scope="row"><label for="disable_local_auth"><?php esc_html_e( 'Disable Local Authentication', 'shibboleth' ); ?></label></th> |
| 406 |
<td> |
| 407 |
<input type="checkbox" id="disable_local_auth" name="disable_local_auth" <?php checked( (bool) $disable_local_auth ); ?> <?php defined( 'SHIBBOLETH_DISABLE_LOCAL_AUTH' ) && disabled( $disable_local_auth, SHIBBOLETH_DISABLE_LOCAL_AUTH ); ?> /> |
| 408 |
<label for="disable_local_auth"><?php esc_html_e( 'Disables local WordPress authentication.', 'shibboleth' ); ?></label> |
| 409 |
<p> |
| 410 |
<?php |
| 411 |
echo wp_kses_post( |
| 412 |
__( |
| 413 |
'<b>WARNING:</b> Disabling local authentication can potentially lock you out of WordPress if you have misconfigured the plugin or have a non-functional Shibboleth Service Provider. |
| 414 |
Make sure that you are confident your configuration is functional before enabling this option.', |
| 415 |
'shibboleth' |
| 416 |
) |
| 417 |
); |
| 418 |
?> |
| 419 |
</p> |
| 420 |
</td> |
| 421 |
</tr> |
| 422 |
<tr valign="top"> |
| 423 |
<th scope="row"><label for="button_text"><?php esc_html_e( 'Button Text', 'shibboleth' ); ?></label></th> |
| 424 |
<td> |
| 425 |
<input type="text" id="button_text" name="button_text" value="<?php echo esc_attr( $button_text ); ?>" size="50" <?php defined( 'SHIBBOLETH_BUTTON_TEXT' ) && disabled( $button_text, SHIBBOLETH_BUTTON_TEXT ); ?> /><br /> |
| 426 |
<p><?php echo wp_kses_post( __( 'Set the text of the button that appears on the <code>wp-login.php</code> page.', 'shibboleth' ) ); ?></p> |
| 427 |
</td> |
| 428 |
</tr> |
| 429 |
<?php |
| 430 |
/** |
| 431 |
* Action shibboleth_options_table |
| 432 |
* Add your own Shibboleth options items to the Shibboleth options table. |
| 433 |
* Note: This is in a <table> so add a <tr> with appropriate styling. |
| 434 |
* |
| 435 |
* @param $shib_headers array |
| 436 |
* @param $shib_roles array |
| 437 |
* @since 1.4 |
| 438 |
* @todo support new structure of table and tabs |
| 439 |
*/ |
| 440 |
// do_action( 'shibboleth_options_table', $shib_headers, $shib_roles ); |
| 441 |
?> |
| 442 |
</table> |
| 443 |
|
| 444 |
<br class="clear" /> |
| 445 |
|
| 446 |
<script type="text/javascript"> |
| 447 |
var attribute_access = document.getElementById("attribute_access"); |
| 448 |
attribute_access.onchange=AttributeAccessMethod; |
| 449 |
function AttributeAccessMethod() { |
| 450 |
var attribute_access = document.getElementById("attribute_access"); |
| 451 |
var selectedValue = attribute_access.options[attribute_access.selectedIndex].value; |
| 452 |
|
| 453 |
if (selectedValue === "custom") { |
| 454 |
document.getElementById("attribute_custom_access_row").style.display = "table-row"; |
| 455 |
document.getElementById("attribute_access_fallback_row").style.display = "table-row"; |
| 456 |
document.getElementById("spoofkey_row").style.display = "none"; |
| 457 |
} else if (selectedValue === "http") { |
| 458 |
document.getElementById("attribute_custom_access_row").style.display = "none"; |
| 459 |
document.getElementById("attribute_access_fallback_row").style.display = "table-row"; |
| 460 |
document.getElementById("spoofkey_row").style.display = "table-row"; |
| 461 |
} else if (selectedValue === "standard") { |
| 462 |
document.getElementById("attribute_custom_access_row").style.display = "none"; |
| 463 |
document.getElementById("attribute_access_fallback_row").style.display = "none"; |
| 464 |
document.getElementById("spoofkey_row").style.display = "none"; |
| 465 |
} else { |
| 466 |
document.getElementById("attribute_custom_access_row").style.display = "none"; |
| 467 |
document.getElementById("attribute_access_fallback_row").style.display = "table-row"; |
| 468 |
document.getElementById("spoofkey_row").style.display = "none"; |
| 469 |
} |
| 470 |
} |
| 471 |
</script> |
| 472 |
|
| 473 |
<?php |
| 474 |
break; |
| 475 |
case 'user': |
| 476 |
$constant = false; |
| 477 |
list( $shib_headers, $shib_headers_constant ) = shibboleth_getoption( 'shibboleth_headers', array(), true, true ); |
| 478 |
$constant = $constant || $shib_headers_constant; |
| 479 |
list( $create_accounts, $from_constant ) = shibboleth_getoption( 'shibboleth_create_accounts', false, false, true ); |
| 480 |
$constant = $constant || $from_constant; |
| 481 |
list( $auto_combine_accounts, $from_constant ) = shibboleth_getoption( 'shibboleth_auto_combine_accounts', false, false, true ); |
| 482 |
$constant = $constant || $from_constant; |
| 483 |
list( $manually_combine_accounts, $from_constant ) = shibboleth_getoption( 'shibboleth_manually_combine_accounts', false, false, true ); |
| 484 |
$constant = $constant || $from_constant; |
| 485 |
?> |
| 486 |
|
| 487 |
|
| 488 |
<h2><?php esc_html_e( 'User Configuration', 'shibboleth' ); ?></h2> |
| 489 |
<?php if ( $constant ) { ?> |
| 490 |
<div class="notice notice-warning"> |
| 491 |
<p><?php echo wp_kses_post( __( '<strong>Note:</strong> Some options below are defined in the <code>wp-config.php</code> file as constants and cannot be modified from this page.', 'shibboleth' ) ); ?></p> |
| 492 |
</div> |
| 493 |
<?php } ?> |
| 494 |
<h4><?php esc_html_e( 'User Profile Data', 'shibboleth' ); ?></h4> |
| 495 |
|
| 496 |
<p> |
| 497 |
<?php |
| 498 |
echo wp_kses_post( |
| 499 |
__( |
| 500 |
'Define the Shibboleth headers which should be mapped to each user profile attribute. These |
| 501 |
header names are configured in <code>attribute-map.xml</code> (for Shibboleth 2.x) or |
| 502 |
<code>AAP.xml</code> (for Shibboleth 1.x).', |
| 503 |
'shibboleth' |
| 504 |
) |
| 505 |
); |
| 506 |
?> |
| 507 |
</p> |
| 508 |
|
| 509 |
<p> |
| 510 |
<?php esc_html_e( 'Wiki Documentation', 'shibboleth' ); ?>: |
| 511 |
<a href="https://spaces.internet2.edu/display/SHIB/AttributeAcceptancePolicy" target="_blank">Shibboleth 1.3</a> | |
| 512 |
<a href="https://spaces.internet2.edu/display/SHIB2/NativeSPAddAttribute" target="_blank">Shibboleth 2</a> |
| 513 |
</p> |
| 514 |
|
| 515 |
<table class="form-table optiontable editform" cellspacing="2" cellpadding="5"> |
| 516 |
<tr valign="top"> |
| 517 |
<th scope="row"><label for="username"><?php esc_html_e( 'Username' ); ?></label></th> |
| 518 |
<td> |
| 519 |
<input type="text" id="username" name="headers[username][name]" value="<?php echo esc_attr( $shib_headers['username']['name'] ); ?>" <?php disabled( $shib_headers_constant ); ?>/> |
| 520 |
</td> |
| 521 |
<td width="60%"> |
| 522 |
<input type="checkbox" id="username_managed" name="headers[username][managed]" <?php checked( true ); ?><?php disabled( true ); ?>/> <?php esc_html_e( 'Managed', 'shibboleth' ); ?> |
| 523 |
</td> |
| 524 |
</tr> |
| 525 |
<tr valign="top"> |
| 526 |
<th scope="row"><label for="first_name"><?php esc_html_e( 'First name' ); ?></label></th> |
| 527 |
<td> |
| 528 |
<input type="text" id="first_name" name="headers[first_name][name]" value="<?php echo esc_attr( $shib_headers['first_name']['name'] ); ?>" <?php disabled( $shib_headers_constant ); ?>/> |
| 529 |
</td> |
| 530 |
<td> |
| 531 |
<input type="checkbox" id="first_name_managed" name="headers[first_name][managed]" <?php isset( $shib_headers['first_name']['managed'] ) && checked( $shib_headers['first_name']['managed'], 'on' ); ?><?php disabled( $shib_headers_constant ); ?> /> <?php esc_html_e( 'Managed', 'shibboleth' ); ?> |
| 532 |
</td> |
| 533 |
</tr> |
| 534 |
<tr valign="top"> |
| 535 |
<th scope="row"><label for="last_name"><?php esc_html_e( 'Last name' ); ?></label></th> |
| 536 |
<td> |
| 537 |
<input type="text" id="last_name" name="headers[last_name][name]" value="<?php echo esc_attr( $shib_headers['last_name']['name'] ); ?>" <?php disabled( $shib_headers_constant ); ?>/> |
| 538 |
</td> |
| 539 |
<td> |
| 540 |
<input type="checkbox" id="last_name_managed" name="headers[last_name][managed]" <?php isset( $shib_headers['last_name']['managed'] ) && checked( $shib_headers['last_name']['managed'], 'on' ); ?><?php disabled( $shib_headers_constant ); ?> /> <?php esc_html_e( 'Managed', 'shibboleth' ); ?> |
| 541 |
</td> |
| 542 |
</tr> |
| 543 |
<tr valign="top"> |
| 544 |
<th scope="row"><label for="nickname"><?php esc_html_e( 'Nickname' ); ?></label></th> |
| 545 |
<td> |
| 546 |
<input type="text" id="nickname" name="headers[nickname][name]" value="<?php echo esc_attr( $shib_headers['nickname']['name'] ); ?>" <?php disabled( $shib_headers_constant ); ?>/> |
| 547 |
</td> |
| 548 |
<td> |
| 549 |
<input type="checkbox" id="nickname_managed" name="headers[nickname][managed]" <?php isset( $shib_headers['nickname']['managed'] ) && checked( $shib_headers['nickname']['managed'], 'on' ); ?><?php disabled( $shib_headers_constant ); ?>/> <?php esc_html_e( 'Managed', 'shibboleth' ); ?> |
| 550 |
</td> |
| 551 |
</tr> |
| 552 |
<tr valign="top"> |
| 553 |
<th scope="row"><label for="_display_name"><?php esc_html_e( 'Display name', 'shibboleth' ); ?></label></th> |
| 554 |
<td> |
| 555 |
<input type="text" id="_display_name" name="headers[display_name][name]" value="<?php echo esc_attr( $shib_headers['display_name']['name'] ); ?>" <?php disabled( $shib_headers_constant ); ?>/> |
| 556 |
</td> |
| 557 |
<td> |
| 558 |
<input type="checkbox" id="display_name_managed" name="headers[display_name][managed]" <?php isset( $shib_headers['display_name']['managed'] ) && checked( $shib_headers['display_name']['managed'], 'on' ); ?><?php disabled( $shib_headers_constant ); ?>/> <?php esc_html_e( 'Managed', 'shibboleth' ); ?> |
| 559 |
</td> |
| 560 |
</tr> |
| 561 |
<tr valign="top"> |
| 562 |
<th scope="row"><label for="email"><?php esc_html_e( 'Email Address', 'shibboleth' ); ?></label></th> |
| 563 |
<td> |
| 564 |
<input type="text" id="email" name="headers[email][name]" value="<?php echo esc_attr( $shib_headers['email']['name'] ); ?>" <?php disabled( $shib_headers_constant ); ?>/> |
| 565 |
</td> |
| 566 |
<td> |
| 567 |
<input type="checkbox" id="email_managed" name="headers[email][managed]" <?php isset( $shib_headers['email']['managed'] ) && checked( $shib_headers['email']['managed'], 'on' ); ?><?php disabled( $shib_headers_constant ); ?> /> <?php esc_html_e( 'Managed', 'shibboleth' ); ?> |
| 568 |
</td> |
| 569 |
</tr> |
| 570 |
</table> |
| 571 |
|
| 572 |
<p> |
| 573 |
<?php |
| 574 |
echo wp_kses_post( |
| 575 |
__( |
| 576 |
'<em>Managed</em> profile fields are updated each time the user logs in using the current |
| 577 |
data provided by Shibboleth. Additionally, users will be prevented from manually updating these |
| 578 |
fields from within WordPress. Note that Shibboleth data is always used to populate the user |
| 579 |
profile during initial account creation.', |
| 580 |
'shibboleth' |
| 581 |
) |
| 582 |
); |
| 583 |
?> |
| 584 |
</p> |
| 585 |
|
| 586 |
<table class="form-table"> |
| 587 |
<tr valign="top"> |
| 588 |
<th scope="row"><label for="create_accounts"><?php esc_html_e( 'Automatically Create Accounts', 'shibboleth' ); ?></label></th> |
| 589 |
<td> |
| 590 |
<input type="checkbox" id="create_accounts" name="create_accounts" <?php checked( (bool) $create_accounts ); ?> <?php defined( 'SHIBBOLETH_CREATE_ACCOUNTS' ) && disabled( $create_accounts, SHIBBOLETH_CREATE_ACCOUNTS ); ?> /> |
| 591 |
<label for="create_accounts"><?php esc_html_e( 'Automatically create new users if they do not exist in the WordPress database.', 'shibboleth' ); ?></label> |
| 592 |
<p> |
| 593 |
<?php |
| 594 |
echo wp_kses_post( |
| 595 |
__( |
| 596 |
'Automatically created users will be provisioned with the role that they map to, as defined on the <a href="?page=shibboleth-options&tab=authorization">Authorization</a> tab. |
| 597 |
If a user does not match any mappings, they will be placed into the role selected under "Default Role" on the <a href="?page=shibboleth-options&tab=authorization">Authorization</a> tab.', |
| 598 |
'shibboleth' |
| 599 |
) |
| 600 |
); |
| 601 |
?> |
| 602 |
</p> |
| 603 |
</td> |
| 604 |
</tr> |
| 605 |
<tr> |
| 606 |
<th scope="row"><label for="auto_combine_accounts"><?php esc_html_e( 'Combine Local and Shibboleth Accounts', 'shibboleth' ); ?></label></th> |
| 607 |
<td> |
| 608 |
<select id="auto_combine_accounts" name="auto_combine_accounts" <?php defined( 'SHIBBOLETH_AUTO_COMBINE_ACCOUNTS' ) && disabled( $auto_combine_accounts, SHIBBOLETH_AUTO_COMBINE_ACCOUNTS ); ?>> |
| 609 |
<option value="prevent" <?php selected( $auto_combine_accounts, 'disallow' ); ?>>Prevent Automatic Account Merging</option> |
| 610 |
<option value="allow" <?php selected( $auto_combine_accounts, 'allow' ); ?>>Allow Automatic Account Merging</option> |
| 611 |
<option value="bypass" <?php selected( $auto_combine_accounts, 'bypass' ); ?>>Allow Automatic Account Merging (Bypass Username Management)</option> |
| 612 |
</select> |
| 613 |
<p> |
| 614 |
<?php |
| 615 |
echo wp_kses_post( |
| 616 |
__( |
| 617 |
'By default, users will receive an error if they log in via Shibboleth and have a pre-existing local WordPress user account that has not previously been linked with Shibboleth. <br /><br /> |
| 618 |
<code>Prevent Automatic Account Merging</code>: This option prevents automatic merging of accounts.<br /> |
| 619 |
<code>Allow Automatic Account Merging</code>: This option prevents users from experiencing an error if they share a username with both a local and a Shibboleth account. |
| 620 |
This option <b>WILL NOT</b> prevent an error if another user shares the email passed via Shibboleth attributes.<br /> |
| 621 |
<code>Allow Automatic Account Merging (Bypass Username Management)</code>: Occasionally, users have pre-existing local WordPress user accounts with a different username than that provided via Shibboleth attributes. |
| 622 |
This option prevents users from experiencing an error in this case by bypassing the username management requirement.', |
| 623 |
'shibboleth' |
| 624 |
) |
| 625 |
); |
| 626 |
?> |
| 627 |
</p> |
| 628 |
</td> |
| 629 |
</tr> |
| 630 |
<tr> |
| 631 |
<th scope="row"><label for="manually_combine_accounts"></label></th> |
| 632 |
<td> |
| 633 |
<select id="manually_combine_accounts" name="manually_combine_accounts" <?php defined( 'SHIBBOLETH_MANUALLY_COMBINE_ACCOUNTS' ) && disabled( $manually_combine_accounts, SHIBBOLETH_MANUALLY_COMBINE_ACCOUNTS ); ?>> |
| 634 |
<option value="prevent" <?php selected( $manually_combine_accounts, 'disallow' ); ?>>Prevent Manual Account Merging</option> |
| 635 |
<option value="allow" <?php selected( $manually_combine_accounts, 'allow' ); ?>>Allow Manual Account Merging</option> |
| 636 |
<option value="bypass" <?php selected( $manually_combine_accounts, 'bypass' ); ?>>Allow Manual Account Merging (Bypass Username Management)</option> |
| 637 |
</select> |
| 638 |
<p> |
| 639 |
<?php |
| 640 |
echo wp_kses_post( |
| 641 |
__( |
| 642 |
'This option offers users the ability to manually link their local accounts to Shibboleth from their profile page.<br /><br /> |
| 643 |
<code>Prevent Manual Account Merging</code>: This option does not allow users to manually link accounts.<br /> |
| 644 |
<code>Allow Manual Account Merging</code>: This option allows users to manually link accounts if they share a username with both a local and a Shibboleth account. |
| 645 |
This option <b>WILL NOT</b> prevent an error if another user shares the email passed via Shibboleth attributes.<br /> |
| 646 |
<code>Allow Manual Account Merging (Bypass Username Management)</code>: Occasionally, users have pre-existing local WordPress user accounts with a different username than that provided via Shibboleth attributes. |
| 647 |
This option allows users to manually link accounts by bypassing the username management requirement.', |
| 648 |
'shibboleth' |
| 649 |
) |
| 650 |
); |
| 651 |
?> |
| 652 |
</p> |
| 653 |
</td> |
| 654 |
</tr> |
| 655 |
</table> |
| 656 |
|
| 657 |
<?php |
| 658 |
break; |
| 659 |
case 'authorization': |
| 660 |
$constant = false; |
| 661 |
list( $shib_roles, $shib_roles_constant ) = shibboleth_getoption( 'shibboleth_roles', array(), true, true ); |
| 662 |
$constant = $constant || $shib_roles_constant; |
| 663 |
list( $default_role, $from_constant ) = shibboleth_getoption( 'shibboleth_default_role', false, false, true ); |
| 664 |
$constant = $constant || $from_constant; |
| 665 |
list( $update_roles, $from_constant ) = shibboleth_getoption( 'shibboleth_update_roles', false, false, true ); |
| 666 |
$constant = $constant || $from_constant; |
| 667 |
?> |
| 668 |
|
| 669 |
<h3><?php esc_html_e( 'User Role Mappings', 'shibboleth' ); ?></h3> |
| 670 |
<?php if ( $constant ) { ?> |
| 671 |
<div class="notice notice-warning"> |
| 672 |
<p><?php echo wp_kses_post( __( '<strong>Note:</strong> Some options below are defined in the <code>wp-config.php</code> file as constants and cannot be modified from this page.', 'shibboleth' ) ); ?></p> |
| 673 |
</div> |
| 674 |
<?php |
| 675 |
} |
| 676 |
|
| 677 |
/** |
| 678 |
* Filter shibboleth_role_mapping_override |
| 679 |
* Return true to override the default user role mapping form |
| 680 |
* |
| 681 |
* @param boolean - default value false |
| 682 |
* @return boolean - true if override |
| 683 |
* @since 1.4 |
| 684 |
* |
| 685 |
* Use in conjunction with shibboleth_role_mapping_form action below |
| 686 |
*/ |
| 687 |
if ( apply_filters( 'shibboleth_role_mapping_override', false ) === false ) { |
| 688 |
?> |
| 689 |
|
| 690 |
<p> |
| 691 |
<?php |
| 692 |
esc_html_e( |
| 693 |
'Users can be placed into one of WordPress\'s internal roles based on any |
| 694 |
attribute. For example, you could define a special eduPersonEntitlement value |
| 695 |
that designates the user as a WordPress Administrator. Or you could automatically |
| 696 |
place all users with an eduPersonAffiliation of "faculty" in the Author role.', |
| 697 |
'shibboleth' |
| 698 |
); |
| 699 |
?> |
| 700 |
</p> |
| 701 |
|
| 702 |
<p> |
| 703 |
<?php |
| 704 |
echo wp_kses_post( |
| 705 |
__( |
| 706 |
'<strong>Current Limitations:</strong> While WordPress supports users having |
| 707 |
multiple roles, the Shibboleth plugin will only place the user in the highest ranking |
| 708 |
role. Only a single header/value pair is supported for each user role. This may be |
| 709 |
expanded in the future to support multiple header/value pairs or regular expression |
| 710 |
values. In the meantime, you can use the <em>shibboleth_roles</em> and |
| 711 |
<em>shibboleth_user_role</em> WordPress filters to provide your own logic for assigning |
| 712 |
user roles.', |
| 713 |
'shibboleth' |
| 714 |
) |
| 715 |
); |
| 716 |
?> |
| 717 |
</p> |
| 718 |
|
| 719 |
<style type="text/css"> |
| 720 |
#role_mappings { padding: 0; } |
| 721 |
#role_mappings thead th { padding: 5px 10px; } |
| 722 |
#role_mappings td, #role_mappings th { border-bottom: 0px; } |
| 723 |
</style> |
| 724 |
|
| 725 |
<table class="form-table optiontable editform" cellspacing="2" cellpadding="5" width="100%"> |
| 726 |
<tr> |
| 727 |
<th scope="row"><?php esc_html_e( 'Role Mappings', 'shibboleth' ); ?></th> |
| 728 |
<td id="role_mappings"> |
| 729 |
<table id=""> |
| 730 |
<col width="10%"></col> |
| 731 |
<col></col> |
| 732 |
<col></col> |
| 733 |
<thead> |
| 734 |
<tr> |
| 735 |
<th></th> |
| 736 |
<th scope="column"><?php esc_html_e( 'Header Name', 'shibboleth' ); ?></th> |
| 737 |
<th scope="column"><?php esc_html_e( 'Header Value', 'shibboleth' ); ?></th> |
| 738 |
</tr> |
| 739 |
</thead> |
| 740 |
<tbody> |
| 741 |
<?php |
| 742 |
|
| 743 |
foreach ( $wp_roles->role_names as $key => $name ) { |
| 744 |
$header = ''; |
| 745 |
if ( isset( $shib_roles[ $key ]['header'] ) ) { |
| 746 |
$header = $shib_roles[ $key ]['header']; |
| 747 |
} |
| 748 |
$value = ''; |
| 749 |
if ( isset( $shib_roles[ $key ]['value'] ) ) { |
| 750 |
$value = $shib_roles[ $key ]['value']; |
| 751 |
} |
| 752 |
echo ' |
| 753 |
<tr valign="top"> |
| 754 |
<th scope="row">' . esc_html( $name ) . '</th> |
| 755 |
<td><input type="text" id="role_' . esc_attr( $key ) . '_header" name="shibboleth_roles[' . esc_attr( $key ) . '][header]" value="' . esc_attr( $header ) . '" style="width: 100%" ' . disabled( $shib_roles_constant, true, false ) . '/></td> |
| 756 |
<td><input type="text" id="role_' . esc_attr( $key ) . '_value" name="shibboleth_roles[' . esc_attr( $key ) . '][value]" value="' . esc_attr( $value ) . '" style="width: 100%" ' . disabled( $shib_roles_constant, true, false ) . '/></td> |
| 757 |
</tr>'; |
| 758 |
} |
| 759 |
?> |
| 760 |
|
| 761 |
</tbody> |
| 762 |
</table> |
| 763 |
</td> |
| 764 |
</tr> |
| 765 |
|
| 766 |
<tr> |
| 767 |
<th scope="row"><?php esc_html_e( 'Default Role', 'shibboleth' ); ?></th> |
| 768 |
<td> |
| 769 |
<select id="default_role" name="default_role" <?php defined( 'SHIBBOLETH_DEFAULT_ROLE' ) && disabled( $default_role, SHIBBOLETH_DEFAULT_ROLE ); ?>> |
| 770 |
<option value=""><?php esc_html_e( '(no role)', 'shibboleth' ); ?></option> |
| 771 |
<option value="_no_account" <?php selected( $default_role, '_no_account' ); ?>><?php esc_html_e( '(skip \'no role\' account creation)', 'shibboleth' ); ?></option> |
| 772 |
<?php |
| 773 |
foreach ( $wp_roles->role_names as $key => $name ) { |
| 774 |
echo '<option value="' . esc_attr( $key ) . '"' . selected( $default_role, $key ) . '>' . esc_html( $name ) . '</option>'; |
| 775 |
} |
| 776 |
?> |
| 777 |
</select> |
| 778 |
|
| 779 |
<p> |
| 780 |
<?php |
| 781 |
esc_html_e( |
| 782 |
'If a user does not map into any of the roles above, they will |
| 783 |
be placed into the default role. If there is no default role, the |
| 784 |
user will not be assigned a role when creating an account with |
| 785 |
Shibboleth. If "(skip \'no role\' account creation)" is selected, the user |
| 786 |
will not be able to create an account with Shibboleth.', |
| 787 |
'shibboleth' |
| 788 |
); |
| 789 |
?> |
| 790 |
</p> |
| 791 |
</td> |
| 792 |
</tr> |
| 793 |
|
| 794 |
<tr> |
| 795 |
<th scope="row"><label for="update_roles"><?php esc_html_e( 'Update User Roles', 'shibboleth' ); ?></label></th> |
| 796 |
<td> |
| 797 |
<input type="checkbox" id="update_roles" name="update_roles" <?php checked( (bool) $update_roles ); ?> <?php defined( 'SHIBBOLETH_UPDATE_ROLES' ) && disabled( $update_roles, SHIBBOLETH_UPDATE_ROLES ); ?> |
| 798 |
/> |
| 799 |
<label for="update_roles"><?php esc_html_e( 'Use Shibboleth data to update user role mappings each time the user logs in.', 'shibboleth' ); ?></label> |
| 800 |
|
| 801 |
<p> |
| 802 |
<?php |
| 803 |
echo wp_kses_post( |
| 804 |
__( |
| 805 |
'Be aware that if you use this option, you should <strong>not</strong> update user roles manually, |
| 806 |
since they will be overwritten from Shibboleth the next time the user logs in. Note that Shibboleth data |
| 807 |
is always used to populate the initial user role during account creation.', |
| 808 |
'shibboleth' |
| 809 |
) |
| 810 |
); |
| 811 |
?> |
| 812 |
</p> |
| 813 |
</td> |
| 814 |
</tr> |
| 815 |
</table> |
| 816 |
|
| 817 |
<?php |
| 818 |
} else { |
| 819 |
/** |
| 820 |
* Action shibboleth_role_mapping_form |
| 821 |
* Roll your own custom Shibboleth role mapping admin UI |
| 822 |
* |
| 823 |
* @param $shib_headers array |
| 824 |
* @param $shib_roles array |
| 825 |
* @since 1.4 |
| 826 |
* |
| 827 |
* Use in conjunction with shibboleth_role_mapping_override filter |
| 828 |
*/ |
| 829 |
do_action( 'shibboleth_role_mapping_form', $shib_headers, $shib_roles ); |
| 830 |
} // if ( form override ) |
| 831 |
break; |
| 832 |
case 'logging': |
| 833 |
$constant = false; |
| 834 |
list( $shib_logging, $shib_logging_constant ) = shibboleth_getoption( 'shibboleth_logging', array(), true, true ); |
| 835 |
$constant = $constant || $shib_logging_constant; |
| 836 |
?> |
| 837 |
<h3><?php esc_html_e( 'Logging Configuration', 'shibboleth' ); ?></h3> |
| 838 |
<?php if ( $constant ) { ?> |
| 839 |
<div class="notice notice-warning"> |
| 840 |
<p><?php echo wp_kses_post( __( '<strong>Note:</strong> Some options below are defined in the <code>wp-config.php</code> file as constants and cannot be modified from this page.', 'shibboleth' ) ); ?></p> |
| 841 |
</div> |
| 842 |
<?php } ?> |
| 843 |
<table class="form-table"> |
| 844 |
<tr> |
| 845 |
<th scope="row"><label for="log_auth"><?php esc_html_e( 'Log Authentication Attempts', 'shibboleth' ); ?></label></th> |
| 846 |
<td> |
| 847 |
<input type="checkbox" id="log_auth" name="logging[]" value="auth" <?php checked( in_array( 'auth', $shib_logging, true ) ); ?> <?php defined( $shib_logging_constant ) && disabled( $shib_logging_constant, true, false ); ?> /> |
| 848 |
<label for="log_auth"><?php esc_html_e( 'Log when a user attempts to authenticate using Shibboleth.', 'shibboleth' ); ?></label> |
| 849 |
</td> |
| 850 |
</tr> |
| 851 |
<tr> |
| 852 |
<th scope="row"><label for="log_account_merge"><?php esc_html_e( 'Log Account Merges', 'shibboleth' ); ?></label></th> |
| 853 |
<td> |
| 854 |
<input type="checkbox" id="log_account_merge" name="logging[]" value="account_merge" <?php checked( in_array( 'account_merge', $shib_logging, true ) ); ?> <?php defined( $shib_logging_constant ) && disabled( $shib_logging_constant, true, false ); ?> /> |
| 855 |
<label for="log_account_merge"><?php esc_html_e( 'Log when a user attempts to merge their account, either manually or automatically.', 'shibboleth' ); ?></label> |
| 856 |
</td> |
| 857 |
</tr> |
| 858 |
<tr> |
| 859 |
<th scope="row"><label for="log_account_create"><?php esc_html_e( 'Log Account Creation', 'shibboleth' ); ?></label></th> |
| 860 |
<td> |
| 861 |
<input type="checkbox" id="log_account_create" name="logging[]" value="account_create" <?php checked( in_array( 'account_create', $shib_logging, true ) ); ?> <?php defined( $shib_logging_constant ) && disabled( $shib_logging_constant, true, false ); ?> /> |
| 862 |
<label for="log_account_create"><?php esc_html_e( 'Log when new accounts are created.', 'shibboleth' ); ?></label> |
| 863 |
</td> |
| 864 |
</tr> |
| 865 |
<tr> |
| 866 |
<th scope="row"><label for="log_role_update"><?php esc_html_e( 'Log Role Update', 'shibboleth' ); ?></label></th> |
| 867 |
<td> |
| 868 |
<input type="checkbox" id="log_role_update" name="logging[]" value="role_update" <?php checked( in_array( 'role_update', $shib_logging, true ) ); ?> <?php defined( $shib_logging_constant ) && disabled( $shib_logging_constant, true, false ); ?> /> |
| 869 |
<label for="log_role_update"><?php esc_html_e( 'Log when the plugin updates a user\'s role.', 'shibboleth' ); ?></label> |
| 870 |
</td> |
| 871 |
</tr> |
| 872 |
</table> |
| 873 |
<?php |
| 874 |
break; |
| 875 |
} |
| 876 |
|
| 877 |
wp_nonce_field( 'shibboleth_update_options' ); |
| 878 |
?> |
| 879 |
<p class="submit"> |
| 880 |
<input type="submit" name="submit" class="button-primary" value="<?php esc_html_e( 'Save Changes' ); ?>" /> |
| 881 |
</p> |
| 882 |
</form> |
| 883 |
</div> |
| 884 |
|
| 885 |
<?php |
| 886 |
} |
| 887 |
|