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
The python-sdk-core project supports the following types of authentication:
3
3
- Basic Authentication
4
4
- Bearer Token Authentication
5
-
- Identity and Access Management (IAM) Authentication
5
+
- Identity and Access Management (IAM) Authentication (grant type: apikey)
6
+
- Identity and Access Management (IAM) Authentication (grant type: assume)
6
7
- Container Authentication
7
8
- VPC Instance Authentication
8
9
- Cloud Pak for Data Authentication
@@ -16,7 +17,7 @@ to understand which authenticators are supported for that service.
16
17
17
18
The python-sdk-core allows an authenticator to be specified in one of two ways:
18
19
1. programmatically - the SDK user invokes the appropriate function(s) to create an instance of the
19
-
desired authenticator and then passes the authenticator instance when constructing an instance of the service.
20
+
desired authenticator and then passes the authenticator instance when constructing an instance of the service client.
20
21
2. configuration - the SDK user provides external configuration information (in the form of environment variables
21
22
or a credentials file) to indicate the type of authenticator, along with the configuration of the necessary properties for that authenticator. The SDK user then invokes the configuration-based service client constructor method to construct an instance of the authenticator and service client that reflect the external configuration information.
22
23
@@ -26,7 +27,7 @@ which will include the following:
26
27
- The properties associated with the authenticator
27
28
- An example of how to construct the authenticator programmatically
28
29
- An example of how to configure the authenticator through the use of external
29
-
configuration information. The configuration examples below will use
30
+
configuration information. The configuration examples below will use
30
31
environment variables, although the same properties could be specified in a
31
32
credentials file instead.
32
33
@@ -122,16 +123,16 @@ service = ExampleServiceV1.new_instance(service_name='example_service')
122
123
123
124
Note that the use of external configuration is not as useful with the `BearerTokenAuthenticator` as it
124
125
is for other authenticator types because bearer tokens typically need to be obtained and refreshed
125
-
programmatically since they normally have a relatively short lifespan before they expire. This
126
+
programmatically since they normally have a relatively short lifespan before they expire. This
126
127
authenticator type is intended for situations in which the application will be managing the bearer
127
128
token itself in terms of initial acquisition and refreshing as needed.
128
129
129
130
130
-
## Identity and Access Management (IAM) Authentication
131
-
The `IamAuthenticator` will accept a user-supplied api key and will perform
131
+
## Identity and Access Management (IAM) Authentication (grant type: apikey)
132
+
The `IamAuthenticator` will accept a user-supplied apikey and will perform
132
133
the necessary interactions with the IAM token service to obtain a suitable
133
-
bearer token for the specified api key. The authenticator will also obtain
134
-
a new bearer token when the current token expires. The bearer token is
134
+
bearer token for the specified apikey. The authenticator will also obtain
135
+
a new bearer token when the current token expires. The bearer token is
135
136
then added to each outbound request in the `Authorization` header in the
136
137
form:
137
138
```
@@ -140,7 +141,7 @@ form:
140
141
141
142
### Properties
142
143
143
-
- apikey: (required) the IAM api key
144
+
- apikey: (required) the IAM api key to be used to obtain an IAM access token.
144
145
145
146
- url: (optional) The base endpoint URL of the IAM token service.
146
147
The default value of this property is the "prod" IAM token service endpoint
@@ -157,7 +158,7 @@ endpoint as well (`https://iam.test.cloud.ibm.com`).
157
158
158
159
- client_id/client_secret: (optional) The `client_id` and `client_secret` fields are used to form a
159
160
"basic auth" Authorization header for interactions with the IAM token server. If neither field
160
-
is specified, then no Authorization header will be sent with token server requests. These fields
161
+
is specified, then no Authorization header will be sent with token server requests. These fields
161
162
are optional, but must be specified together.
162
163
163
164
- scope: (optional) the scope to be associated with the IAM access token.
@@ -199,6 +200,120 @@ service = ExampleServiceV1.new_instance(service_name='example_service')
199
200
```
200
201
201
202
203
+
## Identity and Access Management (IAM) Authentication (grant type: assume)
204
+
The `IAMAssumeAuthenticator` performs a two-step token fetch sequence to obtain
205
+
a bearer token that allows the application to assume the identity of a trusted profile:
206
+
1. First, the authenticator obtains an initial bearer token using grant type
207
+
`urn:ibm:params:oauth:grant-type:apikey`.
208
+
This initial token will reflect the identity associated with the input apikey.
209
+
2. Second, the authenticator uses the grant type `urn:ibm:params:oauth:grant-type:assume` to obtain a bearer token
210
+
that reflects the identity of the trusted profile, passing in the initial bearer token
211
+
from the first step, along with the trusted profile-related inputs.
212
+
213
+
The authenticator will also obtain a new bearer token when the current token expires.
214
+
The bearer token is then added to each outbound request in the `Authorization` header in the
215
+
form:
216
+
```
217
+
Authorization: Bearer <bearer-token>
218
+
```
219
+
220
+
### Properties
221
+
222
+
- apikey: (required) the IAM apikey to be used to obtain the initial IAM access token.
223
+
224
+
- iam_profile_crn: (optional) the Cloud Resource Name (CRN) associated with the trusted profile
225
+
for which an access token should be fetched.
226
+
Exactly one of iam_profile_crn, iam_profile_id or iam_profile_name must be specified.
227
+
228
+
- iam_profile_id: (optional) the ID associated with the trusted profile
229
+
for which an access token should be fetched.
230
+
Exactly one of iam_profile_crn, iam_profile_id or iam_profile_name must be specified.
231
+
232
+
- iam_profile_name: (optional) the name associated with the trusted profile
233
+
for which an access token should be fetched. When specifying this property, you must also
234
+
specify the iam_account_id property as well.
235
+
Exactly one of iam_profile_crn, iam_profile_id or iam_profile_name must be specified.
236
+
237
+
- iam_account_id: (optional) the ID associated with the IAM account that contains the trusted profile
238
+
referenced by the iam_profile_name property. The imaAccountId property must be specified if and only if
239
+
the iam_profile_name property is specified.
240
+
241
+
- url: (optional) The base endpoint URL of the IAM token service.
242
+
The default value of this property is the "prod" IAM token service endpoint
243
+
(`https://iam.cloud.ibm.com`).
244
+
Make sure that you use an IAM token service endpoint that is appropriate for the
245
+
location of the service being used by your application.
246
+
For example, if you are using an instance of a service in the "production" environment
0 commit comments