Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • main
1 result

Target

Select target project
No results found
Select Git revision
  • main
1 result
Show changes

Commits on Source 2

2 files
+ 11
5
Compare changes
  • Side-by-side
  • Inline

Files

Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
/**
 * mfa-ensure.php
 * 
 * @author Axel Hahn <axel.hahn@unibe>
 * @author Axel Hahn <axel.hahn@unibe.ch>
 * 
 */

@@ -11,6 +11,9 @@ $mfa = new mfaclient();

$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();

// mfa was skipped? Enable this line to see the reason
Original line number Diff line number Diff line
@@ -12,11 +12,12 @@
 * 
 * 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-07-07  <axel.hahn@unibe.ch>  1.0.2 handle executed setUser() before ensure()
 */
class mfaclient
{

    protected string $_sVersion = "1.0.1";
    protected string $_sVersion = "1.0.2";

    protected array $aConfig = [];
    // protected string $sSessionvarname = "mfaclient";
@@ -382,12 +383,14 @@ class mfaclient
            $this->logout();
        }

        $aVerify=$this->aConfig;
        $aVerify['user']=$this->sUser ?: ($this->aConfig['user'] ?? null); 
        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.";
                return 200;
            }
            if(!$this->aConfig[$sKey]){
            if(!$aVerify[$sKey]){
                $this->aStatus[] = "Skip: Key '$sKey' is empty in config.";
                return 200;
            }