You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -176,47 +177,41 @@ Examples for other configuration methods are available by following the provided
176
177
177
178
178
179
This library requires credentials to authenticate with IBM Cloudant. These credentials may be:
179
-
* IBM Cloud IAM credentials (can be used with authentication types `CONTAINER`, `VPC` and `IAM`)
180
+
* IBM Cloud IAM credentials (with authentication types `CONTAINER`, `VPC`, `IAMASSUME` and `IAM`)
180
181
*[IBM Cloud account](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-managing-access-for-cloudant#introduction-iam-ai) user, service ID or trusted profile credentials
181
-
that have been granted access to the IBM Cloud Cloudant resource instance.
182
+
that have access granted to the IBM Cloud Cloudant resource instance.
182
183
*[IBM Cloudant service credentials](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-locating-your-service-credentials) generated by the IBM Cloud Cloudant resource instance.
183
-
* Username and password credentials (can be used with authentication types `COUCHDB_SESSION` and `BASIC`)
184
+
* Username and password credentials (with authentication types `COUCHDB_SESSION` and `BASIC`)
184
185
*[IBM Cloudant service credentials](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-locating-your-service-credentials) generated for an IBM Cloud Cloudant resource instance not configured as `IAM only`.
185
-
* IBM Cloudant [legacy credentials](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-work-with-your-account#basic-authentication) (i.e. username and password) for instances not in IBM Cloud.
186
+
* IBM Cloudant [legacy credentials](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-work-with-your-account#basic-authentication) (username and password) for instances not in IBM Cloud.
186
187
* IBM Cloudant [legacy API keys](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-work-with-your-account#api-keys).
187
188
188
-
For other compatible APIs that are not Cloudant accounts (e.g. Apache CouchDB) non-IAM based authentication types
189
-
must be used.
190
-
191
-
This table summarizes the available authentication types.
192
-
The authentication types are listed in order of recommendation, preferably use the authentication type
193
-
from the first row in the table that is compatible with your environment.
194
-
195
189
| Authentication type | Recommended for |`AUTH_TYPE`| Description |
196
190
| --- | --- | --- | --- |
197
-
| IAM Trusted Profiles compute resource ([container](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#container-authentication)) | Cloudant<BR>(SDK running in IBM Cloud IKS) |`CONTAINER`| Obtains a compute resource (CR) token from the container.<BR>Exchanges the CR token for an IAM `access_token`.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
198
-
| IAM Trusted Profiles compute resource ([VPC](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#vpc-instance-authentication)) | Cloudant<BR>(SDK running in IBM Cloud VPC) |`VPC`| Obtains an identity token from the VPC instance metadata.<BR>Exchanges the identity token for an IAM `access_token`.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
199
-
|[IAM API key](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#identity-and-access-management-iam-authentication)| Cloudant |`IAM`| Exchanges an IAM API key for an IAM `access_token`.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
191
+
| IAM Trusted Profiles (compute resource [container](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#container-authentication)) | Cloudant<BR>(SDK running in IBM Cloud IKS) |`CONTAINER`| Obtains a compute resource (CR) token from the container.<BR>Exchanges the CR token for an IAM `access_token`.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
192
+
| IAM Trusted Profiles (compute resource [VPC](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#vpc-instance-authentication)) | Cloudant<BR>(SDK running in IBM Cloud VPC) |`VPC`| Obtains an identity token from the VPC instance metadata.<BR>Exchanges the identity token for an IAM `access_token`.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
193
+
| IAM Trusted Profiles ([assume identity](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#identity-and-access-management-iam-authentication-grant-type-assume)) | Cloudant |`IAMASSUME`| Exchanges an IAM API key for an IAM `access_token` (same as `IAM` auth type).<BR>Uses that initial token to obtain a second `access_token` from IAM with the assumed identity information.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
194
+
|[IAM API key](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#identity-and-access-management-iam-authentication-grant-type-apikey)| Cloudant |`IAM`| Exchanges an IAM API key for an IAM `access_token`.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
200
195
|[Session cookie](#session-cookie-authentication)|[Cloudant](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-work-with-your-account#cookie-authentication)<BR>(legacy credentials & instances without IAM)<BR><BR>[Apache CouchDB](https://docs.couchdb.org/en/stable/api/server/authn.html#cookie-authentication)|`COUCHDB_SESSION`| Exchanges credentials with `/_session` endpoint to retrieve a cookie.<BR>Adds `Cookie` header and content to each HTTP request.<BR>Automatically renews session when needed. |
201
196
|[Bearer token](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#bearer-token-authentication)|[Apache CouchDB](https://docs.couchdb.org/en/stable/api/server/authn.html#jwt-authentication)<BR>(using JWT authentication) |`BEARERTOKEN`| Adds an `Authorization: Bearer <token>` to each HTTP request.<BR>No token management or renewal.<BR>Also compatible with IAM access tokens managed independently of the SDK. |
202
197
|[Basic](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#basic-authentication)|[Apache CouchDB](https://docs.couchdb.org/en/stable/api/server/authn.html#basic-authentication)<BR>(if cookies are not enabled) |`BASIC`| Adds an `Authorization: Basic <encoded username and password>` header to each HTTP request. |
203
198
|[None](https://github.com/IBM/java-sdk-core/blob/main/Authentication.md#no-auth-authentication)| - |`NOAUTH`| Note that this authentication type only works for operations against a database allowing access for unauthenticated users. |
204
199
205
-
The default authentication type for the SDK is `CONTAINER` unless `APIKEY` configuration is supplied, which changes the default authentication type to `IAM`.
200
+
The default authentication type for the SDK is `CONTAINER` unless supplying `APIKEY` configuration, which changes the default authentication type to `IAM`.
206
201
207
202
#### Authentication with environment variables
208
203
209
-
The default service name is `CLOUDANT` so `CLOUDANT_` prefixed names are used in these examples.
204
+
The default service name is `CLOUDANT` so these examples use `CLOUDANT_` prefixed names.
210
205
211
-
Any custom service name prefix can be used as long as the matching name is used to instantiate the SDK client
212
-
and the same prefix is used for all configuration options.
206
+
Any custom service name prefix is valid, provided it matches the name used to instantiate the SDK client
207
+
and applied to all configuration options.
213
208
214
209
##### IAM API key authentication
215
210
216
211
For Cloudant *IAM API key authentication*, set the following environmental variables by
217
212
replacing the `<url>` and `<apikey>` with your proper
218
213
[service credentials](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-locating-your-service-credentials). There is no need to set
219
-
`CLOUDANT_AUTH_TYPE` to `IAM` because it is the default when an `APIKEY` is set.
214
+
`CLOUDANT_AUTH_TYPE` to `IAM` because it is the default when supplying an `APIKEY`.
220
215
221
216
```bash
222
217
CLOUDANT_URL=<url>
@@ -234,7 +229,8 @@ CLOUDANT_URL=<url>
234
229
CLOUDANT_IAM_PROFILE_ID=<id>
235
230
```
236
231
237
-
Alternatively a profile name may be used instead of an ID by replacing `CLOUDANT_IAM_PROFILE_ID` with `CLOUDANT_IAM_PROFILE_NAME`.
232
+
Alternatives to `CLOUDANT_IAM_PROFILE_ID`:
233
+
*`CLOUDANT_IAM_PROFILE_NAME`
238
234
239
235
##### IAM Trusted profile (VPC) authentication
240
236
@@ -247,7 +243,24 @@ CLOUDANT_URL=<url>
247
243
CLOUDANT_IAM_PROFILE_ID=<id>
248
244
```
249
245
250
-
Alternatively a profile CRN may be used instead of an ID by replacing `CLOUDANT_IAM_PROFILE_ID` with `CLOUDANT_IAM_PROFILE_CRN`.
246
+
Alternatives to `CLOUDANT_IAM_PROFILE_ID`:
247
+
*`CLOUDANT_IAM_PROFILE_CRN`
248
+
* No profile information (uses the default trusted profile linked to the compute resource)
249
+
250
+
##### IAM Trusted profile (assume identity) authentication
251
+
252
+
For Cloudant *IAM Trusted profile assume authentication*, set the following environmental variables by
253
+
replacing the `<url>` and `<id>` with your values.
254
+
255
+
```bash
256
+
CLOUDANT_AUTH_TYPE=IAMASSUME
257
+
CLOUDANT_URL=<url>
258
+
CLOUDANT_IAM_PROFILE_ID=<id>
259
+
```
260
+
261
+
Alternatives to `CLOUDANT_IAM_PROFILE_ID`:
262
+
*`CLOUDANT_IAM_PROFILE_CRN`
263
+
*`CLOUDANT_IAM_PROFILE_NAME`*and*`CLOUDANT_IAM_ACCOUNT_ID` (ID of the account that contains the named trusted profile)
0 commit comments