mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-26 09:55:51 +03:00
[GH-ISSUE #437] Extended authentication (SSO) #367
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#367
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 @lazee486 on GitHub (May 30, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/437
This software is amazing for homelab, I'd love if had the ability to use with
https://github.com/vouch/vouch-proxy/blob/master/README.md
Or keycloak
Basically any single sign on or similar system
It would be at the same step as your current password protection. Currently I have to put password so many times...
Instead of each service having its own(and some don't) any site you tag with auth gets proxied with sso
@ITNerdbox commented on GitHub (Jun 2, 2020):
Also, certificate based authentication would be a nice to have feature.
@archness1 commented on GitHub (Jun 15, 2020):
OIDC/Keycloak integration would be awesome to have with this.
@fbartels commented on GitHub (Jun 23, 2020):
https://github.com/jc21/nginx-proxy-manager/pull/433 added the ability to do oidc
@joe307bad commented on GitHub (Dec 6, 2020):
Keycloak works with
nginx-proxy-manager!@MarioGK commented on GitHub (Jun 25, 2021):
Any updates on this issue?
@chaptergy commented on GitHub (Jun 25, 2021):
It will not be in this version, unless someone from the community wants to implement it. See https://github.com/jc21/nginx-proxy-manager/discussions/1202.
@stibra commented on GitHub (Sep 16, 2021):
Please integrate NPM with spnego for Kerberos integration.
https://github.com/stnoonan/spnego-http-auth-nginx-module
@hairy-tortoise commented on GitHub (Jan 10, 2023):
Any update on this?
@marekful commented on GitHub (Feb 24, 2023):
FYI https://github.com/NginxProxyManager/nginx-proxy-manager/pull/2630 @hairy-tortoise
@Hadatko commented on GitHub (Aug 25, 2023):
+1
@fomurjiom commented on GitHub (Feb 2, 2024):
+1 pls
@alexsalex commented on GitHub (Feb 10, 2024):
+100500
Authentik implementation will be amazing too!
@github-actions[bot] commented on GitHub (Aug 30, 2024):
Issue is now considered stale. If you want to keep it open, please comment 👍
@dimo414 commented on GitHub (Aug 30, 2024):
Stalebot is a blight
@stibra commented on GitHub (Aug 30, 2024):
KeyCloak and Kerberos please.
@lazee486 commented on GitHub (Oct 15, 2024):
just an update, by using the section where you can post your own Nginx commands on a proxy. NPM does work with Authelia and authentik that ive tested, as a domain level auth. ie: if you go to radarr.mysite.com, it will redirect you to authentik sso page, sign in, then store and use that cookie so going to sonarr.mysite.com or any other site behind your sso becomes passwordless. you also have to configure the apps to accept the SSO or no password to make it seamless, but this does work.
so unless this is a request for the addition of maybe presaved configs or per app buttons for this, it works and Im happy. :)
@MahmoudAlyuDeen commented on GitHub (Oct 17, 2024):
The reverse proxy functionality of NPM works with Authentik / Authelia / other tools.
But the web GUI of NPM itself doesn't work:
It would be awesome if we don't have to enter an email or password to get to NPM settings.
@moutasem1989 commented on GitHub (Oct 24, 2024):
Here is how I set up Authentik to log into NginX Proxy Manager UI:
In this case i created A group with special permition to log into several services but you can do this on user level. In the group/user add the following Attributes with the correct
user/pass. Leave the Token as NullUnder
Property Mappingscreate a newScoop Maping. Name isNginX Tokenand Scoop Name must beak_proxyotherwise NginX cannot call the apropeate headers. Adjust the Expression fromgroup_attributes()toattributesfor user based authentication.The Expression should be as following:
The Expression will fetch a new Autherization Token which can be accessed through the
X-Nginx-TokenHeader.Create a Proxy Provider and make sure the Scoop we just created is included.
In NPM I added this configuration. Dnt forget to change the Authentik Server address
That should be it. I tried it and it works perfectly
edit code to handle exceptions
@MahmoudAlyuDeen commented on GitHub (Oct 24, 2024):
@moutasem1989 great approach!
I tried the custom property mapping with user properties and I got this exception when navigating to the proxied page, same when using the test function from authentik admin panel:
@moutasem1989 commented on GitHub (Oct 25, 2024):
@MahmoudAlyuDeen The code above makes a call to Nginx to retrieve an authentication code in JSON file. If the server cannot be reached because of the wrong host name or IP address or simply bad authentication values it will throw an error. Make sure the Authentik server and NginX are on the same network and try the following. It should return the entire JSON file not just the token. If it is also unsuccessful, then a connection was not possible.
comment out all the lines after
with urlopen…and add this and try the test function.In Terminal you can also try this to see if an authentication token can be fetched. The bove code is the express of this curl command:
Hope it works out!
@MahmoudAlyuDeen commented on GitHub (Oct 25, 2024):
Okay, I figured out one problem with your help, thanks! 😅 I had the external URL in the expression but switching to the internal URL of NPM works.
Testing the scope mapping in authentik generates a valid token now.
🤔 Somehow I still get this error when navigating to the proxied page:
This is the same error I get when I test the scope mapping with a user, that doesn't have the appropriate attributes.
@moutasem1989 commented on GitHub (Oct 25, 2024):
If you added the attributes to the group use
group_attributes()otherwise it would be a user attribute and should be replaced withattributes. Check that the attributes names in User/Group are identical to the ones called in the code. Only Users/Groups with attributes names can log in.I did some changes to handle exceptions. Check the Property Mapping code: I made it so if a user has no name it will return null instead of throwing an error trying to retrieve values
Alternatively you can directly set the values in the code.
@MahmoudAlyuDeen commented on GitHub (Oct 25, 2024):
Nice! No more exceptions. But now login doesn't work, I'm now just getting redirected to NPM login page.
@moutasem1989 commented on GitHub (Oct 25, 2024):
Also try it incognito mode cuz cookies could mess things up
@MahmoudAlyuDeen commented on GitHub (Oct 25, 2024):
Tried in incognito.
Looking at the logs, the token is there with the correct scope. ✅
But there are also default scopes that I suspect could be confusing NPM, when I try removing the default scopes from the provider, they just keep coming back.
Is there any configuration I need to do on NPM side? Other than the custom nginx code you posted?
@moutasem1989 commented on GitHub (Oct 25, 2024):
The scoop is there but you need to check the headers
$upstream_http_x_nginx_tokencalls for the value ofX-Nginx-Tokenattribute. Check if the user has the right to get the token and then check if the attribute value is being called. The headerAuthorizationshould be“Bearer <token>”.@lazee486 commented on GitHub (Oct 25, 2024):
I mean I know it could be an issue if it broke, but in docker restrict port 81 to localhost and use npm to access it, and put authentik etc there...if it broke just remove the interface restriction on the docker till you fixed it
@eligibbs commented on GitHub (Nov 8, 2024):
@moutasem1989 Is this method still working, even with commit 280bac8 causing problems with some of the code here?
I'm in the same boat as @MahmoudAlyuDeen where my scope tests fine with a token, but I get redirected to the login page.
With "custom locations" not working, can you define locations in the advanced field? Depending on the configuration, I can quickly get an error 500
@apocaliss92 commented on GitHub (Dec 7, 2024):
Tried this approach and getting redirect on the login page too, mapping seems fine on authentic
The token check seems failing, returns a bad request error but no further details unfortunately
Actually something is there
[12/7/2024] [11:46:42 AM] [Express ] › ⚠ warning Existing token contained invalid user data
@exenza commented on GitHub (Apr 25, 2025):
get same error, and when I test the Property mappings I get the following:
Traceback (most recent call last): File "/authentik/core/models.py", line 984, in evaluate return evaluator.evaluate(self.expression) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/authentik/core/expression/evaluator.py", line 89, in evaluate return super().evaluate(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/authentik/lib/expression/evaluator.py", line 263, in evaluate raise exc File "NgiX Token", line 23, in <module> File "NgiX Token", line 9, in handler builtins.TypeError: 'dict' object is not callable@github-actions[bot] commented on GitHub (Nov 12, 2025):
Issue is now considered stale. If you want to keep it open, please comment 👍
@kominoshja commented on GitHub (Nov 12, 2025):
👍