Add default value and error type for timeout 73/306273/1
authorYonggoo Kang <ygace.kang@samsung.com>
Mon, 19 Feb 2024 09:04:05 +0000 (18:04 +0900)
committerYonggoo Kang <ygace.kang@samsung.com>
Mon, 19 Feb 2024 09:04:05 +0000 (18:04 +0900)
Change-Id: I267d77778d3d4fbce977a6f37e7c8fc64694e990

include/webauthn-types.h
srcs/common/protocols.h
srcs/common/wauth-error.cpp
srcs/server/service.cpp

index 5ff1dd6a9718b26a41dd148c1c2db85171d4f14d..378ec1b945846c2ae0b68c67f8337fb67b5a6479 100644 (file)
@@ -55,6 +55,7 @@ typedef enum {
     WAUTHN_ERROR_ACCESS_DENIED              = -0x0A, /**< Socket access denied */
     WAUTHN_ERROR_MEMORY                     = -0x0B, /**< Memory error */
     WAUTHN_ERROR_CANCELLED                  = -0x0C, /**< Cancelled by cancel request */
+    WAUTHN_ERROR_TIMEOUT                    = -0x0D, /**< Timeout */
 } wauthn_error_e;
 
 /**
index b3498f04b760d59fda015c4da94d8bb51baf8b14..2f6f86192cd03f3dc46eacde88dbe2b51829a5ea 100644 (file)
@@ -34,6 +34,7 @@ namespace WA {
 #define SOCKET_PATH_PREFIX "/run/"
 
 inline constexpr auto SERVICE_SOCKET = SOCKET_PATH_PREFIX "webauthn.socket";
+const unsigned long WEBAUTHN_TIMEOUT = 1000 * 60 * 2; // 2 minutes
 
 enum class WebAuthnCall
 {
index 832d9a091a0c327f88720f2d172a48f4490253f9..fe35c1922beca5bcc83c7bfa449afa4c7653e515 100644 (file)
@@ -39,6 +39,7 @@ const char * wauthn_error_to_string(int error) {
         WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_ACCESS_DENIED);
         WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_MEMORY);
         WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_CANCELLED);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_TIMEOUT);
         default: return "Code not defined";
     }
 }
index 6a2a3c87e8c5214469efca043df9650a1dd42fb1..173435ebafba3b2a961aa601405ba640aec7ad03 100644 (file)
@@ -90,6 +90,8 @@ void Service::Worker(SocketManager::ConnectionID connectionID,
         LogDebug("Adjust qrcode_callback to nullptr");
         callbacks.qrcode_callback = nullptr;
     }
+    if (options->timeout == 0)
+        options->timeout = WEBAUTHN_TIMEOUT;
 
     user_data_s userData;
     userData.service = this;