WIP: auth-user-header: Support for Authelia, etc.#1579
WIP: auth-user-header: Support for Authelia, etc.#1579binwiederhier wants to merge 6 commits intomainfrom
auth-user-header: Support for Authelia, etc.#1579Conversation
auth-user-header: Support for Authelia, etc.
Don't you need an exception for example for curl? For example: if header contains Because curl and other integrations and automations never can support all auth types, for example passkeys. Header based authentication is more for webapps that are used by humans and to avoid creating in every app an own user account. A real good solution would be integrating oidc directly into ntfy. Header based auth has a flaw. What if user will be disabled in the idp (here: auhelia)? A cronjob need to check if user is disabled on idp (here: authelia) and disable or delete it in the app (here: ntfy), because a disabled user could still use the api keys... |
|
I would maybe agree that since there is no separate api route that can be easily filtered, that makes it a bit more diffisult to use nfty with anything that would use just a token, so OIDC seems like a good solution, as it does not change how tokens work and basically just "replaces" the username + password authentication and of course facillitates creation of new users. |
|
@helmut72 @JoeJoeTV You guys are wrong. This header is meant to effectively bypass authentication. You can use it with https://github.com/oauth2-proxy/oauth-proxy if you want oidc. The point is to keep ntfy.sh simple and allow for outsourcing auth to something else. If the user is disabled, your auth proxy obviously should not forward the request with the auth header. @binwiederhier regarding how the android app should work: can it maybe open a webview to follow redirects if it gets one that doesn't lead to a ntfy.sh server, and save the session cookie? That's all you need for it to work with any normal auth proxy. |
But let's way you have a reverse proxy that handles the authetication request and sets the header before sending the actual request to ntfy. |
This seems more complex to me than just having a redirect by the web app which gets handled by the app, like other services do with their e.g. mobile apps. |
|
You can set up another endpoint for token auth, there's no rule this endpoint has to be the only one. If you're using something like authelia or oauth-proxy or a custom setup, then you you should use an auth method they support. This PR doesn't mean that other auth methods will stop existing |
I'm not really sure what you're referring to. |
|
I am interested in support for external authentication to be added to ntfy (since I am trying to put most services in SSO), but if I use it, I would still like to use all the features provided by ntfy. EDIT: Additionally, if I want to use ntfy for notifications somewhere, I would like to not just put my username and password for the entire IDP account there, but just have it limited to ntfy and also be easily revokable without changing the passwort of the account. |
You mean a path exception like for example
Don't get me wrong. I only mentioned oidc because it's the smartest solution. |
This implements #601. It partially works. I tested it with Authelia.
What works
auth-user-header(e.g.Remote-User) is passed from Authelia to ntfy, and ntfy then uses that header to pick the configured user in the backendauth-logout-urlis configured, which allows you to log out via AutheliaWhat doesn't work
ntfyIndexedDB is used instead ofntfy-$username), which leads to the wrong topics being shown in the sidebar. This can be easily reproduced when switching between users.Setup
ntfy/server.yml
Caddyfile
authelia/configuration.yml
docker-compose.yml