|
| 1 | +--- |
| 2 | +title: "Credential Consumer Identities" |
| 3 | +description: "Complete reference for OCM credential consumer identity types, their attributes, and credential properties." |
| 4 | +icon: "🔑" |
| 5 | +weight: 2 |
| 6 | +toc: true |
| 7 | +--- |
| 8 | + |
| 9 | +This page is the technical reference for credential consumer identities — the key-value maps OCM uses to look up credentials for a given operation. For a high-level introduction, see [Credential System]({{< relref "docs/concepts/credential-system.md" >}}). |
| 10 | + |
| 11 | +## Overview |
| 12 | + |
| 13 | +Every time OCM needs credentials (accessing a registry, signing a component version), it constructs a **lookup identity** — a map of string attributes describing what it needs credentials for. The credential system then searches configured consumers for a matching entry. |
| 14 | + |
| 15 | +A consumer entry in `.ocmconfig` looks like this: |
| 16 | + |
| 17 | +```yaml |
| 18 | +type: generic.config.ocm.software/v1 |
| 19 | +configurations: |
| 20 | + - type: credentials.config.ocm.software |
| 21 | + consumers: |
| 22 | + - identity: |
| 23 | + type: <identity-type> |
| 24 | + # ... type-specific attributes |
| 25 | + credentials: |
| 26 | + - type: Credentials/v1 |
| 27 | + properties: |
| 28 | + # ... key-value credential properties |
| 29 | +``` |
| 30 | + |
| 31 | +OCM currently defines two consumer identity types: |
| 32 | + |
| 33 | +| Identity Type | Used For | |
| 34 | +|---|---| |
| 35 | +| [`OCIRepository`](#ocirepository) | Authenticating against OCI registries | |
| 36 | +| [`RSA/v1alpha1`](#rsav1alpha1) | Providing signing and verification keys | |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## OCIRepository |
| 41 | + |
| 42 | +Used when OCM accesses an OCI registry — pushing, pulling, or resolving component versions and resources. |
| 43 | + |
| 44 | +### Identity Attributes |
| 45 | + |
| 46 | +| Attribute | Required | Description | |
| 47 | +|---|---|---| |
| 48 | +| `type` | Yes | Must be `OCIRepository` | |
| 49 | +| `hostname` | Yes | Registry hostname (e.g. `ghcr.io`, `registry.example.com`) | |
| 50 | +| `path` | No | Repository path. Supports glob patterns (`*` matches one path segment). If omitted, matches any path on the hostname. | |
| 51 | +| `scheme` | No | URL scheme (`https`, `http`, `oci`). If omitted, matches any scheme. If set, must match exactly. | |
| 52 | +| `port` | No | Port number as string. Default ports are applied when `scheme` is set: `https` and `oci` default to `443`, `http` defaults to `80`. | |
| 53 | + |
| 54 | +### Credential Properties |
| 55 | + |
| 56 | +| Property | Description | |
| 57 | +|---|---| |
| 58 | +| `username` | Registry username | |
| 59 | +| `password` | Registry password or token | |
| 60 | + |
| 61 | +### Matching Behavior |
| 62 | + |
| 63 | +Matching runs three chained checks — all must pass: |
| 64 | + |
| 65 | +1. **Path matcher** — compares `path` using `path.Match` (glob). `*` matches one segment, not across `/`. If the configured entry has no `path`, any request path is accepted. |
| 66 | +2. **URL matcher** — compares `scheme`, `hostname`, and `port`. Applies default ports when a scheme is present (`https` → `443`, `http` → `80`). |
| 67 | +3. **Equality matcher** — all remaining attributes (like `type`) must be exactly equal. |
| 68 | + |
| 69 | +For detailed matching examples and edge cases, see [Tutorial: Understand Credential Resolution]({{< relref "docs/tutorials/credential-resolution.md" >}}). |
| 70 | + |
| 71 | +### Examples |
| 72 | + |
| 73 | +**Hostname only** — matches all paths on `ghcr.io`: |
| 74 | + |
| 75 | +```yaml |
| 76 | +- identity: |
| 77 | + type: OCIRepository |
| 78 | + hostname: ghcr.io |
| 79 | + credentials: |
| 80 | + - type: Credentials/v1 |
| 81 | + properties: |
| 82 | + username: my-user |
| 83 | + password: ghp_token |
| 84 | +``` |
| 85 | +
|
| 86 | +**Hostname + path glob** — matches any single-segment path under `my-org/`: |
| 87 | + |
| 88 | +```yaml |
| 89 | +- identity: |
| 90 | + type: OCIRepository |
| 91 | + hostname: ghcr.io |
| 92 | + path: my-org/* |
| 93 | + credentials: |
| 94 | + - type: Credentials/v1 |
| 95 | + properties: |
| 96 | + username: org-user |
| 97 | + password: ghp_org_token |
| 98 | +``` |
| 99 | + |
| 100 | +**Hostname + scheme + port** — matches only HTTPS on a custom port: |
| 101 | + |
| 102 | +```yaml |
| 103 | +- identity: |
| 104 | + type: OCIRepository |
| 105 | + hostname: registry.internal |
| 106 | + scheme: https |
| 107 | + port: "8443" |
| 108 | + credentials: |
| 109 | + - type: Credentials/v1 |
| 110 | + properties: |
| 111 | + username: internal-user |
| 112 | + password: internal_pass |
| 113 | +``` |
| 114 | + |
| 115 | +--- |
| 116 | + |
| 117 | +## RSA/v1alpha1 |
| 118 | + |
| 119 | +Used when OCM signs or verifies component versions with RSA keys. |
| 120 | + |
| 121 | +### Identity Attributes |
| 122 | + |
| 123 | +| Attribute | Required | Description | |
| 124 | +|---|---|---| |
| 125 | +| `type` | Yes | Must be `RSA/v1alpha1` | |
| 126 | +| `algorithm` | Yes | Signing algorithm. Must be `RSASSA-PSS` (recommended) or `RSASSA-PKCS1-V1_5`. | |
| 127 | +| `signature` | Yes | Logical signature name (e.g. `default`). Must match the `--signature` flag used with `ocm sign cv`. Defaults to `default` if not specified on the CLI. | |
| 128 | + |
| 129 | +{{< callout context="caution" >}} |
| 130 | +**All three attributes are required.** When OCM looks up signing credentials, it always constructs a lookup identity with `type`, `algorithm`, and `signature`. If your consumer entry omits `algorithm`, the credential system will not find a match — even though the signing algorithm defaults to `RSASSA-PSS` internally. |
| 131 | + |
| 132 | +If you are unsure which algorithm to use, specify `algorithm: RSASSA-PSS`. |
| 133 | +{{< /callout >}} |
| 134 | + |
| 135 | +### Credential Properties |
| 136 | + |
| 137 | +| Property | Used For | Description | |
| 138 | +|---|---|---| |
| 139 | +| `private_key_pem` | Signing | Inline PEM-encoded private key | |
| 140 | +| `private_key_pem_file` | Signing | Path to PEM-encoded private key file | |
| 141 | +| `public_key_pem` | Verification | Inline PEM-encoded public key | |
| 142 | +| `public_key_pem_file` | Verification | Path to PEM-encoded public key file | |
| 143 | + |
| 144 | +You can specify both `private_key_pem_file` and `public_key_pem_file` in the same entry to use it for both signing and verification. |
| 145 | + |
| 146 | +### Matching Behavior |
| 147 | + |
| 148 | +Unlike OCI identities, RSA signing identities use **strict equality matching** — every attribute in the lookup identity must be present in the configured consumer identity with the exact same value. There is no glob or subset matching. |
| 149 | + |
| 150 | +### Examples |
| 151 | + |
| 152 | +**Signing and verification with default settings:** |
| 153 | + |
| 154 | +```yaml |
| 155 | +- identity: |
| 156 | + type: RSA/v1alpha1 |
| 157 | + algorithm: RSASSA-PSS |
| 158 | + signature: default |
| 159 | + credentials: |
| 160 | + - type: Credentials/v1 |
| 161 | + properties: |
| 162 | + private_key_pem_file: /path/to/private-key.pem |
| 163 | + public_key_pem_file: /path/to/public-key.pem |
| 164 | +``` |
| 165 | + |
| 166 | +**Multiple signature identities** (e.g. dev and prod): |
| 167 | + |
| 168 | +```yaml |
| 169 | +- identity: |
| 170 | + type: RSA/v1alpha1 |
| 171 | + algorithm: RSASSA-PSS |
| 172 | + signature: dev |
| 173 | + credentials: |
| 174 | + - type: Credentials/v1 |
| 175 | + properties: |
| 176 | + private_key_pem_file: /path/to/dev/private-key.pem |
| 177 | + public_key_pem_file: /path/to/dev/public-key.pem |
| 178 | +- identity: |
| 179 | + type: RSA/v1alpha1 |
| 180 | + algorithm: RSASSA-PSS |
| 181 | + signature: prod |
| 182 | + credentials: |
| 183 | + - type: Credentials/v1 |
| 184 | + properties: |
| 185 | + private_key_pem_file: /path/to/prod/private-key.pem |
| 186 | + public_key_pem_file: /path/to/prod/public-key.pem |
| 187 | +``` |
| 188 | + |
| 189 | +Sign with a specific identity: |
| 190 | + |
| 191 | +```bash |
| 192 | +ocm sign cv --signature dev <component-version> |
| 193 | +ocm sign cv --signature prod <component-version> |
| 194 | +``` |
| 195 | + |
| 196 | +**Using PKCS#1 v1.5 algorithm:** |
| 197 | + |
| 198 | +```yaml |
| 199 | +- identity: |
| 200 | + type: RSA/v1alpha1 |
| 201 | + algorithm: RSASSA-PKCS1-V1_5 |
| 202 | + signature: legacy |
| 203 | + credentials: |
| 204 | + - type: Credentials/v1 |
| 205 | + properties: |
| 206 | + private_key_pem_file: /path/to/private-key.pem |
| 207 | +``` |
| 208 | + |
| 209 | +--- |
| 210 | + |
| 211 | +## Complete Configuration Example |
| 212 | + |
| 213 | +A single `.ocmconfig` combining registry credentials (with Docker fallback) and signing credentials: |
| 214 | + |
| 215 | +```yaml |
| 216 | +type: generic.config.ocm.software/v1 |
| 217 | +configurations: |
| 218 | + - type: credentials.config.ocm.software |
| 219 | + consumers: |
| 220 | + # OCI registry — hostname catch-all |
| 221 | + - identity: |
| 222 | + type: OCIRepository |
| 223 | + hostname: ghcr.io |
| 224 | + credentials: |
| 225 | + - type: Credentials/v1 |
| 226 | + properties: |
| 227 | + username: my-user |
| 228 | + password: ghp_token |
| 229 | + # RSA signing — default signature |
| 230 | + - identity: |
| 231 | + type: RSA/v1alpha1 |
| 232 | + algorithm: RSASSA-PSS |
| 233 | + signature: default |
| 234 | + credentials: |
| 235 | + - type: Credentials/v1 |
| 236 | + properties: |
| 237 | + private_key_pem_file: /path/to/private-key.pem |
| 238 | + public_key_pem_file: /path/to/public-key.pem |
| 239 | + # Docker config fallback for registries not matched above |
| 240 | + repositories: |
| 241 | + - repository: |
| 242 | + type: DockerConfig/v1 |
| 243 | + dockerConfigFile: "$HOME/.docker/config.json" |
| 244 | +``` |
| 245 | + |
| 246 | +## Related Documentation |
| 247 | + |
| 248 | +- [Concept: Credential System]({{< relref "docs/concepts/credential-system.md" >}}) — How the credential system works |
| 249 | +- [Tutorial: Understand Credential Resolution]({{< relref "docs/tutorials/credential-resolution.md" >}}) — Step-by-step matching examples for OCI registries |
| 250 | +- [How-To: Configure Credentials for Multiple Registries]({{< relref "docs/how-to/configure-multiple-credentials.md" >}}) — Task-oriented registry credential setup |
| 251 | +- [How-To: Configure Credentials for Signing]({{< relref "docs/how-to/configure-signing-credentials.md" >}}) — Task-oriented signing credential setup |
0 commit comments