2021-06-25 15:31:10 -04:00
---
layout: docs
2024-12-04 11:01:09 -05:00
page_title: Credential resource
description: >-
Learn about using the credential resource to define secrets for a host. Understand username password, SSH private key, SSH certificate, and JSON credential types.
2021-06-25 15:31:10 -04:00
---
2025-11-04 10:22:10 -05:00
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
> [!IMPORTANT]
> **Documentation Update:** Product documentation previously located in `/website` has moved to the [`hashicorp/web-unified-docs`](https://github.com/hashicorp/web-unified-docs) repository, where all product documentation is now centralized. Please make contributions directly to `web-unified-docs`, since changes to `/website` in this repository will not appear on developer.hashicorp.com.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
2021-06-25 15:31:10 -04:00
# Credentials
2023-02-03 16:25:08 -05:00
A credential is a data structure containing one or more secrets that binds an identity to a set of permissions or capabilities on a [host][] for a [session][].
2021-06-25 15:31:10 -04:00
2023-02-03 16:25:08 -05:00
Optionally, credentials can be typed to indicate compliance with a specific format.
The following credential types are supported in Boundary:
2022-06-22 00:37:49 -06:00
2023-02-03 16:25:08 -05:00
- [Username password](#username-password)
2025-09-25 11:01:23 -04:00
- [Username password domain](#username-password-domain)
2023-02-03 16:25:08 -05:00
- [SSH private key](#ssh-private-key)
- [SSH certificate](#ssh-certificate)
- [JSON](#json)
2022-06-22 00:37:49 -06:00
2025-09-03 15:45:38 -04:00
## Username password
2022-06-22 00:37:49 -06:00
2022-07-25 10:12:10 -07:00
`username_password` credentials contain the following fields:
- `username` - The username field associated with the credential.
- `password` - The password field associated with the credential.
2025-09-25 11:01:23 -04:00
## Username password domain
`username_password_domain` credentials contain the following fields:
- `username` - The username field associated with the credential.
- `password` - The password field associated with the credential.
- `domain` - The domain field associated with the credential.
2025-09-03 15:45:38 -04:00
## SSH private key
2022-07-25 10:12:10 -07:00
`ssh_private_key` credentials contain the following fields:
- `username` - The username field associated with the credential.
- `private_key` - The private key field associated with the credential.
2022-06-22 00:37:49 -06:00
2025-09-03 15:45:38 -04:00
## SSH certificate
2023-02-03 16:25:08 -05:00
`ssh_certificate` credentials contain the following fields:
- `username` - The username field associated with the credential.
- `ssh_certificate` - The SSH certificate associated with the credential.
2025-09-03 15:45:38 -04:00
## JSON
2023-02-03 16:25:08 -05:00
2025-09-03 15:45:38 -04:00
You can provide credentials using a JSON blob.
2023-02-03 16:25:08 -05:00
JSON credentials are only brokered to users that connect to machines.
2023-02-06 12:37:38 -05:00
There is no required structure for the JSON blob, other than it must be a key value map.
Refer to the example below:
<CodeBlockConfig heading="JSON credentials blob example">
```JSON
{
"type": "service_account",
"project_id": "",
"private_key_id": "",
"private_key": "-----BEGIN PRIVATE KEY----------END PRIVATE KEY-----\n",
"client_email": "",
"client_id": "",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": ""
}
```
</CodeBlockConfig>
2023-02-03 16:25:08 -05:00
## Referenced by
2021-06-25 15:31:10 -04:00
2025-09-03 15:45:38 -04:00
- [Credential store][]
- [Credential library][]
2021-06-25 15:31:10 -04:00
- [Session][]
2023-01-10 13:43:22 -05:00
- [Target][]
2021-06-25 15:31:10 -04:00
2025-09-03 15:45:38 -04:00
[credential library]: /boundary/docs/domain-model/credential-libraries
[credential libraries]: /boundary/docs/domain-model/credential-libraries
[credential store]: /boundary/docs/domain-model/credential-stores
[credential stores]: /boundary/docs/domain-model/credential-stores
[host]: /boundary/docs/domain-model/hosts
[session]: /boundary/docs/domain-model/sessions
[target]: /boundary/docs/domain-model/targets