Files
openobserve/src
Hengfei YangandAshish Kolhe 42e965899b feat: support use cookie to do cli command (#8189)
### **User description**
We can use cookie to make requests for CLI command for the case enabled
SSO can't use username & password.

```
ZO_CLI_USER_COOKIE=""
```

For now only used for CLI command.


___

### **PR Type**
Enhancement


___

### **Description**
- Add cookie-based CLI authentication

- Fallback to basic auth when no cookie

- Introduce config `ZO_ROOT_USER_COOKIE`


___

### Diagram Walkthrough


```mermaid
flowchart LR
  CFG["Config: add root_user_cookie"] -- "read env ZO_ROOT_USER_COOKIE" --> CLI["CLI HTTP request builder"]
  CLI -- "cookie present" --> HDR["Set Cookie header"]
  CLI -- "cookie empty" --> BASIC["Use basic_auth(email,password)"]
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>http.rs</strong><dd><code>Add Cookie header auth with
fallback</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

src/cli/basic/http.rs

<ul><li>Read <code>root_user_cookie</code> from config.<br> <li> Use
Cookie header when provided.<br> <li> Fallback to basic auth if cookie
empty.<br> <li> Preserve JSON body handling.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8189/files#diff-790b7780a51e8eecd4754b623af8d15ad87baaaf29455ba646e2e410f83f5498">+7/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>config.rs</strong><dd><code>Support cookie env in auth
config</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

src/config/src/config.rs

<ul><li>Add <code>root_user_cookie</code> to <code>Auth</code>
struct.<br> <li> Map to env var <code>ZO_ROOT_USER_COOKIE</code>.</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/8189/files#diff-9aeee4a74c0520daa40f9b81c7016f5b6b3254375b968dd7598e745630980d62">+2/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: Ashish Kolhe <ashish.j.kolhe@gmail.com>
2025-08-29 08:31:28 +08:00
..
2025-08-28 21:24:21 +05:30
2025-08-28 21:24:21 +05:30
2025-08-28 21:24:21 +05:30
2025-07-09 19:16:13 +05:30
2025-08-11 15:12:22 +08:00
2025-08-28 09:14:33 +05:30