Replies: 3 comments 15 replies
-
After logging in you can check your group definitions in User info (should work with read-only permissions too): |
Beta Was this translation helpful? Give feedback.
-
Hi there, Took me a while to figure out, hopefully this helps you and others trying to get ArgoCD OIDC login to work with Zitadel. Zitadel has a feature called Actions (see https://zitadel.com/blog/custom-claims) which allows you to write JavaScript code to modify the content of tokens. Using this and some example code on their GitHub (https://github.com/zitadel/actions/tree/main/examples) I made the following script which adds the groups claim to the token. function groupsClaim(ctx, api) {
if (ctx.v1.user.grants === undefined || ctx.v1.user.grants.count == 0) {
return;
}
let grants = [];
ctx.v1.user.grants.grants.forEach(claim => {
claim.roles.forEach(role => {
grants.push(role)
})
})
api.v1.claims.setClaim('groups', grants)
} Add this function in Zitadel under actions and then add it to the Complement Token flow. It should look like this: If we inspect the cookie value/token (get cookie value of the Configure both required ArgoCD configmaps as follows: argocd-cm.yaml (see https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/argocd-cm.yaml)
argocd-rbac-cm.yaml (see https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/argocd-rbac-cm.yaml)
In Also make sure to check the following boxes: In the end we have two users in the test setup, both can login to ArgoCD using Zitadel OIDC. One user (administrator) has admin permissions in ArgoCD, the other one (user) has read-only permissions. To verify everything works as intended, log in to ArgoCD and go to User Info. You should now see your username, issuer and most importantly your groups: |
Beta Was this translation helpful? Give feedback.
-
Hi, we are also using Zitadel and I configured everything as described above. See below my apiVersion: v1
data:
admin.enabled: "true"
application.instanceLabelKey: argocd.argoproj.io/instance
exec.enabled: "false"
oidc.config: |
clientID: <REDACTED>
clientSecret: <REDACTED>
issuer: https://<REDACTED>.zitadel.cloud
logoutURL: https://<REDACTED>.zitadel.cloud/oidc/v1/end_session?id_token_hint={{token}}&post_logout_redirect_uri=https%3A%2F%2F<REDACTED>
name: Zitadel
requestedScopes:
- openid
- profile
- email
- groups
skipAudienceCheckWhenTokenHasNoAudience: true
server.rbac.log.enforce.enable: "false"
timeout.hard.reconciliation: 0s
timeout.reconciliation: 180s
url: https://<REDACTED>/
kind: ConfigMap
metadata:
annotations:
meta.helm.sh/release-name: argocd
meta.helm.sh/release-namespace: argocd
creationTimestamp: "2024-07-19T13:28:36Z"
labels:
app.kubernetes.io/component: server
app.kubernetes.io/instance: argocd
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
argocd.argoproj.io/instance: argocd
name: argocd-cm
namespace: argocd
resourceVersion: "1021735"
uid: 2fd831e9-9cc8-4b1c-8103-771fc0af7229 my apiVersion: v1
data:
policy.csv: |
g, PG_AZ_A_KKP_Global_Project-Owner, role:admin
policy.default: ""
scopes: '[groups]'
kind: ConfigMap
metadata:
annotations:
meta.helm.sh/release-name: argocd
meta.helm.sh/release-namespace: argocd
creationTimestamp: "2024-07-19T13:28:36Z"
labels:
app.kubernetes.io/component: server
app.kubernetes.io/instance: argocd
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: argocd-rbac-cm
app.kubernetes.io/part-of: argocd
app.kubernetes.io/version: v2.9.3
helm.sh/chart: argo-cd-5.52.1
name: argocd-rbac-cm
namespace: argocd
resourceVersion: "1022471"
uid: 80ec699f-691d-4e02-909f-af6272b8fd63 and a picture from my and a picture after login: Somebody have an idea whats going on here? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to integrate Zitadel as OIDC provider for SSO login based on the documentation provided at "https://argo-cd.readthedocs.io/en/stable/operator-manual/user-management/#existing-oidc-provider". The login itself works but I'm not able to map users to roles using the policy feature, reason being that Zitadel does not provide a groups claim using the standard structure. On the other end, it provides a claim named "urn:zitadel:iam:org:project:roles" with the following example structure:
It's basically a map whose keys are the roles of a user. I would like to be able to map those keys, for example argocd-admin to a specific argocd admin role. Any ideas how can I make this possible?
OIDC configuration
Target Argocd-rbac-cm
Beta Was this translation helpful? Give feedback.
All reactions