Skip to content

Commit 61f2913

Browse files
committed
docs: update README.md and Authentication.md
1 parent c253261 commit 61f2913

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

Authentication.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ The python-sdk-core project supports the following types of authentication:
44
- Bearer Token
55
- Identity and Access Management (IAM)
66
- Cloud Pak for Data
7+
- Container
78
- No Authentication
89

910
The SDK user configures the appropriate type of authentication for use with service instances.
@@ -202,6 +203,47 @@ authenticator = get_authenticator_from_environment('example_service')
202203
service = ExampleService(authenticator=authenticator)
203204
```
204205

206+
## Container
207+
The `ContainerAuthenticator` will read a compute resource token from the file system (typically, a container running on a system like IKS) and will perform the necessary interactions with the IAM token service to obtain a suitable bearer token for the compute resource. The authenticator will also obtain a new bearer token when the current token expires. The bearer token is then added to each outbound request in the `Authorization` header in the form:
208+
209+
```
210+
Authorization: Bearer <bearer-token>
211+
```
212+
213+
### Properties
214+
- cr_token_filename: (optional) The name of the file containing the injected CR token value. If not specified, then `/var/run/secrets/tokens/vault-token` is used as the default value. The application must have `read` permissions on the file containing the CR token value.
215+
- iam_profile_name: (optional) The name of the linked trusted IAM profile to be used when obtaining the IAM access token (a CR token might map to multiple IAM profiles). One of `iam_profile_name` or `iam_profile_id` must be specified.
216+
- iam_profile_id: (optional) The ID of the linked trusted IAM profile to be used when obtaining the IAM access token (a CR token might map to multiple IAM profiles). One of `iam_profile_name` or `iam_profile_id` must be specified.
217+
- url: (optional) The URL representing the IAM token service endpoint. If not specified, a suitable default value is used.
218+
- client_id/client_secret: (optional) The `client_id` and `client_secret` fields are used to form a "basic auth" Authorization header for interactions with the IAM token server. If neither field is specified, then no Authorization header will be sent with token server requests. These fields are optional, but must be specified together.
219+
- disable_ssl_verification: (optional) A flag that indicates whether verificaton of the server's SSL certificate should be disabled or not. The default value is `False`.
220+
- scope (optional): the scope to be associated with the IAM access token.
221+
If not specified, then no scope will be associated with the access token.
222+
- proxies (optional): The proxy endpoint to use for HTTP(S) requests.
223+
- headers: (optional) A set of key/value pairs that will be sent as HTTP headers in requests made to the IAM token service.
224+
225+
### Programming example
226+
```python
227+
from ibm_cloud_sdk_core.authenticators import ContainerAuthenticatior
228+
229+
authenticator = ContainerAuthenticator(iam_profile_name='iam-user-123')
230+
service = ExampleService(authenticator=authenticator)
231+
```
232+
233+
### Configuration example
234+
External configuration:
235+
```
236+
export EXAMPLE_SERVICE_AUTH_TYPE=container
237+
export EXAMPLE_SERVICE_IAM_PROFILE_NAME=iam-user-123
238+
```
239+
Application code:
240+
```python
241+
from ibm_cloud_sdk_core import get_authenticator_from_environment
242+
243+
authenticator = get_authenticator_from_environment('example_service')
244+
service = ExampleService(authenticator=authenticator)
245+
```
246+
205247
## No Auth Authentication
206248
The `NoAuthAuthenticator` is a placeholder authenticator which performs no actual authentication function. It can be used in situations where authentication needs to be bypassed, perhaps while developing or debugging an application or service.
207249
### Properties

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The python-sdk-core project supports the following types of authentication:
3131
- Bearer Token
3232
- Identity and Access Management (IAM)
3333
- Cloud Pak for Data
34+
- Container
3435
- No Authentication
3536

3637
For more information about the various authentication types and how to use them with your services, click [here](Authentication.md)

0 commit comments

Comments
 (0)