github.com/argoproj/argo-cd/v2@v2.10.9/docs/operator-manual/user-management/google.md (about) 1 # Google 2 3 There are three different ways to integrate Argo CD login with your Google Workspace users. Generally the OpenID Connect (_oidc_) method would be the recommended way of doing this integration (and easier, as well...), but depending on your needs, you may choose a different option. 4 5 * [OpenID Connect using Dex](#openid-connect-using-dex) 6 This is the recommended login method if you don't need information about the groups the user's belongs to. Google doesn't expose the `groups` claim via _oidc_, so you won't be able to use Google Groups membership information for RBAC. 7 * [SAML App Auth using Dex](#saml-app-auth-using-dex) 8 Dex [recommends avoiding this method](https://dexidp.io/docs/connectors/saml/#warning). Also, you won't get Google Groups membership information through this method. 9 * [OpenID Connect plus Google Groups using Dex](#openid-connect-plus-google-groups-using-dex) 10 This is the recommended method if you need to use Google Groups membership in your RBAC configuration. 11 12 Once you've set up one of the above integrations, be sure to edit `argo-rbac-cm` to configure permissions (as in the example below). See [RBAC Configurations](../rbac.md) for more detailed scenarios. 13 14 ```yaml 15 apiVersion: v1 16 kind: ConfigMap 17 metadata: 18 name: argocd-rbac-cm 19 namespace: argocd 20 data: 21 policy.default: role:readonly 22 ``` 23 24 ## OpenID Connect using Dex 25 26 ### Configure your OAuth consent screen 27 28 If you've never configured this, you'll be redirected straight to this if you try to create an OAuth Client ID 29 30 1. Go to your [OAuth Consent](https://console.cloud.google.com/apis/credentials/consent) configuration. If you still haven't created one, select `Internal` or `External` and click `Create` 31 2. Go and [edit your OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent/edit) Verify you're in the correct project! 32 3. Configure a name for your login app and a user support email address 33 4. The app logo and filling the information links is not mandatory, but it's a nice touch for the login page 34 5. In "Authorized domains" add the domains who are allowed to log in to ArgoCD (e.g. if you add `example.com`, all Google Workspace users with an `@example.com` address will be able to log in) 35 6. Save to continue to the "Scopes" section 36 7. Click on "Add or remove scopes" and add the `.../auth/userinfo.profile` and the `openid` scopes 37 8. Save, review the summary of your changes and finish 38 39 ### Configure a new OAuth Client ID 40 41 1. Go to your [Google API Credentials](https://console.cloud.google.com/apis/credentials) console, and make sure you're in the correct project. 42 2. Click on "+Create Credentials"/"OAuth Client ID" 43 3. Select "Web Application" in the Application Type drop down menu, and enter an identifying name for your app (e.g. `Argo CD`) 44 4. Fill "Authorized JavaScript origins" with your Argo CD URL, e.g. `https://argocd.example.com` 45 5. Fill "Authorized redirect URIs" with your Argo CD URL plus `/api/dex/callback`, e.g. `https://argocd.example.com/api/dex/callback` 46 47  48 49 6. Click "Create" and save your "Client ID" and your "Client Secret" for later 50 51 ### Configure Argo to use OpenID Connect 52 53 Edit `argocd-cm` and add the following `dex.config` to the data section, replacing `clientID` and `clientSecret` with the values you saved before: 54 55 ```yaml 56 data: 57 url: https://argocd.example.com 58 dex.config: | 59 connectors: 60 - config: 61 issuer: https://accounts.google.com 62 clientID: XXXXXXXXXXXXX.apps.googleusercontent.com 63 clientSecret: XXXXXXXXXXXXX 64 type: oidc 65 id: google 66 name: Google 67 ``` 68 69 ### References 70 71 - [Dex oidc connector docs](https://dexidp.io/docs/connectors/oidc/) 72 73 ## SAML App Auth using Dex 74 75 ### Configure a new SAML App 76 77 --- 78 !!! warning "Deprecation Warning" 79 80 Note that, according to [Dex documentation](https://dexidp.io/docs/connectors/saml/#warning), SAML is considered unsafe and they are planning to deprecate that module. 81 82 --- 83 84 1. In the [Google admin console](https://admin.google.com), open the left-side menu and select `Apps` > `SAML Apps` 85 86  87 88 2. Under `Add App` select `Add custom SAML app` 89 90  91 92 3. Enter a `Name` for the application (e.g. `Argo CD`), then choose `Continue` 93 94  95 96 4. Download the metadata or copy the `SSO URL`, `Certificate`, and optionally `Entity ID` from the identity provider details for use in the next section. Choose `continue`. 97 - Base64 encode the contents of the certificate file, for example: 98 - `$ cat ArgoCD.cer | base64` 99 - *Keep a copy of the encoded output to be used in the next section.* 100 - *Ensure that the certificate is in PEM format before base64 encoding* 101 102  103 104 5. For both the `ACS URL` and `Entity ID`, use your Argo Dex Callback URL, for example: `https://argocd.example.com/api/dex/callback` 105 106  107 108 6. Add SAML Attribute Mapping, Map `Primary email` to `name` and `Primary Email` to `email`. and click `ADD MAPPING` button. 109 110  111 112 7. Finish creating the application. 113 114 ### Configure Argo to use the new Google SAML App 115 116 Edit `argocd-cm` and add the following `dex.config` to the data section, replacing the `caData`, `argocd.example.com`, `sso-url`, and optionally `google-entity-id` with your values from the Google SAML App: 117 118 ```yaml 119 data: 120 url: https://argocd.example.com 121 dex.config: | 122 connectors: 123 - type: saml 124 id: saml 125 name: saml 126 config: 127 ssoURL: https://sso-url (e.g. https://accounts.google.com/o/saml2/idp?idpid=Abcde0) 128 entityIssuer: https://argocd.example.com/api/dex/callback 129 caData: | 130 BASE64-ENCODED-CERTIFICATE-DATA 131 redirectURI: https://argocd.example.com/api/dex/callback 132 usernameAttr: name 133 emailAttr: email 134 # optional 135 ssoIssuer: https://google-entity-id (e.g. https://accounts.google.com/o/saml2?idpid=Abcde0) 136 ``` 137 138 ### References 139 140 - [Dex SAML connector docs](https://dexidp.io/docs/connectors/saml/) 141 - [Google's SAML error messages](https://support.google.com/a/answer/6301076?hl=en) 142 143 ## OpenID Connect plus Google Groups using Dex 144 145 --- 146 !!! warning "Limited group information" 147 148 When using this feature you'll only receive the list of groups the user is a direct member. 149 150 So, lets say you have this hierarchy of groups and subgroups: 151 `all@example.com --> tech@example.com --> devs@example.com --> you@example.com` 152 The only group you would receive through Dex would be `devs@example.com` 153 154 --- 155 156 We're going to use Dex's `google` connector to get additional Google Groups information from your users, allowing you to use group membership on your RBAC, i.e., giving `admin` role to the whole `sysadmins@yourcompany.com` group. 157 158 This connector uses two different credentials: 159 160 - An oidc client ID and secret 161 Same as when you're configuring an [OpenID connection](#openid-connect-using-dex), this authenticates your users 162 - A Google service account 163 This is used to connect to the Google Directory API and pull information about your user's group membership 164 165 Also, you'll need the email address for an admin user on this domain. Dex will impersonate that user identity to fetch user information from the API. 166 167 ### Configure OpenID Connect 168 169 Go through the same steps as in [OpenID Connect using Dex](#openid-connect-using-dex), except for configuring `argocd-cm`. We'll do that later. 170 171 ### Set up Directory API access 172 173 1. Follow [Google instructions to create a service account with Domain-Wide Delegation](https://developers.google.com/admin-sdk/directory/v1/guides/delegation) 174 - When assigning API scopes to the service account assign **only** the `https://www.googleapis.com/auth/admin.directory.group.readonly` scope and nothing else. If you assign any other scopes, you won't be able to fetch information from the API 175 - Create the credentials in JSON format and store them in a safe place, we'll need them later 176 2. Enable the [Admin SDK](https://console.developers.google.com/apis/library/admin.googleapis.com/) 177 178 ### Configure Dex 179 180 1. Create a secret with the contents of the previous json file encoded in base64, like this: 181 182 apiVersion: v1 183 kind: Secret 184 metadata: 185 name: argocd-google-groups-json 186 namespace: argocd 187 data: 188 googleAuth.json: JSON_FILE_BASE64_ENCODED 189 190 2. Edit your `argocd-dex-server` deployment to mount that secret as a file 191 - Add a volume mount in `/spec/template/spec/containers/0/volumeMounts/` like this. Be aware of editing the running container and not the init container! 192 193 volumeMounts: 194 - mountPath: /shared 195 name: static-files 196 - mountPath: /tmp 197 name: dexconfig 198 - mountPath: /tmp/oidc 199 name: google-json 200 readOnly: true 201 202 - Add a volume in `/spec/template/spec/volumes/` like this: 203 204 volumes: 205 - emptyDir: {} 206 name: static-files 207 - emptyDir: {} 208 name: dexconfig 209 - name: google-json 210 secret: 211 defaultMode: 420 212 secretName: argocd-google-groups-json 213 214 3. Edit `argocd-cm` and add the following `dex.config` to the data section, replacing `clientID` and `clientSecret` with the values you saved before, `adminEmail` with the address for the admin user you're going to impersonate, and editing `redirectURI` with your Argo CD domain: 215 216 dex.config: | 217 connectors: 218 - config: 219 redirectURI: https://argocd.example.com/api/dex/callback 220 clientID: XXXXXXXXXXXXX.apps.googleusercontent.com 221 clientSecret: XXXXXXXXXXXXX 222 serviceAccountFilePath: /tmp/oidc/googleAuth.json 223 adminEmail: admin-email@example.com 224 type: google 225 id: google 226 name: Google 227 228 4. Restart your `argocd-dex-server` deployment to be sure it's using the latest configuration 229 5. Login to Argo CD and go to the "User info" section, were you should see the groups you're member 230  231 6. Now you can use groups email addresses to give RBAC permissions 232 233 ### References 234 235 - [Dex Google connector docs](https://dexidp.io/docs/connectors/google/)