diff --git a/classes/cryptography/mumie_cryptographic_key.php b/classes/cryptography/mumie_cryptographic_key.php
index 1c50439..34ca266 100644
--- a/classes/cryptography/mumie_cryptographic_key.php
+++ b/classes/cryptography/mumie_cryptographic_key.php
@@ -47,26 +47,26 @@ class mumie_cryptographic_key {
/**
* @var string
*/
- private string $key;
+ private string $keyvalue;
/**
* Create a new instance
* @param string $name
- * @param string $key
+ * @param string $keyvalue
*/
- public function __construct(string $name, string $key) {
+ public function __construct(string $name, string $keyvalue) {
$this->name = $name;
- $this->key = $key;
+ $this->keyvalue = $keyvalue;
}
/**
- * Insert a new key into the database
+ * Insert a new keyvalue into the database
* @return void
* @throws dml_exception
*/
public function create() {
global $DB;
- $DB->insert_record(self::MUMIE_CRYPTOGRAPHIC_KEY_TABLE, ["name" => $this->name, "key" => $this->key]);
+ $DB->insert_record(self::MUMIE_CRYPTOGRAPHIC_KEY_TABLE, ["name" => $this->name, "keyvalue" => $this->keyvalue]);
}
/**
@@ -76,7 +76,7 @@ public function create() {
*/
public function update() {
global $DB;
- $DB->update_record(self::MUMIE_CRYPTOGRAPHIC_KEY_TABLE, ["name" => $this->name, "key" => $this->key, "id" => $this->id]);
+ $DB->update_record(self::MUMIE_CRYPTOGRAPHIC_KEY_TABLE, ["name" => $this->name, "keyvalue" => $this->keyvalue, "id" => $this->id]);
}
/**
@@ -100,7 +100,7 @@ private static function from_record($record) : ?mumie_cryptographic_key {
if (!$record) {
return null;
}
- $cryptokey = new mumie_cryptographic_key($record->name, $record->key);
+ $cryptokey = new mumie_cryptographic_key($record->name, $record->keyvalue);
$cryptokey->set_id($record->id);
return $cryptokey;
}
@@ -138,18 +138,18 @@ public function set_name(string $name) : void {
}
/**
- * Get the key
+ * Get the keyvalue
* @return string
*/
- public function get_key() : string {
- return $this->key;
+ public function get_keyvalue() : string {
+ return $this->keyvalue;
}
/**
- * Set a new key
- * @param string $key
+ * Set a new keyvalue
+ * @param string $keyvalue
*/
- public function set_key(string $key) : void {
- $this->key = $key;
+ public function set_keyvalue(string $keyvalue) : void {
+ $this->keyvalue = $keyvalue;
}
}
diff --git a/classes/cryptography/mumie_cryptography_service.php b/classes/cryptography/mumie_cryptography_service.php
index 8291cc0..a2eaf50 100644
--- a/classes/cryptography/mumie_cryptography_service.php
+++ b/classes/cryptography/mumie_cryptography_service.php
@@ -82,7 +82,7 @@ public static function ensure_key_pair_exist() : void {
*/
public static function sign_data(string ...$data) : string {
self::ensure_key_pair_exist();
- openssl_sign(implode("", $data), $signeddata, self::get_private_key()->get_key(), OPENSSL_ALGO_SHA512);
+ openssl_sign(implode("", $data), $signeddata, self::get_private_key()->get_keyvalue(), OPENSSL_ALGO_SHA512);
return base64_encode($signeddata);
}
@@ -143,7 +143,7 @@ private static function upsert_private_key(string $key) : void {
private static function upsert_key(string $name, string $key) : void {
$cryptographickey = mumie_cryptographic_key::get_by_name($name);
if (!is_null($cryptographickey)) {
- $cryptographickey->set_key($key);
+ $cryptographickey->set_keyvalue($key);
$cryptographickey->update();
} else {
$cryptographickey = new mumie_cryptographic_key($name, $key);
diff --git a/classes/sso/user/mumie_user.php b/classes/sso/user/mumie_user.php
index 4a50e6b..d09c7be 100644
--- a/classes/sso/user/mumie_user.php
+++ b/classes/sso/user/mumie_user.php
@@ -96,7 +96,7 @@ public function load() : bool {
* @return string
*/
public function get_sync_id() : string {
- return "gsso_" . $this->org . "_" . $this->mumieid;
+ return "GSSO_" . $this->org . "_" . $this->mumieid;
}
/**
diff --git a/db/install.xml b/db/install.xml
index 43129b3..c2e64dc 100644
--- a/db/install.xml
+++ b/db/install.xml
@@ -42,7 +42,7 @@
-
+
diff --git a/db/upgrade.php b/db/upgrade.php
index 2015563..1590506 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -91,5 +91,15 @@ function xmldb_auth_mumie_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2023062000, 'auth', 'mumie');
}
+ if ($oldversion < 2023110800) {
+ $table = new xmldb_table('auth_mumie_cryptographic_key');
+ $field = new xmldb_field('key');
+ if ($dbman->field_exists($table, $field)) {
+ $field->set_attributes(XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
+ $dbman->rename_field($table, $field, 'keyvalue');
+ }
+ upgrade_plugin_savepoint(true, 2023110800, 'auth', 'mumie');
+ }
+
return true;
}
diff --git a/publicKey.php b/publicKey.php
index d0c2bf5..634996a 100644
--- a/publicKey.php
+++ b/publicKey.php
@@ -31,4 +31,4 @@
http_response_code(404);
return;
}
-echo $publickey->get_key();
+echo $publickey->get_keyvalue();
diff --git a/version.php b/version.php
index 1f879eb..a04f9e2 100644
--- a/version.php
+++ b/version.php
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2023103100;
+$plugin->version = 2023110800;
$plugin->component = 'auth_mumie';
$plugin->requires = 2022041900;
$plugin->release = "v1.5.0";