Skip to content
Snippets Groups Projects
Commit cc21fad5 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

Merge branch '8133-small-fixes' into 'main'

update mfa client

See merge request !47
parents 2da40d12 18b8827c
No related branches found
No related tags found
1 merge request!47update mfa client
Pipeline #5381 passed
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* mfa-ensure.php * mfa-ensure.php
* *
* @author Axel Hahn <axel.hahn@unibe> * @author Axel Hahn <axel.hahn@unibe.ch>
* *
*/ */
...@@ -11,6 +11,9 @@ $mfa = new mfaclient(); ...@@ -11,6 +11,9 @@ $mfa = new mfaclient();
$mfa->debug($aConfig['debug']??false); $mfa->debug($aConfig['debug']??false);
// if user was not set in config, set it manually
// $mfa->setUser(<your-function-to-fetch-userid>);
$iHttpStatus=$mfa->ensure(); $iHttpStatus=$mfa->ensure();
// mfa was skipped? Enable this line to see the reason // mfa was skipped? Enable this line to see the reason
......
...@@ -12,11 +12,12 @@ ...@@ -12,11 +12,12 @@
* *
* 2025-06-11 <axel.hahn@unibe.ch> initial version * 2025-06-11 <axel.hahn@unibe.ch> initial version
* 2025-06-30 <axel.hahn@unibe.ch> set version 1.0.1 in user agenmt in http requests * 2025-06-30 <axel.hahn@unibe.ch> set version 1.0.1 in user agenmt in http requests
* 2025-07-07 <axel.hahn@unibe.ch> 1.0.2 handle executed setUser() before ensure()
*/ */
class mfaclient class mfaclient
{ {
protected string $_sVersion = "1.0.1"; protected string $_sVersion = "1.0.2";
protected array $aConfig = []; protected array $aConfig = [];
// protected string $sSessionvarname = "mfaclient"; // protected string $sSessionvarname = "mfaclient";
...@@ -382,12 +383,14 @@ class mfaclient ...@@ -382,12 +383,14 @@ class mfaclient
$this->logout(); $this->logout();
} }
$aVerify=$this->aConfig;
$aVerify['user']=$this->sUser ?: ($this->aConfig['user'] ?? null);
foreach(['api', 'appid', 'shared_secret', 'user'] as $sKey){ foreach(['api', 'appid', 'shared_secret', 'user'] as $sKey){
if(!isset($this->aConfig[$sKey])){ if(!isset($aVerify[$sKey])){
$this->aStatus[] = "Skip: Key '$sKey' was not set in config."; $this->aStatus[] = "Skip: Key '$sKey' was not set in config.";
return 200; return 200;
} }
if(!$this->aConfig[$sKey]){ if(!$aVerify[$sKey]){
$this->aStatus[] = "Skip: Key '$sKey' is empty in config."; $this->aStatus[] = "Skip: Key '$sKey' is empty in config.";
return 200; return 200;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment