mirror of
https://github.com/koel/koel.git
synced 2026-04-25 16:56:02 +03:00
[GH-ISSUE #1642] SSO via proxy auth header #895
Labels
No labels
Authentication
Dependencies
Documentation
Feature Request
Flac
Help Wanted
Installation/Setup
Integration
Mobile
PR Welcome
Pending Release
Performance
Playlist
S3
Search
Sync
[Pri] Low
[Pri] Normal
[Status] Keep Open
[Status] Needs Author Reply
[Status] Needs Review
[Status] Stale
[Status] Will Implement
[Type] Blessed
[Type] Bug
[Type] Duplicate
[Type] Enhancement
[Type] Help Request
[Type] Question
[Type] Task
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/koel-koel#895
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @HannesJo0139 on GitHub (Dec 27, 2022).
Original GitHub issue: https://github.com/koel/koel/issues/1642
I'm using single-sign-on and I noticed that some years ago you stated that you would not want to implement and support stuff like OAUTH. I understand that OAUTH, OpenID, etc. are complex to implement and support, but would you consider implementing authorization via proxy-auth header? The login process would remain the same, except that the credentials are provided by the reverse proxy via header.
@TheRealGramdalf commented on GitHub (Dec 22, 2023):
@phanan I'm curious to know what your stance is on this - is it out of scope, or is it on the roadmap?
Koel looks like an awesome functional music server, and SSO via auth headers would make it that much more viable for many people, myself included. I would recommend this being an opt-in feature; with a warning that this could prove a security risk if configured incorrectly - as I expand on later, I would be happy to create said documentation, along with some recommendations for a secure implementations.
Though I'm no expert with header auth, it seems to usually consist of a couple things:
remote-user) to determine whether a user is authenticated or not. If supplied, it is assumed that the user has authenticated themselves already, and koel allows access (without showing the login screen)remote-preferred-name).If you (or a contributor) were to implement the functionality, I would be happy to write documentation for it's general usage, including a starting point for making sure it is deployed at least semi-securely.
@phanan commented on GitHub (Dec 22, 2023):
This looks interesting and I can imagine some users can find it useful. The
implementation isn’t too straightforward though, as I can already imagine:
header name, proxy IP masks)
e.g., via a checkbox.
traditional login flow can be skipped altogether, I imagine Koel would have
to always look for the remote user header AND the token, and create the
latter on the fly if missing.
And of course, maintenance and documentation will be a burden.
On Fri, Dec 22, 2023 at 03:34 TheRealGramdalf @.***>
wrote:
@phanan commented on GitHub (Mar 30, 2024):
@TheRealGramdalf Since I'm not familiar with the topic, what's typically the value of
REMOTE_USER? If it's not an email address, we'll have some troubles, as Koel uses email addresses for authentication.@TheRealGramdalf commented on GitHub (Mar 30, 2024):
It can be set to one of a couple values; in the context of OIDC it's typically
name(username),sub(a UUID), oremail(email address).subis ideal, since it's guaranteed to be unique - you don't want a situation in which the remote user changes their email address/username (which can typically happen at any time, and koel wouldn't necessarily be notified of the change) and gets logged in to a completely new account, or an account that used to belong to someone else. The username/email is typically set byremote-preferred-name, which is then used in the UI instead of the UUID.@phanan commented on GitHub (Mar 30, 2024):
Hmm, in such a case I wonder what the email value is supposed to be. Any
suggestion?
On Sat, Mar 30, 2024 at 18:37 TheRealGramdalf @.***>
wrote:
@TheRealGramdalf commented on GitHub (Mar 30, 2024):
Speaking generally, it's possible to set
remote-userto any of the three (sub,name,email), the same can be said forremote-preferred-name. This leaves it up to the administrator to decide which one is used as a UUID, and which one is used as the displayname.@phanan commented on GitHub (Mar 30, 2024):
We’d want the users to be able to use the mobile app as well, which
requires an email/password pair. To achieve this, we can force the user to
set an email and password upon the first login. Subsequent logins via web
will just work seamlessly using the remote_user header, and the user can
use the email/password credentials for the mobile app. Wdyt?
On Sat, Mar 30, 2024 at 19:07 TheRealGramdalf @.***>
wrote:
@TheRealGramdalf commented on GitHub (Mar 30, 2024):
That should technically work, but in some cases that kind of defeats the point of SSO. I would take a look at https://github.com/paulgessinger/swift-paperless/issues/50 for reference, they're going through a very similar process
@phanan commented on GitHub (Mar 30, 2024):
I agree that the idea of using email/password defeats the point of SSO, but
I’d still think it’s a fair tradeoff to support two (very different
platforms) considering the maintenance effort. Furthermore, the mobile app
authentication typically must be done only once, as the token is
long-lived. Thoughts?
On Sat, Mar 30, 2024 at 19:31 TheRealGramdalf @.***>
wrote:
@TheRealGramdalf commented on GitHub (Mar 30, 2024):
This may be more work, but you could also employ the use of an API token directly - log in to the the WebUI in a browser, and it gives you a QR code/access token. Scanning the QR code/inputting the access token (which could be short lived, like a TOTP) in the koel app would contact the server, and it could issue a proper long-lived API token. This would require changes in the mobile app, but would be relatively simple compared to implementing native SSO - it would mostly be a re-use of the password feature (I would just forget about usernames here, since the access token is already tied to the account, and that would simplify things in terms of mapping an email/displayname to a UUID).
This would be similar to how Jellyfin does quick connect - which is how 9p4/jellyfin-sso supports mobile apps currently (native SSO support is on the official roadmap in the future).
@phanan commented on GitHub (Mar 30, 2024):
That’s a great idea! I will investigate more into the direction, thank you.
On Sat, Mar 30, 2024 at 19:57 TheRealGramdalf @.***>
wrote:
@phanan commented on GitHub (Mar 31, 2024):
@TheRealGramdalf Can you do me a favor and reach out to me@phanan.net? I'd like to discuss a bit further on this topic.
@phanan commented on GitHub (Jul 10, 2024):
Implemented as beta in v7 Plus.