feat: Implement SSO Proxy Authentication for music servers (Cloudflare Access, Authelia)#1678
feat: Implement SSO Proxy Authentication for music servers (Cloudflare Access, Authelia)#1678FaKiieZ wants to merge 9 commits intojeffvli:developmentfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You can just run |
|
I may need some time before I review this. I don't personally run any SSO so I can't immediately test this. |
No worries at all, take your time. I'll continue using and testing my local build of this PR in the meantime. If it's helpful, Cloudflare Zero Trust provides a relatively simple way to put SSO in front of a site for testing purposes. |
|
I don't know what the expected behavior is, but all I see when attempting to use this flow is that I authenticate with my provider in a new window, and then it redirects to Navidrome in that window. Closing said window just results in an error |
Hey, thanks for testing! Did you test this in the browser or the electron app? |
|
I tested it on the electron app. For the browser, I don't actually have this problem, since I can just host Feishin behind the same reverse proxy auth, so it never really knows that it exists. |
|
@kgarner7 I've pushed a fix for this! Could you please test again and let me know if this resolves the issue for you? |
|
Yes, I pulled it again. I see the cookies actually being sent, but at least for the ND endpoint, I don't see them actually being used. Maybe some hooks are needed for the ndApiClient (and similar endpoints)? |
…with global session management and secure Electron login flow.
13a452d to
b9f5e48
Compare
|
@kgarner7 You were totally right about the ND endpoint needing hooks! I ended up completely refactoring the features and building a global interceptor that handles it for all of them. The code should now be more focused on the relevant features I wanted to implement. |
|
@FaKiieZ Hey there, you seem to be working hard at the very issue plauging me currently (Navidrom + NpmPlus + authelia + Feishin) and im having trouble figuring out how to test out your version of the app. the vercel deployments here dont see to show the options for enabling authelia/sso |
|
Hey @anastasia-v-r Thanks for reaching out. I'm really glad you're interested in this and that you're using Authelia! I haven't been able to test this with an Authelia setup myself yet, so your feedback is incredibly valuable to me. 😄 I just added the functionality that was needed to make this feature work in the web version. Currently the easiest way to use the feature in the web version, is to have feishin hosted on the same domain as your music server. Otherwise you must configure your SSO provider to handle CORS and the cookie correctly, which can be a pain. The recommended way is to use the desktop app version of feishin, because then you won't have any CORS issues. I hope it will work for you and I'm looking forward to your feedback! |
|
@FaKiieZ If I understand correctly, this only supports SSO and while thats awesome I just realized I actually use Authelia configured for OTP so I don't believe I can test it. Also, Im actually unsure of how to get docker to build out the webclient container of your specfic branch so i can test it with my config 😅 |
|
@anastasia-v-r Yes, this feature isn't intended to authenticate your access to Feishin itself. Instead, it’s designed to authenticate you with a music server - primarily via the Feishin desktop app when you're connecting from a different network. But I think you can actually still test this! Even with OTP, the authentication happens at the proxy level (Authelia). Once you've authenticated there, Feishin simply passes those credentials/headers to your music server. Feishin itself doesn't 'see' the OTP process. Regarding the Docker build: You can test my branch by cloning it and running To use the built image, just update your docker-compose.yml to point to the local tag like this: services:
feishin:
image: feishin-sso # Change this from the official image to your local build
# ... the rest of your configThen just run |
|
@FaKiieZ Alright I've managed to get your container working on a sublocation of a authelia set sub domain proxy host of mine. Go to feishin sublocation -> enter server details as the sso redirect page works as well! I'd love to test it on desktop but im not sure how to google to build this application locally. I theres an appimage for it on the Arch user repository but im not sure how to custom build an image using the source repo. My goal is to be able to simply use my navidrome doman protected by authelia with my desktop feishin. |
|
@anastasia-v-r Hey thank you for testing this further! Im glad you were able to make it work. You can download my version of the desktop app all the way at the bottom of the pull request when you open up the section "All checks have passed": There you should see the three entries called something like "Publish (PR) / publish (windows-latest) (pull_request)" and the other two are for ubuntu and macos. Click on either one of them. Then you can navigate to the summary of the action: Here you scroll all the way to the bottom, to the section "Artifacts", where you can download the one that fits your OS: Again, thank you for testing! If you have any other problems, let me know. |
|
@FaKiieZ When running the desktop version, checking the sso box does cause the popup to open, i was then able to sign into authelia, enter my otp, and be redirected to the audio server, problem. the sso window just keeps opening up the navidrome web ui. it doesnt end up actually connecting. and this is using the same connection settings as the web player version.
|
|
@anastasia-v-r Since you are using Authelia, according to this guide: https://www.authelia.com/configuration/session/introduction/, you must use When the window doesn't close itself, this means the cookie that is needed isn't existing yet. Which means it is either looking for the "wrong" cookie or the wanted cookie is not existing. |
|
@FaKiieZ It is configured as you asked and still not working. I am unsure of why but my authelia config surely has the cookies setup correctly |
|
@FaKiieZ So in my authelia config ive triple checked and the cookie is indeed set to "authelia_session" and when i set the cookie name directly in the field to also
|
|
Following up testing between firefox browser, chrome browser, and the app, shows that th 302 request marked "login" on the desktop app, it doesnt send the authelia session cookie at ALL which is why it fails. the request header just, doesnt put the cookie in. on firefox and chrome the original 302 login request shows that in the request headers the cookie is stored marked and sent over ut not in the app when inspecting the network. More testing. Jeez this is complex. When inputting the correct information. while the cookies arent sent over it ALSO looks like even the |
|
@anastasia-v-r I will have to try this out with Authelia myself. I'm using Cloudflare Zero Trust Access and for me it works. I have to look deeper into this issue, but currently I'm not having too much time because of dues in school and also work. It will probably take 3 weeks and then I should have a little bit more time, I'm sorry. And thank you very much for your intense testing! |
|
@FaKiieZ No problem! You're doing this for free on your own time so its alright! I did more research and it seems that if we can simple manually stuff the tokens into the header in the |






I really love feishin. It is such a great music player. The only thing that kept me from using it was, that I expose my music server with a Cloudflare Zero Trust Access proxy. That's the reason why I wanted to implement a dual authentication for feishin. Currently this is only working when using electron. In the Browser, feishin needs to be hosted on the same domain. If not you will have CORS errors because you can't share cookies from a different domain.
Next to the option to add a dual cookie auth for a server, I also added an option in the settings to clear your cookies. With this option it is easy to test the reauthentication flow.
I'm looking forward to your review and would really appreciate to have this functionality in feishin.
I tested this feature on electron with a navidrome server.