autobrr/pkg
soup 43c28fc0c6
feat(auth): implement auth proxy support with OpenID Connect (#1853)
* feat(auth): implement oidc

* refactor(auth): centralize OIDC state cookie handling

* fix(web): resolve unused error variables in route handlers

* docs(readme): add OIDC authentication feature to list

* fix(auth): improve OIDC cookie handling for reverse proxy setups

The OIDC state cookie's Secure flag is now properly set when running behind a reverse proxy by checking both direct TLS and X-Forwarded-Proto header. This fixes authentication issues in common setups where:

- autobrr runs behind a reverse proxy that terminates HTTPS
- local development environments without TLS
- mixed protocol environments (internal HTTP, external HTTPS)

* fix: use crypt/random if argon2id fails

* feat(auth): show both login options when user exists in db

if user doesn't exist, e.g. canOnboard=true then we only show the OIDC button, since regular login makes no sense in that case

If user does not exist in db and the user wants to create a local user, OIDC needs to be disabled first

* feat(auth): improve OIDC provider initialization with discovery logging

* revert(issuer): do not remove trailing slash

* feat(auth): improve OIDC username resolution with additional claims

* fix(auth): handle OIDC issuer URLs with and without trailing slashes

When initializing the OIDC provider, automatically retry with/without trailing
slash if the first attempt fails.

- First attempts with original issuer URL
- If fails with trailing slash, retries without
- If fails without trailing slash, retries with

* feat(oidc): add gorilla sessions store for secure state management

Add gorilla sessions store to handle encrypted state cookies in OIDC flow,
while removing redundant session validation checks

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* fix(auth): prevent duplicate OIDC state cookies for authenticated sessions

Modify OIDC config handler to check for existing authenticated sessions
before setting state cookie. Still returns OIDC enabled status to maintain
UI state, but prevents unnecessary cookie creation for authenticated users.

* feat(oidc): use random secret for temporary state cookies

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* feat(auth): add rate limiting to OIDC endpoints

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* fix(auth): validate OIDC authorization code presence in callback

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* fix(auth): properly handle OIDC session errors

Improve error handling in OIDC login flow by properly handling cookie store
session errors. Return HTTP 500 if session cannot be retrieved instead of
silently continuing with potentially invalid state.

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>

* feat(auth): track and display authentication method for oidc and password logins

* fix: tests

* docs(readme): add environment variable section

* go mod tidy

* chore: log style and errors

---------

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
Co-authored-by: ze0s <ze0s@riseup.net>
2024-12-19 14:41:31 +01:00
..
argon2id feat(auth): implement auth proxy support with OpenID Connect (#1853) 2024-12-19 14:41:31 +01:00
btn chore: update license header year (#1332) 2024-01-01 16:21:02 +01:00
cmp fix(filters): ensure sort by priority (#1325) 2023-12-31 14:59:12 +01:00
errors chore: update license header year (#1332) 2024-01-01 16:21:02 +01:00
ggn refactor(http): implement bufio (#1604) 2024-08-29 08:51:20 +02:00
jsonrpc chore: update license header year (#1332) 2024-01-01 16:21:02 +01:00
lidarr fix(downloadclients): arrs change size type to uint64 (#1744) 2024-09-29 14:04:16 +02:00
newznab refactor(wildcard): optimize and add caching (#1634) 2024-09-02 11:18:14 +02:00
ops fix(indexers): OPS API test function (#1772) 2024-10-19 13:49:22 +02:00
porla chore: update license header year (#1332) 2024-01-01 16:21:02 +01:00
ptp fix(indexers): PTP API test function (#1771) 2024-10-19 14:43:11 +02:00
radarr fix(downloadclients): arrs change size type to uint64 (#1744) 2024-09-29 14:04:16 +02:00
readarr fix(downloadclients): arrs change size type to uint64 (#1744) 2024-09-29 14:04:16 +02:00
red feat(filters): RED and OPS fetch uploader from API (#1348) 2024-12-17 20:39:09 +01:00
regexcache feat(cache): implement TTLCache and TimeCache (#1822) 2024-12-17 21:15:06 +01:00
sabnzbd refactor(http): implement bufio (#1604) 2024-08-29 08:51:20 +02:00
sanitize feat(tests): add Parallelization where possible (#1823) 2024-11-23 15:16:09 +01:00
sharedhttp fix(proxy): add shared transport for proxies (#1808) 2024-11-06 18:55:23 +01:00
sonarr fix(downloadclients): arrs change size type to uint64 (#1744) 2024-09-29 14:04:16 +02:00
timecache feat(cache): implement TTLCache and TimeCache (#1822) 2024-12-17 21:15:06 +01:00
torznab refactor(wildcard): optimize and add caching (#1634) 2024-09-02 11:18:14 +02:00
transmission fix(actions): reject if client is disabled (#1626) 2024-08-27 19:45:06 +02:00
ttlcache feat(cache): implement TTLCache and TimeCache (#1822) 2024-12-17 21:15:06 +01:00
version feat(tests): add Parallelization where possible (#1823) 2024-11-23 15:16:09 +01:00
whisparr fix(downloadclients): arrs change size type to uint64 (#1744) 2024-09-29 14:04:16 +02:00
wildcard feat(tests): add Parallelization where possible (#1823) 2024-11-23 15:16:09 +01:00