shibboleth/ 0000755 0001750 0001750 00000000000 13150056356 011325 5 ustar dom dom shibboleth/options-admin.php 0000644 0001750 0001750 00000042765 13147357756 014653 0 ustar dom dom add_help_tab(array( 'title' => 'Shibboleth Help', 'id' => 'shibboleth-help', 'content' => shibboleth_help_text(), )); } /** * Setup multisite admin menus for Shibboleth options. * * @action: network_admin_menu **/ function shibboleth_network_admin_panels() { $hookname = add_submenu_page('settings.php', __('Shibboleth options', 'shibboleth'), __('Shibboleth', 'shibboleth'), 'manage_network_options', 'shibboleth-options', 'shibboleth_options_page' ); $screen = WP_Screen::get($hookname); $screen->add_help_tab(array( 'title' => 'Shibboleth Help', 'id' => 'shibboleth-help', 'content' => shibboleth_help_text(), )); } /** * Add Shibboleth links to the "help" pull down panel. */ function shibboleth_help_text() { $text = '
with an id value of "shibboleth_login" so that * deployers can style this however they choose. */ function shibboleth_login_form() { $login_url = add_query_arg('action', 'shibboleth'); $login_url = remove_query_arg('reauth', $login_url); echo '
' . __('Login with Shibboleth', 'shibboleth') . '
'; } add_action('login_form', 'shibboleth_login_form'); /** * Insert directives into .htaccess file to enable Shibboleth Lazy Sessions. */ function shibboleth_insert_htaccess() { $disabled = defined( 'SHIBBOLETH_DISALLOW_FILE_MODS' ) && SHIBBOLETH_DISALLOW_FILE_MODS; if ( got_mod_rewrite() && ! $disabled ) { $htaccess = get_home_path() . '.htaccess'; $rules = array('AuthType shibboleth', 'Require shibboleth'); insert_with_markers($htaccess, 'Shibboleth', $rules); } } /** * Remove directives from .htaccess file to enable Shibboleth Lazy Sessions. */ function shibboleth_remove_htaccess() { $disabled = defined( 'SHIBBOLETH_DISALLOW_FILE_MODS' ) && SHIBBOLETH_DISALLOW_FILE_MODS; if ( got_mod_rewrite() && ! $disabled ) { $htaccess = get_home_path() . '.htaccess'; insert_with_markers($htaccess, 'Shibboleth', array()); } } /* Custom option functions to correctly use WPMU *_site_option functions when available. */ function shibboleth_get_option($key, $default = false ) { return function_exists('get_site_option') ? get_site_option($key, $default) : get_option($key, $default); } function shibboleth_add_option($key, $value, $autoload = 'yes') { if (function_exists('add_site_option')) { return add_site_option($key, $value); } else { return add_option($key, $value, '', $autoload); } } function shibboleth_update_option($key, $value) { return function_exists('update_site_option') ? update_site_option($key, $value) : update_option($key, $value); } function shibboleth_delete_option($key) { return function_exists('delete_site_option') ? delete_site_option($key) : delete_option($key); } /** * Load localization files. */ function shibboleth_load_textdomain() { load_plugin_textdomain('shibboleth', false, dirname( plugin_basename( __FILE__ ) ) . '/localization/'); } add_action('plugins_loaded', 'shibboleth_load_textdomain'); shibboleth/localization/ 0000755 0001750 0001750 00000000000 13150056356 014015 5 ustar dom dom shibboleth/localization/shibboleth.pot 0000644 0001750 0001750 00000015451 11261510622 016662 0 ustar dom dom # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR Will Norris # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHORattribute-map.xml"
"code> (for Shibboleth 2.x) or AAP.xml
(for Shibboleth 1.x)."
msgstr ""
#: options-admin.php:154
msgid "Username"
msgstr ""
#: options-admin.php:160
msgid "First name"
msgstr ""
#: options-admin.php:164 options-admin.php:171 options-admin.php:178
#: options-admin.php:185 options-admin.php:192
msgid "Managed"
msgstr ""
#: options-admin.php:167
msgid "Last name"
msgstr ""
#: options-admin.php:174
msgid "Nickname"
msgstr ""
#: options-admin.php:181
msgid "Display name"
msgstr ""
#: options-admin.php:188
msgid "Email Address"
msgstr ""
#: options-admin.php:196
msgid ""
"Managed profile fields are updated each time the user logs in using "
"the current data provided by Shibboleth. Additionally, users will be "
"prevented from manually updating these fields from within WordPress. Note "
"that Shibboleth data is always used to populate the user profile during "
"initial account creation."
msgstr ""
#: options-admin.php:203
msgid "User Role Mappings"
msgstr ""
#: options-admin.php:205
msgid ""
"Users can be placed into one of WordPress's internal roles based on any "
"attribute. For example, you could define a special eduPersonEntitlement "
"value that designates the user as a WordPress Administrator. Or you could "
"automatically place all users with an eduPersonAffiliation of \"faculty\" in "
"the Author role."
msgstr ""
#: options-admin.php:210
msgid ""
"Current Limitations: While WordPress supports users having "
"multiple roles, the Shibboleth plugin will only place the user in the "
"highest ranking role. Only a single header/value pair is supported for each "
"user role. This may be expanded in the future to support multiple header/"
"value pairs or regular expression values. In the meantime, you can use the "
"shibboleth_roles and shibboleth_user_role WordPress "
"filters to provide your own logic for assigning user roles."
msgstr ""
#: options-admin.php:227
msgid "Role Mappings"
msgstr ""
#: options-admin.php:236
msgid "Header Name"
msgstr ""
#: options-admin.php:237
msgid "Header Value"
msgstr ""
#: options-admin.php:259
msgid "Default Role"
msgstr ""
#: options-admin.php:262
msgid "(none)"
msgstr ""
#: options-admin.php:271
msgid ""
"If a user does not map into any of the roles above, they will be placed into "
"the default role. If there is no default role, the user will not be able to "
"login with Shibboleth."
msgstr ""
#: options-admin.php:278
msgid "Update User Roles"
msgstr ""
#: options-admin.php:281
msgid ""
"Use Shibboleth data to update user role mappings each time the user logs in."
msgstr ""
#: options-admin.php:283
msgid ""
"Be aware that if you use this option, you should not update "
"user roles manually, since they will be overwritten from Shibboleth the next "
"time the user logs in. Note that Shibboleth data is always used to populate "
"the initial user role during account creation."
msgstr ""
#: options-admin.php:293
msgid "Save Changes"
msgstr ""
#: options-user.php:34
msgid "Some profile fields cannot be changed from WordPress."
msgstr ""
#: options-user.php:73
msgid ""
"Starred fields are managed by Shibboleth and should not be changed from "
"WordPress."
msgstr ""
#: options-user.php:91
msgid "Change Password"
msgstr ""
#: options-user.php:93
msgid "Change your password"
msgstr ""
#: shibboleth.php:269
msgid "You do not have sufficient access."
msgstr ""
#: shibboleth.php:430
msgid "Login with Shibboleth"
msgstr ""
#. Plugin URI of an extension
msgid "http://wordpress.org/extend/plugins/shibboleth"
msgstr ""
#. Description of an extension
msgid ""
"Easily externalize user authentication to a Shibboleth Service Provider"
msgstr ""
#. Author of an extension
msgid "Will Norris"
msgstr ""
#. Author URI of an extension
msgid "http://willnorris.com/"
msgstr ""
shibboleth/options-user.php 0000644 0001750 0001750 00000010467 13147357756 014533 0 ustar dom dom ID, 'shibboleth_account')) {
add_filter('show_password_fields', create_function('$v', 'return false;'));
add_action('admin_footer-profile.php', 'shibboleth_admin_footer_profile');
}
}
function shibboleth_admin_footer_profile() {
$managed_fields = shibboleth_get_managed_user_fields();
if ( !empty($managed_fields) ) {
$selectors = join(',', array_map(create_function('$a', 'return "#$a";'), $managed_fields));
echo '
';
}
}
/**
* For WordPress accounts that were created by Shibboleth, warn the admin of
* Shibboleth managed attributes.
*/
function shibboleth_admin_footer_edit_user() {
global $user_id;
if (get_user_meta($user_id, 'shibboleth_account')) {
$shibboleth_fields = array();
$shibboleth_fields = array_merge($shibboleth_fields, shibboleth_get_managed_user_fields());
if (shibboleth_get_option('shibboleth_update_roles')) {
$shibboleth_fields = array_merge($shibboleth_fields, array('role'));
}
if (!empty($shibboleth_fields)) {
$selectors = array();
foreach($shibboleth_fields as $field) {
$selectors[] = 'label[for=\'' . $field . '\']';
}
echo '
';
}
}
}
/**
* Add change password link to the user profile for Shibboleth users.
*/
function shibboleth_show_user_profile() {
$user = wp_get_current_user();
$password_change_url = shibboleth_get_option('shibboleth_password_change_url');
if (get_user_meta($user->ID, 'shibboleth_account') && !empty($password_change_url) ) {
?>
ID, 'shibboleth_account') ) {
$managed = shibboleth_get_managed_user_fields();
if ( in_array('first_name', $managed) ) {
add_filter('pre_user_first_name', create_function('$n', 'return $GLOBALS["current_user"]->first_name;'));
}
if ( in_array('last_name', $managed) ) {
add_filter('pre_user_last_name', create_function('$n', 'return $GLOBALS["current_user"]->last_name;'));
}
if ( in_array('nickname', $managed) ) {
add_filter('pre_user_nickname', create_function('$n', 'return $GLOBALS["current_user"]->nickname;'));
}
if ( in_array('display_name', $managed) ) {
add_filter('pre_user_display_name', create_function('$n', 'return $GLOBALS["current_user"]->display_name;'));
}
if ( in_array('email', $managed) ) {
add_filter('pre_user_email', create_function('$e', 'return $GLOBALS["current_user"]->user_email;'));
}
}
}
shibboleth/README.md 0000644 0001750 0001750 00000000713 13147357756 012623 0 ustar dom dom Shibboleth
==========
This is the official development repository (as of version 1.8) for the [Shibboleth plugin for WordPress](http://wordpress.org/plugins/shibboleth), originally by [Will Norris](https://github.com/willnorris) and [Michael Yoshitaka Erlewine](https://github.com/mitcho).
Read [readme.txt](https://github.com/michaelryanmcneill/shibboleth/blob/master/readme.txt) for usage information.
The project accepts contributions via pull request!
shibboleth/readme.txt 0000644 0001750 0001750 00000024614 13150056356 013332 0 ustar dom dom === Shibboleth ===
Contributors: michaelryanmcneill, willnorris, mitchoyoshitaka
Tags: shibboleth, authentication, login, saml
Requires at least: 3.3
Tested up to: 4.8.1
Stable tag: 1.8
Allows WordPress to externalize user authentication and account creation to a
Shibboleth Service Provider.
== Description ==
This plugin is designed to support integrating your WordPress
site into your existing identity management infrastructure using a
[Shibboleth] Service Provider.
WordPress can be configured so that all standard login requests will be sent to
your configured Shibboleth Identity Provider or Discovery Service. Upon
successful authentication, a new WordPress account will be automatically
provisioned for the user if one does not already exist. User attributes
(username, first name, last name, display name, nickname, and email address)
can be synchronized with your enterprise's system of record each time the user
logs into WordPress.
Finally, the user's role within WordPress can be automatically set (and
continually updated) based on any attribute Shibboleth provides. For example,
you may decide to give users with an eduPersonAffiliation value of *faculty*
the WordPress role of *editor*, while the eduPersonAffiliation value of
*student* maps to the WordPress role *contributor*. Or you may choose to limit
access to WordPress altogether using a special eduPersonEntitlement value.
[Shibboleth]: http://shibboleth.internet2.edu/
= Contribute on GitHub =
This plugin is actively maintained by the community, [using
GitHub](https://github.com/michaelryanmcneill/shibboleth). Contributions are welcome, via
pull request, [on GitHub](https://github.com/michaelryanmcneill/shibboleth). Issues can be
submitted [on the issue tracker](https://github.com/michaelryanmcneill/shibboleth/issues).
== Installation ==
First and foremost, you must have the Shibboleth Service Provider [properly
installed][] and working. If you don't have Shibboleth working yet, I assure
you that you won't get this plugin to work. This plugin expects Shibboleth to
be configured to use "lazy sessions", so ensure that you have Shibboleth
configured with requireSession set to "false". Upon activation, the plugin
will attempt to set the appropriate directives in WordPress's .htaccess file.
If it is unable to do so, you can add this manually:
AuthType shibboleth
Require shibboleth
The option to automatically login the users into WordPress also works when not
using the lazy session options as it will force login into WordPress. In other
words, if the user has an active session and you are requiring authentication
to access this WordPress site and they need to be logged into WordPress, then
they will be logged in without having to use the WordPress login page.
This works very well for sites that use WordPress for internal ticketing and
helpdesk functions where any access to content requires authentication.
Consider the following .htaccess options when used in conjunction with the
automatic login feature
AuthType shibboleth
ShibRequestSetting requireSession 1
Require valid-user
OR
Authtype shibboleth
ShibRequestSetting requireSession 1
Require isMemberOf group1 group2
Require sAMAccountName user1 user 2
NOTE: If the plugin is successful in updating your .htaccess file, it will
place the option between a marked block:
BEGIN Shibboleth
END Shibboleth
If you add more options, you may want to consider moving all configuration
options out of this block as they will be cleared out upon deactivation
of the plugin.
= For single-user WordPress =
Upload the `shibboleth` folder to your WordPress plugins folder (probably
`/wp-content/plugins`), and activate it through the WordPress admin panel.
Configure it from the Shibboleth settings page.
= For WordPress Multisite =
Upload the `shibboleth` folder to your `mu-plugins` folder
(probably `/wp-content/mu-plugins`). Move the file `shibboleth-mu.php` from
the `shibboleth` folder up one directory so that it is in `mu-plugins`
alongside the `shibboleth` folder. No need to activate it, just configure it
from the Shibboleth settings page, found under "Site Admin".
[properly installed]: https://spaces.internet2.edu/display/SHIB2/Installation
== Frequently Asked Questions ==
= What is Shibboleth? =
From [the Shibboleth homepage][]:
> The Shibboleth System is a standards based, open source software package for
> web single sign-on across or within organizational boundaries. It allows
> sites to make informed authorization decisions for individual access of
> protected online resources in a privacy-preserving manner.
[the Shibboleth homepage]: http://shibboleth.internet2.edu/
= Can I extend the Shibboleth plugin to provide custom logic? =
Yes, the plugin provides a number of new [actions][] and [filters][] that can
be used to extend the functionality of the plugin. Search `shibboleth.php` for
occurrences of the function calls `apply_filters` and `do_action` to find them
all. Then [write a new plugin][] that makes use of the hooks. If your require
additional hooks to allow for extending other parts of the plugin, please
notify the plugin authors via the [support forum][].
Before extending the plugin in this manner, please ensure that it is not
actually more appropriate to add this logic to Shibboleth. It may make more
sense to add a new attribute to your Shibboleth Identity Provider's attribute
store (e.g. LDAP directory), or a new attribute definition to the Identity
Provider's internal attribute resolver or the Shibboleth Service Provider's
internal attribute extractor. In the end, the Shibboleth administrator will
have to make that call as to what is most appropriate.
[actions]: http://codex.wordpress.org/Plugin_API#Actions
[filters]: http://codex.wordpress.org/Plugin_API#Filters
[write a new plugin]: http://codex.wordpress.org/Writing_a_Plugin
[support forum]: http://wordpress.org/tags/shibboleth?forum_id=10#postform
== Screenshots ==
1. Configure login, logout, and password management URLs
2. Specify which Shibboleth headers map to user profile fields
3. Assign users into WordPress roles based on arbitrary data provided by Shibboleth
== Upgrade Notice ==
This update brings with it numerous changes, including support for PHP 7.x. Please see the changelog for additional details.
== Changelog ==
= version 1.8 (2017-08-23) =
The Shibboleth plugin is now being maintained by [michaelryanmcneill](https://profiles.wordpress.org/michaelryanmcneill). Contributions are welcome on [GitHub](https://github.com/michaelryanmcneill/shibboleth)!
- Adding the ability to disable .htaccess modifications with a wp-config.php constant (`SHIBBOLETH_DISALLOW_FILE_MODS`).
- Added `shibboleth_getenv()` to support various prefixed environment variables from Shibboleth, including`REDIRECT_` and `HTTP_`; props [@cjbnc and @jrchamp](https://github.com/mitcho/shibboleth/pull/13).
- Update various deprecated WordPress functions, including `update_usermeta()` and `get_userdatabylogin()`; props [@skoranda](https://github.com/mitcho/shibboleth/pull/21).
- Resolved undefined index when calling `shibboleth_session_initiator_url()`; props [@skoranda](https://github.com/mitcho/shibboleth/pull/21).
- Added support for PHP 7.x; props to many people.
- Added `shibboleth_authenticate_user` filter; props [@boonebgorges](https://github.com/mitcho/shibboleth/pull/29).
- Resolved undefined index on `admin-options.php`; props [@HirotoKagotani](https://github.com/mitcho/shibboleth/pull/31), [@jrchamp, and @stepmeul](https://github.com/mitcho/shibboleth/pull/23).
- Resolved HTML markup mistake; [props @HirotoKagotani](https://github.com/mitcho/shibboleth/pull/31).
- Adds an update success message to let user's know their settings were saved, using the Settings API.
= version 1.7 (2016-03-20) =
- fixed a security vulnerability reported by WordPress security team
- load multisite options correctly; [thanks to jdelsemme for reporting](https://github.com/mitcho/shibboleth/issues/8)
- updated htaccess setting strings; [props dericcrago](https://github.com/mitcho/shibboleth/pull/6)
- fix reauth loop; [props jrchamp](https://github.com/mitcho/shibboleth/pull/5)
- set l10n text domain; [props jrchamp](https://github.com/mitcho/shibboleth/pull/5)
= version 1.6 (2014-04-07) =
- tested for compatibility with recent WordPress versions; now requires WordPress 3.3
- options screen now limited to admins; [props billjojo](https://github.com/mitcho/shibboleth/pull/1)
- new option to auto-login using Shibboleth; [props billjojo](https://github.com/mitcho/shibboleth/pull/1)
- remove workaround for MU `add_site_option`; [props billjojo](https://github.com/mitcho/shibboleth/pull/2)
= version 1.5 (2012-10-01) =
- [Bugfix](http://wordpress.org/support/topic/plugin-shibboleth-loop-wrong-key-checked): check for `Shib_Session_ID` as well as `Shib-Session-ID` out of the box. Props David Smith
= version 1.4 (2010-08-30) =
- tested for compatibility with WordPress 3.0
- new hooks for developers to override the default user role mapping controls
- now applies `sanitize_name()` to the Shibboleth user's `nicename` column
= version 1.3 (2009-10-02) =
- required WordPress version bumped to 2.8
- much cleaner integration with WordPress authentication system
- individual user profile fields can be designated as managed by Shibboleth
- start of support for i18n. If anyone is willing to provide translations, please contact the plugin author
= version 1.2 (2009-04-21) =
- fix bug where shibboleth users couldn't update their profile. (props pchapman on bug report)
- fix bug where local logins were being sent to shibboleth
= version 1.1 (2009-03-16) =
- cleaner integration with WordPress login form (now uses a custom action instead of hijacking the standard login action)
- add option for enterprise password change URL -- shown on user profile page.
- add option for enterprise password reset URL -- Shibboleth users are auto-redirected here if attempt WP password reset.
- add plugin deactivation hook to remove .htaccess rules
- add option to specify Shibboleth header for user nickname
- add filters for all user attributes and user role (allow other plugins to override these values)
- much cleaner interface on user edit admin page
- fix bug with options being overwritten in WordPress MU
= version 1.0 (2009-03-14) =
- now works properly with WordPress MU
- move Shibboleth menu to Site Admin for WordPress MU (props: Chris Bland)
- lots of code cleanup and documentation
= version 0.1 =
- initial public release
shibboleth/icon.png 0000644 0001750 0001750 00000006764 11156526226 013002 0 ustar dom dom PNG
IHDR $ $ tEXtSoftware Adobe ImageReadyqe<