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

24 translate the preferred client mode to used in the plugins (#25)

* add the translation

* Update tests
parent e04f9f0c
No related branches found
No related tags found
No related merge requests found
......@@ -90,7 +90,19 @@ class PIResponse
}
if (isset($map['detail']['preferred_client_mode']))
{
$ret->preferredClientMode = $map['detail']['preferred_client_mode'];
$pref = $map['detail']['preferred_client_mode'];
if ($pref === "poll")
{
$ret->preferredClientMode = "push";
}
elseif ($pref === "interactive")
{
$ret->preferredClientMode = "otp";
}
else
{
$ret->preferredClientMode = $map['detail']['preferred_client_mode'];
}
}
// Check that the authentication status is one of the allowed ones
......
......@@ -40,7 +40,7 @@ class PollTransactionTest extends TestCase implements PILog
*/
public function testTriggerPUSH()
{
$responseBody = "{\n" . " \"detail\": {\n" . "\"preferred_client_mode\":\"push\"," . " \"attributes\": null,\n" .
$responseBody = "{\n" . " \"detail\": {\n" . "\"preferred_client_mode\":\"poll\"," . " \"attributes\": null,\n" .
" \"message\": \"Bitte geben Sie einen OTP-Wert ein: , Please confirm the authentication on your mobile device!\",\n" .
" \"messages\": [\n" . " \"Bitte geben Sie einen OTP-Wert ein: \",\n" .
" \"Please confirm the authentication on your mobile device!\"\n" . " ],\n" .
......
......@@ -85,7 +85,7 @@ class TriggerChallengeTest extends TestCase implements PILog
$this->assertEquals("BittegebenSieeinenOTP-Wertein:", $response->message);
$this->assertEquals("BittegebenSieeinenOTP-Wertein:", $response->messages);
$this->assertEquals("16734787285577957577", $response->transactionID);
$this->assertEquals("interactive", $response->preferredClientMode);
$this->assertEquals("otp", $response->preferredClientMode);
$this->assertTrue($response->status);
$this->assertFalse($response->value);
$this->assertEquals("totp", $response->triggeredTokenTypes()[0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment