From 332860ab0b79ae1e588246269f63af010e448774 Mon Sep 17 00:00:00 2001 From: lukasmatusiewicz <77617779+lukasmatusiewicz@users.noreply.github.com> Date: Tue, 5 Mar 2024 13:17:30 +0100 Subject: [PATCH] Update Utils.php --- test/utils/Utils.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/utils/Utils.php b/test/utils/Utils.php index a5d0e19..08da8bc 100644 --- a/test/utils/Utils.php +++ b/test/utils/Utils.php @@ -109,6 +109,31 @@ public static function postAuthResponseBody() " \"signature\": \"rsa_sha256_pss:\"\n" . "}"; } + /** + * @return string + */ + public static function postAuthNoRoleAdminResponseBody() + { + return "{\n" . " \"id\": 1,\n" . " \"jsonrpc\": \"2.0\",\n" . + " \"result\": {\n" . " \"status\": true,\n" . + " \"value\": {\n" . " \"log_level\": 20,\n" . + " \"menus\": [\n" . " \"components\",\n" . + " \"machines\"\n" . " ],\n" . + " \"realm\": \"\",\n" . " \"rights\": [\n" . + " \"policydelete\",\n" . + " \"resync\"\n" . " ],\n" . + " \"role\": \"user\",\n" . " \"token\": \"" . + self::authToken() . "\",\n" . " \"username\": \"admin\",\n" . + " \"logout_time\": 120,\n" . + " \"default_tokentype\": \"hotp\",\n" . + " \"user_details\": false,\n" . + " \"subscription_status\": 0\n" . " }\n" . + " },\n" . " \"time\": 1589446794.8502703,\n" . + " \"version\": \"privacyIDEA 3.2.1\",\n" . + " \"versionnumber\": \"3.2.1\",\n" . + " \"signature\": \"rsa_sha256_pss:\"\n" . "}"; + } + /** * @return string */ @@ -234,6 +259,17 @@ public static function errorUserNotFoundResponseBody() "\"signature\":\"rsa_sha256_pss:1c64db29cad0dc127d6...5ec143ee52a7804ea1dc8e23ab2fc90ac0ac147c0\"}"; } + /** + * @return string + */ + public static function errorMissingAuthorizationHeaderResponseBody() + { + return "{" . "\"detail\":null," . "\"id\":1," . "\"jsonrpc\":\"2.0\"," . "\"result\":{" . "\"error\":{" . + "\"code\":4033," . "\"message\":\"Authentication failure. Missing Authorization header.\"}," . + "\"status\":false}," . "\"time\":1649752303.65651," . "\"version\":\"privacyIDEA 3.6.3\"," . + "\"signature\":\"rsa_sha256_pss:1c64db29cad0dc127d6...5ec143ee52a7804ea1dc8e23ab2fc90ac0ac147c0\"}"; + } + /** * @return string */