Commit e2d22a18 authored by Piers Harding's avatar Piers Harding Committed by Robert Lyon

Bug 1579285: create work around for openssl_x509_fingerprint

behatnotneeded

Change-Id: I50d6371766a244525e587c43fd1b72b1baf057ba
parent 004c45ea
......@@ -35,3 +35,4 @@ mahara-*.zip
logfile
node_modules/
htdocs/.externalToolBuilders/
htdocs/auth/saml/extlib/simplesamlphp
......@@ -421,11 +421,11 @@ class PluginAuthSaml extends PluginAuth {
),
'sha1fingerprint' => array(
'type' => 'html',
'value' => '<div><p>' . get_string('sha1fingerprint', 'auth.webservice', openssl_x509_fingerprint($cert, "sha1")) . '</p></div>',
'value' => '<div><p>' . get_string('sha1fingerprint', 'auth.webservice', auth_saml_openssl_x509_fingerprint($cert, "sha1")) . '</p></div>',
),
'md5fingerprint' => array(
'type' => 'html',
'value' => '<div><p>' . get_string('md5fingerprint', 'auth.webservice', openssl_x509_fingerprint($cert, "md5")) . '</p></div>',
'value' => '<div><p>' . get_string('md5fingerprint', 'auth.webservice', auth_saml_openssl_x509_fingerprint($cert, "md5")) . '</p></div>',
),
'expires' => array(
'type' => 'html',
......@@ -828,6 +828,15 @@ class PluginAuthSaml extends PluginAuth {
}
}
/**
* Work around for missing function in 5.5 - is in 5.6
*/
function auth_saml_openssl_x509_fingerprint($cert, $hash) {
$cert = preg_replace('#-.*-|\r|\n#', '', $cert);
$bin = base64_decode($cert);
return hash($hash, $bin);
}
if (file_exists(get_config('docroot') . 'auth/saml/extlib/simplesamlphp/lib/SimpleSAML/XHTML/IdPDisco.php')) {
require_once(get_config('docroot') . 'auth/saml/extlib/simplesamlphp/lib/SimpleSAML/XHTML/IdPDisco.php');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment