Skip to content

Commit

Permalink
Merge pull request #24 from Skyscanner/update-php-saml-3.0
Browse files Browse the repository at this point in the history
Update OneLogin PHP SAML library to 3.0.0.
  • Loading branch information
shadyvb authored Dec 17, 2018
2 parents 1cf6433 + e8644dc commit 9e807ae
Show file tree
Hide file tree
Showing 51 changed files with 1,804 additions and 3,658 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"require": {
"onelogin/php-saml": "^2.10"
"onelogin/php-saml": "^3.0"
},
"require-dev": {
"humanmade/coding-standards": "dev-master"
Expand Down
91 changes: 63 additions & 28 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions inc/admin/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

use function HumanMade\SimpleSaml\instance;
use function HumanMade\SimpleSaml\is_sso_enabled_network_wide;
use OneLogin_Saml2_IdPMetadataParser;

use OneLogin\Saml2\IdPMetadataParser;

/**
* Bootstrap config/admin related actions
Expand Down Expand Up @@ -44,7 +45,7 @@ function get_config() {
$idp_xml_file = apply_filters( 'wpsimplesaml_idp_metadata_xml_path', '' );

if ( $idp_xml_file && file_exists( $idp_xml_file ) ) {
$settings = OneLogin_Saml2_IdPMetadataParser::parseFileXML( $idp_xml_file );
$settings = IdPMetadataParser::parseFileXML( $idp_xml_file );
}

if ( empty( $idp_xml_file ) ) {
Expand All @@ -54,7 +55,7 @@ function get_config() {
* @return string XML string for IdP metadata
*/
$idp_xml = trim( apply_filters( 'wpsimplesaml_idp_metadata_xml', '' ) );
$settings = OneLogin_Saml2_IdPMetadataParser::parseXML( $idp_xml );
$settings = IdPMetadataParser::parseXML( $idp_xml );
}
} catch ( \Exception $e ) {
return new \WP_Error( 'invalid-idp-metadata', __( 'Invalid IdP XML metadata', 'wp-simple-saml' ), [
Expand Down
10 changes: 6 additions & 4 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

namespace HumanMade\SimpleSaml;

use OneLogin\Saml2\Auth;

define( 'WP_SIMPLE_SAML_PLUGIN_FILE', __FILE__ );

/**
Expand Down Expand Up @@ -174,7 +176,7 @@ function go_home() {
/**
* Get an instance of SAML2 Auth object
*
* @return False|\OneLogin_Saml2_Auth
* @return False|\OneLogin\Saml2\Auth
*/
function instance() {
static $instance;
Expand All @@ -195,7 +197,7 @@ function instance() {
}

if ( empty( $instance ) ) {
$instance = new \OneLogin_Saml2_Auth( $config );
$instance = new Auth( $config );
}

return $instance;
Expand Down Expand Up @@ -330,11 +332,11 @@ function get_sso_user() {
/**
* Create a user and/or update his role based on SAML response
*
* @param \OneLogin_Saml2_Auth $saml
* @param \OneLogin\Saml2\Auth $saml
*
* @return \WP_User|\WP_Error
*/
function get_or_create_wp_user( \OneLogin_Saml2_Auth $saml ) {
function get_or_create_wp_user( \OneLogin\Saml2\Auth $saml ) {

$map = get_attribute_map();
$attributes = $saml->getAttributes();
Expand Down
5 changes: 4 additions & 1 deletion plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@

require_once __DIR__ . '/inc/namespace.php';
require_once __DIR__ . '/inc/admin/namespace.php';
require_once __DIR__ . '/vendor/autoload.php';

if ( ! class_exists( '\\OneLogin\\Saml2\\Auth' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}

add_action( 'plugins_loaded', __NAMESPACE__ . '\\bootstrap' );
add_action( 'plugins_loaded', __NAMESPACE__ . '\\Admin\\admin_bootstrap' );
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitedd868872a7e2fbf5aa93bdc5dea705f::getLoader();
return ComposerAutoloaderInitcf199352db8eb5d7bbaa94f1e0dc09f8::getLoader();
4 changes: 2 additions & 2 deletions vendor/composer/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,9 @@ private function findFileWithExtension($class, $ext)
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
Expand Down
69 changes: 52 additions & 17 deletions vendor/composer/LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,56 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Composer
Upstream-Contact: Jordi Boggiano <[email protected]>
Source: https://github.com/composer/composer

Copyright (c) Nils Adermann, Jordi Boggiano
Files: *
Copyright: 2016, Nils Adermann <[email protected]>
2016, Jordi Boggiano <[email protected]>
License: Expat

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
Files: src/Composer/Util/TlsHelper.php
Copyright: 2016, Nils Adermann <[email protected]>
2016, Jordi Boggiano <[email protected]>
2013, Evan Coury <[email protected]>
License: Expat and BSD-2-Clause

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
License: BSD-2-Clause
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
36 changes: 16 additions & 20 deletions vendor/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@
$baseDir = dirname($vendorDir);

return array(
'OneLogin_Saml2_Auth' => $vendorDir . '/onelogin/php-saml/lib/Saml2/Auth.php',
'OneLogin_Saml2_AuthnRequest' => $vendorDir . '/onelogin/php-saml/lib/Saml2/AuthnRequest.php',
'OneLogin_Saml2_Constants' => $vendorDir . '/onelogin/php-saml/lib/Saml2/Constants.php',
'OneLogin_Saml2_Error' => $vendorDir . '/onelogin/php-saml/lib/Saml2/Error.php',
'OneLogin_Saml2_IdPMetadataParser' => $vendorDir . '/onelogin/php-saml/lib/Saml2/IdPMetadataParser.php',
'OneLogin_Saml2_LogoutRequest' => $vendorDir . '/onelogin/php-saml/lib/Saml2/LogoutRequest.php',
'OneLogin_Saml2_LogoutResponse' => $vendorDir . '/onelogin/php-saml/lib/Saml2/LogoutResponse.php',
'OneLogin_Saml2_Metadata' => $vendorDir . '/onelogin/php-saml/lib/Saml2/Metadata.php',
'OneLogin_Saml2_Response' => $vendorDir . '/onelogin/php-saml/lib/Saml2/Response.php',
'OneLogin_Saml2_Settings' => $vendorDir . '/onelogin/php-saml/lib/Saml2/Settings.php',
'OneLogin_Saml2_Utils' => $vendorDir . '/onelogin/php-saml/lib/Saml2/Utils.php',
'OneLogin_Saml2_ValidationError' => $vendorDir . '/onelogin/php-saml/lib/Saml2/Error.php',
'OneLogin_Saml_AuthRequest' => $vendorDir . '/onelogin/php-saml/lib/Saml/AuthRequest.php',
'OneLogin_Saml_Metadata' => $vendorDir . '/onelogin/php-saml/lib/Saml/Metadata.php',
'OneLogin_Saml_Response' => $vendorDir . '/onelogin/php-saml/lib/Saml/Response.php',
'OneLogin_Saml_Settings' => $vendorDir . '/onelogin/php-saml/lib/Saml/Settings.php',
'OneLogin_Saml_XmlSec' => $vendorDir . '/onelogin/php-saml/lib/Saml/XmlSec.php',
'XMLSecEnc' => $vendorDir . '/onelogin/php-saml/extlib/xmlseclibs/xmlseclibs.php',
'XMLSecurityDSig' => $vendorDir . '/onelogin/php-saml/extlib/xmlseclibs/xmlseclibs.php',
'XMLSecurityKey' => $vendorDir . '/onelogin/php-saml/extlib/xmlseclibs/xmlseclibs.php',
'OneLogin\\Saml2\\Auth' => $vendorDir . '/onelogin/php-saml/src/Saml2/Auth.php',
'OneLogin\\Saml2\\AuthnRequest' => $vendorDir . '/onelogin/php-saml/src/Saml2/AuthnRequest.php',
'OneLogin\\Saml2\\Constants' => $vendorDir . '/onelogin/php-saml/src/Saml2/Constants.php',
'OneLogin\\Saml2\\Error' => $vendorDir . '/onelogin/php-saml/src/Saml2/Error.php',
'OneLogin\\Saml2\\IdPMetadataParser' => $vendorDir . '/onelogin/php-saml/src/Saml2/IdPMetadataParser.php',
'OneLogin\\Saml2\\LogoutRequest' => $vendorDir . '/onelogin/php-saml/src/Saml2/LogoutRequest.php',
'OneLogin\\Saml2\\LogoutResponse' => $vendorDir . '/onelogin/php-saml/src/Saml2/LogoutResponse.php',
'OneLogin\\Saml2\\Metadata' => $vendorDir . '/onelogin/php-saml/src/Saml2/Metadata.php',
'OneLogin\\Saml2\\Response' => $vendorDir . '/onelogin/php-saml/src/Saml2/Response.php',
'OneLogin\\Saml2\\Settings' => $vendorDir . '/onelogin/php-saml/src/Saml2/Settings.php',
'OneLogin\\Saml2\\Utils' => $vendorDir . '/onelogin/php-saml/src/Saml2/Utils.php',
'OneLogin\\Saml2\\ValidationError' => $vendorDir . '/onelogin/php-saml/src/Saml2/ValidationError.php',
'RobRichards\\XMLSecLibs\\Utils\\XPath' => $vendorDir . '/robrichards/xmlseclibs/src/Utils/XPath.php',
'RobRichards\\XMLSecLibs\\XMLSecEnc' => $vendorDir . '/robrichards/xmlseclibs/src/XMLSecEnc.php',
'RobRichards\\XMLSecLibs\\XMLSecurityDSig' => $vendorDir . '/robrichards/xmlseclibs/src/XMLSecurityDSig.php',
'RobRichards\\XMLSecLibs\\XMLSecurityKey' => $vendorDir . '/robrichards/xmlseclibs/src/XMLSecurityKey.php',
);
3 changes: 2 additions & 1 deletion vendor/composer/autoload_psr4.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
$baseDir = dirname($vendorDir);

return array(
'PSR2R\\' => array($vendorDir . '/fig-r/psr2r-sniffer/PSR2R'),
'RobRichards\\XMLSecLibs\\' => array($vendorDir . '/robrichards/xmlseclibs/src'),
'OneLogin\\' => array($vendorDir . '/onelogin/php-saml/src'),
);
Loading

0 comments on commit 9e807ae

Please sign in to comment.