Parse an auth message like {"type":"auth","user":"...","password":"..."}. The "user" field is optional: when omitted or empty, the caller-provided default (typically the server's default user) is preserved. This mirrors the HTTP path in `authenticateUserByHTTP`, where an absent `user` query parameter falls back to the server's default user.
| 312 | /// the HTTP path in `authenticateUserByHTTP`, where an absent `user` query |
| 313 | /// parameter falls back to the server's default user. |
| 314 | bool parseAuthMessage(const String & json, String & user, String & password) |
| 315 | { |
| 316 | auto object = parseRootObject(json); |
| 317 | if (!object) |
| 318 | return false; |
| 319 | if (getStringField(object, "type") != "auth") |
| 320 | return false; |
| 321 | |
| 322 | auto parsed_user = getStringField(object, "user"); |
| 323 | if (!parsed_user.empty()) |
| 324 | user = parsed_user; |
| 325 | password = getStringField(object, "password"); |
| 326 | return true; |
| 327 | } |
| 328 | |
| 329 | } |
| 330 |
no test coverage detected