openmediavault / openmediavault

openmediavault is the next generation network attached storage (NAS) solution based on Debian Linux. Thanks to the modular design of the framework it can be enhanced via plugins. openmediavault is primarily designed to be used in home environments or small home offices.
https://www.openmediavault.org
Other
4.84k stars 458 forks source link

Add support for basic auth #1785

Open votdev opened 6 days ago

votdev commented 6 days ago

To trigger a login, simply call curl http://omv7box.local/login.php -u "admin:admin" from a command line or an equal call via Python request/whatever.

On successful log in the following response will be returned:

{"response":{"authenticated":true,"username":"admin","permissions":"role":"admin"},"sessionid":"5o0lbvnsbr6r1dt6ql4hm5v3be"},"error":null}

The session ID is only returned at the first log in attempt of a user. It is also submitted via

Set-Cookie OPENMEDIAVAULT-SESSIONID=5o0lbvnsbr6r1dt6ql4hm5v3be; path=/; HttpOnly; SameSite=Strict

header.

The session ID can be sent via the X-OPENMEDIAVAULT-SESSIONID header or cookie on all following RPC requests.

Fixes: https://github.com/openmediavault/openmediavault/issues/1747