Skip to content
Snippets Groups Projects
Unverified Commit c31b7478 authored by lukasmatusiewicz's avatar lukasmatusiewicz Committed by GitHub
Browse files

Update: Process result->authentication and add to the PIResponse (#15)


* Create AuthenticationStatus

+ update PIResponse to process authenticationStatus

* update authenticationstatus controll

* Update PIResponse.php

Co-authored-by: default avatarNils Behlen <29949516+nilsbehlen@users.noreply.github.com>
parent 3f13197f
Branches
Tags
1 merge request!7[pull] main from privacyidea:master
<?php
abstract class AuthenticationStatus
{
const CHALLENGE = "CHALLENGE";
const ACCEPT = "ACCEPT";
const REJECT = "REJECT";
const NONE = "NONE";
}
\ No newline at end of file
......@@ -25,6 +25,9 @@ class PIResponse
/* @var bool Value is true if the authentication was successful. */
public $value = false;
/* @var string Authentication Status */
public $authenticationStatus = "";
/* @var array Additional attributes of the user that can be sent by the server. */
public $detailAndAttributes = array();
......@@ -82,6 +85,26 @@ class PIResponse
{
$ret->transactionID = $map['detail']['transaction_id'];
}
// Check that the authentication status is one of the allowed ones
$r = $map['result']['authentication'] ?: null;
if ($r === AuthenticationStatus::CHALLENGE)
{
$ret->authenticationStatus = AuthenticationStatus::CHALLENGE;
}
elseif ($r === AuthenticationStatus::ACCEPT)
{
$ret->authenticationStatus = AuthenticationStatus::ACCEPT;
}
elseif ($r === AuthenticationStatus::REJECT)
{
$ret->authenticationStatus = AuthenticationStatus::REJECT;
}
else
{
$privacyIDEA->debugLog("Unknown authentication status");
$ret->authenticationStatus = AuthenticationStatus::NONE;
}
$ret->status = $map['result']['status'] ?: false;
$ret->value = $map['result']['value'] ?: false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment