[PR #3302] [WIP] feat: Implement Forward Authentication #3926

Open
opened 2026-04-25 00:17:35 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/3302
Author: @mdbell
Created: 8/19/2024
Status: 🔄 Open

Base: masterHead: forward-auth


📝 Commits (3)

  • 6ff2333 inital impl
  • 628b97c ise ip instead of rolling my own ip address validation
  • 9b7e21a added labels for forward authentication

📊 Changes

8 files changed (+227 additions, -10 deletions)

View changed files

📝 client/pages/config/authentication.vue (+73 -1)
📝 client/strings/en-us.json (+4 -0)
📝 package-lock.json (+5 -4)
📝 package.json (+1 -0)
📝 server/Auth.js (+42 -3)
📝 server/controllers/MiscController.js (+24 -1)
📝 server/objects/settings/ServerSettings.js (+25 -1)
server/utils/ForwardStrategy.js (+53 -0)

📄 Description

I've seen there's been a couple different attempts wrt implementing forward auth (#2189 and #1109 ) and this is my attempt. I've yet to test it out on mobile, and I imagine it's broken there. I have done some basic testing with Authentik + nginx locally and it seems to be working though.

I'd like to have it where the header is user-specified instead of hardcoding X-Forwarded-User. And maybe also require a magic password header as an alternative to IP based validation,similar to how actual budget implements it.

Other things to consider:

  • Do we want to allow the root user to login using this method
  • We probably want some way to indicate to the user that misconfiguring this can potentially expose your server to the entire internet. Perhaps require an explicit ENV var to be set to be able to use it

Screenshot of the settings right now (An IP address can be specficed with or without a CIDR. If omitted the program will treat it as a /0, or exact match):
image


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/3302 **Author:** [@mdbell](https://github.com/mdbell) **Created:** 8/19/2024 **Status:** 🔄 Open **Base:** `master` ← **Head:** `forward-auth` --- ### 📝 Commits (3) - [`6ff2333`](https://github.com/advplyr/audiobookshelf/commit/6ff23332209512705706fece21959ff5164c0089) inital impl - [`628b97c`](https://github.com/advplyr/audiobookshelf/commit/628b97c6dc5fa488897b88bbcb05aba9a2a05efb) ise ip instead of rolling my own ip address validation - [`9b7e21a`](https://github.com/advplyr/audiobookshelf/commit/9b7e21a87e7d3da0b9e9faf22e3d6df5263a9ca3) added labels for forward authentication ### 📊 Changes **8 files changed** (+227 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `client/pages/config/authentication.vue` (+73 -1) 📝 `client/strings/en-us.json` (+4 -0) 📝 `package-lock.json` (+5 -4) 📝 `package.json` (+1 -0) 📝 `server/Auth.js` (+42 -3) 📝 `server/controllers/MiscController.js` (+24 -1) 📝 `server/objects/settings/ServerSettings.js` (+25 -1) ➕ `server/utils/ForwardStrategy.js` (+53 -0) </details> ### 📄 Description I've seen there's been a couple different attempts wrt implementing forward auth (#2189 and #1109 ) and this is my attempt. I've yet to test it out on mobile, and I imagine it's broken there. I have done some basic testing with Authentik + nginx locally and it seems to be working though. I'd like to have it where the header is user-specified instead of hardcoding `X-Forwarded-User`. And maybe also require a magic password header as an alternative to IP based validation,similar to how [actual budget](https://actualbudget.org/docs/advanced/http-header-auth) implements it. Other things to consider: - Do we want to allow the root user to login using this method - We probably want some way to indicate to the user that misconfiguring this can potentially expose your server to the entire internet. Perhaps require an explicit ENV var to be set to be able to use it Screenshot of the settings right now (An IP address can be specficed with or without a CIDR. If omitted the program will treat it as a `/0`, or exact match): ![image](https://github.com/user-attachments/assets/47d7f4dc-8d6c-4c31-b493-6459af0d46f3) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:17:35 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3926