-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HELP] User settings to access from maven settings.xml #29
Comments
Hi, your settings.xml should be fine. You missed an important part of the README that says
That means you need to configure an additional proxy with the logic to decide whether the request to your nexus.example.com goes to Authentik (OAuth2 Proxy replacement) or straight to Nexus. The nature of these authenticating proxies is rather interactive and that doesn't work for build tools like maven and gradle. The README has examples for HAproxy and nginx. You can probably achieve the same with pretty much any common proxy I can think of. |
After several hours testing various configurations, the only one with which I've managed to achieve this is by creating a new Ingress in Nexus that redirects traffic from /repository directly to the Nexus service, leaving the rest of the configuration intact. This is because, having protected all of Nexus with the authentication annotations, selectively disabling proxy redirection for specific paths is not possible, so creating a new Ingress is necessary. apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nexus-repository-path
namespace: nexus
annotations:
cert-manager.io/cluster-issuer: letsencrypt-pro
nginx.ingress.kubernetes.io/affinity: cookie
spec:
ingressClassName: nginx
tls:
- hosts:
- repo.XXXX.com
secretName: tls-nexus
rules:
- host: repo.XXXX.com
http:
paths:
- path: /repository
pathType: Prefix
backend:
service:
name: sistemas-sonatype-nexus-nexus3
port:
name: http This will be added to the documentation upon verification. |
Glad you found a way. I'm sure sooner or later some other k8s user will come along and propose an improvement (if there is any), but this at least saves everyone else some time when getting started. |
Hi there, and happy new year!
I'm using oauth2-proxy-plugin to connect with Authentik, and everything is fine.
I'm able to access to UI with my user from the ID provider, and do everything.
But... I'm trying to use the user/token in my .m2/settings.xml to download artifacts... and it doesn't work.
I'm getting an Authentik .html in the .m2/repository/XXXX when run mvn clean package
I think is something I'm missing in the authentication config... but don't know what.
Here is my settings.xml:
And here is the error:
The text was updated successfully, but these errors were encountered: