Skip to content
Snippets Groups Projects
Verified Commit 3dfadc88 authored by lukasmatusiewicz's avatar lukasmatusiewicz Committed by Pavel Břoušek
Browse files

feat: process result->authentication and add to the PIResponse


* 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>
Co-authored-by: default avatarPavel Břoušek <brousek@ics.muni.cz>
parent 760c0078
No related branches found
No related tags found
1 merge request!8Update from upstream
<?php
declare(strict_types=1);
namespace PrivacyIDEA\PHPClient;
abstract class AuthenticationStatus
{
public const CHALLENGE = 'CHALLENGE';
public const ACCEPT = 'ACCEPT';
public const REJECT = 'REJECT';
public const NONE = 'NONE';
}
......@@ -41,6 +41,11 @@ class PIResponse
*/
public $value = false;
/**
* @var string Authentication Status
*/
public $authenticationStatus = '';
/**
* @var array additional attributes of the user that can be sent by the server
*/
......@@ -101,6 +106,19 @@ class PIResponse
if (isset($map['detail']['transaction_id'])) {
$ret->transactionID = $map['detail']['transaction_id'];
}
// Check that the authentication status is one of the allowed ones
$r = $map['result']['authentication'] ?: null;
if (in_array(
$r,
[AuthenticationStatus::CHALLENGE, AuthenticationStatus::ACCEPT, AuthenticationStatus::REJECT],
true
)) {
$ret->authenticationStatus = $r;
} 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