# CredentialProvider

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> A credential provider tells Ringleader where to get a short-lived token for a service, such as GitHub, Anthropic or an MCP server.


A **credential provider** tells Ringleader where to get a short-lived token for a service. You
name it in an [Integration](https://docs-stg.ringleader.dev/reference/resources/integration/) where you would otherwise
name a Secret. [Credential providers](https://docs-stg.ringleader.dev/security/credentials/credential-providers/)
explains what a provider does and why to use one. Two guides show how to set one up:
[Connect workstations to GitHub with the Ringleader GitHub App](https://docs-stg.ringleader.dev/guides/connect-github-app/)
and
[Connect an MCP server with each person's own account](https://docs-stg.ringleader.dev/guides/connect-mcp-server/).
This page lists the fields and flags.

```text
apiVersion: core.ringleader.dev/v1
kind: CredentialProvider | OrgCredentialProvider | GlobalCredentialProvider
```

## The credential source

`credentialSource` is the block in an Integration that names a provider. It takes the place of
`credentialRef`, and a slot that names both is refused. These slots take it:

| Slot | What it adds |
|---|---|
| `httpProxy`, with `vendor: github` | The GitHub token, on the hosts the GitHub preset covers. |
| `mcp`, in `injected` mode | The token. From an [`mcpServer`](#mcpserver) provider, it is added as `Authorization: Bearer`, and you can leave out `inject`. From any other provider, it is the whole value of the header `inject.header` names. Leave out `inject.value` either way. |
| `llm.providers.anthropic`, with `llm.endpoint.source: ringleader` | An Anthropic token. See [Anthropic federation](https://docs-stg.ringleader.dev/security/credentials/credential-providers/#anthropic-federation). |

`llm.endpoint` and `mcp` in `local` mode refuse it, because their credential is delivered to the
workstation.

### Credential source fields

| Field | Description |
|---|---|
| `provider.kind` | **Required.** `CredentialProvider`, `OrgCredentialProvider` or `GlobalCredentialProvider`. |
| `provider.name` | **Required.** The provider's name. A `CredentialProvider` must be in the Integration's own namespace, and an `OrgCredentialProvider` must belong to that namespace's organization. |
| `userAuthorization` | Only `boxOwner`: use the token of each workstation's owner. It needs a `GlobalCredentialProvider` or `OrgCredentialProvider`, and is refused beside `repositories` or `permissions`. For GitHub, name `GlobalCredentialProvider/github`, the provider people connect to. An `mcpServer` provider requires this field. |
| `repositories` | Up to 500 repositories, each `owner/name`, with no repeats. All must have the same owner, because one token reaches one GitHub account. |
| `permissions` | Up to 32 entries, each a GitHub permission name with `read`, `write` or `admin`. A name GitHub does not use for an app's token is refused. |

When you leave out `repositories`, the token reaches every repository the installation grants,
which is the set the owner picked when installing. The provider must then hold exactly one
installation, because Ringleader matches the repositories' owner to an installation's account.
Where a policy limits git repositories, you cannot leave the list out, as
[Repositories a GitHub token may reach](https://docs-stg.ringleader.dev/reference/resources/policy/#repositories-a-github-token-may-reach) describes, with an example of each refusal.

When you leave out `permissions`, the token gets `contents: write`, `pull_requests: write` and
`metadata: read`. A level the installation was not granted gets no token, and Ringleader never
falls back to a lower one. The shared app asks for these permissions when it is installed:

| Permission | Level |
|---|---|
| `metadata` | `read` |
| `contents` | `write` |
| `pull_requests` | `write` |
| `issues` | `write` |
| `checks` | `read` |
| `actions` | `read` |
| `members` | `read` |

Leaving a list out and writing it empty are different. `repositories: []` or `permissions: {}`
asks for a token that reaches nothing, so no token is issued.

### Use right on a provider

The person who applies the Integration needs the `use` right on the provider it names. Ringleader
checks that right when you apply the Integration and again whenever it gets a token. If the
author loses it, the token stops being added.

These people have `use` without asking:

- Every signed-in person, on the built-in `GlobalCredentialProvider` named `github`.
- An org admin, on the organization's `OrgCredentialProvider` objects.
- A namespace admin, on the namespace's `CredentialProvider` objects.

Anyone else needs a [Grant](https://docs-stg.ringleader.dev/reference/resources/grant/) in the Integration's
namespace, written by someone who holds `use` on the provider. For example, an org admin lets a
namespace admin name the organization's provider from the namespace `acme`:

```yaml
apiVersion: core.ringleader.dev/v1
kind: Grant
metadata:
  name: acme-github-use
  namespace: acme
spec:
  target:
    kind: OrgCredentialProvider
    matchName: acme-github
  subjects:
    - user:dana@acme.com
  rights:
    - use
```

A `use` Grant applies to the provider it was written for. If the provider is deleted and created
again under the same name, write the Grant again.

A token that acts as the app reaches the repositories the installation and the Integration allow.
Ringleader does not check whether the Integration's author can reach those repositories on GitHub:
`use` on the provider is the permission.

## The three provider kinds

The three kinds differ in who writes them and which namespaces can use them:

| Kind | Where it lives | Who creates it | Typical use |
|---|---|---|---|
| `CredentialProvider` | One namespace | A namespace admin | One team's own setup, such as an install of the app on a personal GitHub account. It cannot hold people's own connections, so `userAuthorization` cannot name it. |
| `OrgCredentialProvider` | One organization, named by `spec.org`. Its name starts with the organization's name and a hyphen. | An org admin | The organization's installations of the app, an organization-wide Anthropic rule, or an MCP server people connect to. |
| `GlobalCredentialProvider` | The whole Ringleader deployment | A global admin | The shared GitHub App, as the built-in provider `github`. |

When your Ringleader deployment has the GitHub App set up, Ringleader creates the
`GlobalCredentialProvider` named `github` itself, and restores it if someone deletes or edits it.

Each provider's `spec` holds exactly one vendor block, such as `githubApp`, `anthropicFederation` or
`mcpServer`.

### `githubApp`

```yaml
apiVersion: core.ringleader.dev/v1
kind: OrgCredentialProvider
metadata:
  name: acme-github
spec:
  org: acme
  githubApp:
    from:
      kind: GlobalCredentialProvider
      name: github
```

The block takes exactly one of these:

| Field | Description |
|---|---|
| `builtIn: true` | This provider is the shared app. Accepted only on a `GlobalCredentialProvider`. |
| `from: {kind, name}` | This provider uses the shared app. `from` accepts only `GlobalCredentialProvider/github`, which is what the install command writes. A provider with an app of its own sets `appId` instead. |
| `appId` | An app of your own, with optional `clientId` and `baseURL`. |

The fields for an app of your own, such as one on GitHub Enterprise Server, are not usable yet. Its
key fields, `privateKeyRef` and `clientSecretRef`, are refused when you apply the provider. Use the
shared app.

`status.installations` lists the installations linked to the provider, each with its `id` and
GitHub `account`. Only the install flow writes it.

### `anthropicFederation`

```yaml
apiVersion: core.ringleader.dev/v1
kind: OrgCredentialProvider
metadata:
  name: acme-anthropic
spec:
  org: acme
  anthropicFederation:
    organizationId: 00000000-0000-0000-0000-000000000000
    serviceAccountId: svac_example
    federationRuleId: fdrl_example
    workspaceId: wrkspc_example
    subject: org
```

| Field | Description |
|---|---|
| `organizationId` | **Required.** Your Anthropic organization's ID. |
| `serviceAccountId` | **Required.** The Anthropic service account the token acts as, `svac_...`. |
| `federationRuleId` | **Required.** The Anthropic federation rule to evaluate, `fdrl_...`. |
| `workspaceId` | The Anthropic workspace to scope the token to, `wrkspc_...`. |
| `subject` | `org` (the default) or `namespace`. See [Signed statement claims](https://docs-stg.ringleader.dev/security/credentials/credential-providers/#signed-statement-claims). |

Each ID is letters, digits, `.`, `_` and `-`, at most 128 characters.

### `mcpServer`

```yaml
apiVersion: core.ringleader.dev/v1
kind: OrgCredentialProvider
metadata:
  name: acme-linear
spec:
  org: acme
  mcpServer:
    url: https://mcp.linear.app/mcp
    scopes: [read]
```

The block names a remote MCP server that signs people in with OAuth. It is accepted on an
`OrgCredentialProvider` and a `GlobalCredentialProvider`. An Integration uses the provider in its `mcp`
block, with the same `url` and `userAuthorization: boxOwner`.

| Field | Description |
|---|---|
| `url` | **Required.** The server's `https://` address. It names a public server by a DNS name in ASCII, not by an IP address, and holds no user name, query or fragment. Any port but 80 and 53 is accepted. |
| `scopes` | The OAuth scopes to ask for. Left out, Ringleader asks for the ones the server names. A change applies only to connections made after it, so a person who is already connected keeps the scopes they approved until they connect again. |
| `clientId` | The client ID of an OAuth app you registered with the server. Left out, Ringleader identifies itself to the server, with a client ID metadata document or by dynamic registration. `OrgCredentialProvider` only. |
| `clientSecretRef` | The Secret `{namespace, name, key}` that holds that app's client secret. Create it with `--ringleader-only`, as [Ringleader-only Secrets](https://docs-stg.ringleader.dev/security/credentials/secret-handling/#ringleader-only-secrets) explains. It needs `clientId`. `OrgCredentialProvider` only. |

Reading one provider with `rl orgcredentialprovider get <name> -o yaml` shows two addresses:

| Field | Description |
|---|---|
| `status.oauthCallbackURL` | The redirect URL to register with an OAuth app of your own. Each provider has its own. |
| `status.clientMetadataURL` | The address of the client ID metadata document. Absent when the provider sets `clientId`. |

After you change `url` or `clientId`, or add or remove `clientSecretRef`, everyone who was connected has
to connect again. After you change `url`, also change `mcp.url` in each Integration that names the
provider, because the two must match.

## Install flags

These flags apply to `rl orgcredentialprovider install` and `rl credentialprovider install`.

| Flag | Description |
|---|---|
| `--org <org>` | The organization that owns the provider. Needed only when the provider does not exist yet. `rl orgcredentialprovider install` only. |
| `-n, --namespace <ns>` | Target namespace. `rl credentialprovider install` only. |
| `--no-open` | Print the link and do not open a browser. |
| `-o, --output <format>` | `text` (default) or `json`. With `json`, the command writes one JSON object per line: a `url` event with the link, then one event saying how the install ended, such as `linked`, `refused`, `expired` or `timeout`. |
| `--home <dir>` | Data directory. |
| `--as <subject>` | Impersonate a subject. |

## Connect flags

These flags apply to `rl userauthorization connect`.

| Flag | Description |
|---|---|
| `--service-account <namespace>/<name>` | Connect for this service account instead of for you. |
| `--no-browser` | Print the address instead of opening it. |
| `--require-login` | Refuse to connect while you are signed out. |
| `-o, --output <format>` | `text` (default) or `json`. With `json`, the command writes one JSON object per line: a `device_code` event with the code and address, or an `authorization_url` event with the address for an MCP server. Then it writes `success`, `denied`, `expired` or `error`. |
| `--home <dir>` | Data directory. |
| `--as <subject>` | Impersonate a subject. |

## Next steps
- [Credential providers](https://docs-stg.ringleader.dev/security/credentials/credential-providers/): what a provider does, Anthropic federation, and what a GitHub organization can block.
- [Connect an MCP server with each person's own account](https://docs-stg.ringleader.dev/guides/connect-mcp-server/): create a provider for an MCP server, connect an account, and fix a workstation that gets no token.
- [Connect workstations to GitHub with the Ringleader GitHub App](https://docs-stg.ringleader.dev/guides/connect-github-app/): install the app, connect an account, and fix a workstation that gets no token.
- [Integration](https://docs-stg.ringleader.dev/reference/resources/integration/): the kind that names a provider.
- [Injected credentials](https://docs-stg.ringleader.dev/security/credentials/injected-credentials/): where a token is added, and the same flow with a key in a Secret.
- [Edge](https://docs-stg.ringleader.dev/reference/resources/edge/): the VM that adds the token for cloud workstations.
- [Grant](https://docs-stg.ringleader.dev/reference/resources/grant/): Grants and the seeded roles.

