Skip to content

Commit ae43a39

Browse files
committed
add reference for consumer identities and link it from the other docs.
On-behalf-of: Gerald Morrison (SAP) <gerald.morrison@sap.com> Signed-off-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
1 parent 5b1ff09 commit ae43a39

File tree

6 files changed

+268
-4
lines changed

6 files changed

+268
-4
lines changed

content/docs/concepts/credential-system.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,7 @@ To see resolution in action, try the [Understand Credential Resolution]({{< relr
9191
- [Tutorial: Credential Resolution]({{< relref "/docs/tutorials/credential-resolution.md" >}}) — Learn how OCM picks the right credentials by experimenting with a config
9292
- [How-To: Configure Credentials for Multiple Registries]({{< relref "/docs/how-to/configure-multiple-credentials.md" >}}) — Quick task-oriented setup
9393
- [Tutorial: Credentials for OCM Controllers]({{< relref "/docs/tutorials/configure-credentials-for-controllers.md" >}}) — How to provide credentials in Kubernetes environments
94+
95+
## Related Documentation
96+
97+
- [Reference: Consumer Identities]({{< relref "/docs/reference/credential-consumer-identities.md" >}}) — Complete list of identity types, attributes, and credential properties

content/docs/how-to/configure-signing-credentials.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ Copy the following YAML into your `.ocmconfig` file.
4444
We use the key pair you created in the [How-To: Generate Signing Keys]({{< relref "generate-signing-keys.md" >}}).
4545
If you already have a key pair that is located in a different location, simply update the file paths accordingly.
4646

47+
All three identity attributes (`type`, `algorithm`, `signature`) are required for credential matching.
48+
See the [Consumer Identities Reference]({{< relref "docs/reference/credential-consumer-identities.md" >}}) for details.
49+
4750
```yaml
4851
type: generic.config.ocm.software/v1
4952
configurations:
@@ -111,6 +114,7 @@ configurations:
111114
consumers:
112115
- identity:
113116
type: RSA/v1alpha1
117+
algorithm: RSASSA-PSS
114118
signature: dev
115119
credentials:
116120
- type: Credentials/v1
@@ -119,6 +123,7 @@ configurations:
119123
public_key_pem_file: /tmp/keys/dev/public-key.pem
120124
- identity:
121125
type: RSA/v1alpha1
126+
algorithm: RSASSA-PSS
122127
signature: prod
123128
credentials:
124129
- type: Credentials/v1
@@ -141,8 +146,8 @@ The consumer identity for RSA signing/verification supports these attributes:
141146
| Attribute | Required | Description |
142147
|-------------|----------|-----------------------------------------------------|
143148
| `type` | Yes | Must be `RSA/v1alpha1` |
144-
| `algorithm` | No | `RSASSA-PSS` (default) or `RSASSA-PKCS1V15` |
145-
| `signature` | No | Name for this key configuration (default: `default`)|
149+
| `algorithm` | Yes | `RSASSA-PSS` (default) or `RSASSA-PKCS1-V1_5`. Required for credential matching — the lookup always includes this field. |
150+
| `signature` | Yes | Logical name for this key configuration (default: `default`). Must match the `--signature` CLI flag. |
146151

147152
## Troubleshooting
148153

@@ -153,6 +158,7 @@ The consumer identity for RSA signing/verification supports these attributes:
153158
**Fix:** Ensure:
154159

155160
- The file path `private_key_pem_file` is correct and the file exists
161+
- The `algorithm` attribute is present in the identity (e.g. `algorithm: RSASSA-PSS`). See [Consumer Identities Reference]({{< relref "docs/reference/credential-consumer-identities.md" >}}).
156162
- The `signature` name matches what you're using (or is `default` if not specified)
157163
- The file is valid YAML with correct indentation
158164

content/docs/reference/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Reference
33
description: "Browse reference documentation for the OCM CLI and OCM controllers."
44
icon: "💾"
5-
weight:
5+
weight: 60
66
toc: true
77
sidebar:
88
collapsed: true
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
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

content/docs/reference/resolver-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Resolver Configuration"
33
description: "Complete reference for OCM resolver configuration: schema, repository types, and component name patterns."
44
icon: "🔍"
5-
weight: 10
5+
weight: 1
66
toc: true
77
---
88

content/docs/tutorials/credential-resolution.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ toc: true
1010

1111
Every time OCM accesses a registry, it resolves credentials automatically. This tutorial walks you through how that resolution works — given a config, which credentials does OCM pick for each request, and why?
1212

13+
This tutorial focuses on OCI registry credentials. For signing credential identities (`RSA/v1alpha1`), see the [Consumer Identities Reference]({{< relref "/docs/reference/credential-consumer-identities.md" >}}).
14+
1315
For the full concept, see [Credential System]({{< relref "/docs/concepts/credential-system.md" >}}).
1416

1517
**Estimated time:** ~10 minutes
@@ -350,3 +352,4 @@ Then retry the OCM command.
350352
## Related Documentation
351353

352354
- [Concept: Credential System]({{< relref "/docs/concepts/credential-system.md" >}}) - Learn how the credential system automatically finds the right credentials for each operation
355+
- [Reference: Consumer Identities]({{< relref "/docs/reference/credential-consumer-identities.md" >}}) — Complete reference for all identity types (OCI registries and RSA signing)

0 commit comments

Comments
 (0)