ibm-cloud-sdk-core
Version:
Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.
265 lines (117 loc) • 4.14 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [ibm-cloud-sdk-core](./ibm-cloud-sdk-core.md) > [IamRequestBasedTokenManager](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.md)
## IamRequestBasedTokenManager class
The IamRequestBasedTokenManager class contains code relevant to any token manager that interacts with the IAM service to manage a token. It stores information relevant to all IAM requests, such as the client ID and secret, and performs the token request with a set of request options common to any IAM token management scheme. It is intended that this class be extended with specific implementations.
**Signature:**
```typescript
export declare class IamRequestBasedTokenManager extends JwtTokenManager
```
**Extends:** [JwtTokenManager](./ibm-cloud-sdk-core.jwttokenmanager.md)
## Constructors
<table><thead><tr><th>
Constructor
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[(constructor)(options)](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager._constructor_.md)
</td><td>
</td><td>
Create a new IamRequestBasedTokenManager instance.
</td></tr>
</tbody></table>
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[clientId](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.clientid.md)
</td><td>
`protected`
</td><td>
string
</td><td>
</td></tr>
<tr><td>
[clientSecret](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.clientsecret.md)
</td><td>
`protected`
</td><td>
string
</td><td>
</td></tr>
<tr><td>
[formData](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.formdata.md)
</td><td>
`protected`
</td><td>
any
</td><td>
</td></tr>
<tr><td>
[refreshToken](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.refreshtoken.md)
</td><td>
`protected`
</td><td>
string
</td><td>
</td></tr>
<tr><td>
[scope](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.scope.md)
</td><td>
`protected`
</td><td>
string
</td><td>
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[isTokenExpired()](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.istokenexpired.md)
</td><td>
`protected`
</td><td>
Returns true iff the currently-cached IAM access token is expired. We'll consider an access token as expired when we reach its IAM server-reported expiration time minus our expiration window (10 secs). We do this to avoid using an access token that might expire in the middle of a long-running transaction within an IBM Cloud service.
</td></tr>
<tr><td>
[requestToken()](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.requesttoken.md)
</td><td>
`protected`
</td><td>
Request an IAM access token using an API key.
</td></tr>
<tr><td>
[saveTokenInfo(tokenResponse)](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.savetokeninfo.md)
</td><td>
`protected`
</td><td>
Extend this method from the parent class to extract the refresh token from the request and save it.
</td></tr>
<tr><td>
[setClientIdAndSecret(clientId, clientSecret)](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setclientidandsecret.md)
</td><td>
</td><td>
Sets the IAM "clientId" and "clientSecret" values. These values are used to compute the Authorization header used when retrieving the IAM access token. If these values are not set, no Authorization header will be set on the request (it is not required).
</td></tr>
<tr><td>
[setScope(scope)](./ibm-cloud-sdk-core.iamrequestbasedtokenmanager.setscope.md)
</td><td>
</td><td>
Sets the IAM "scope" value. This value is sent as the "scope" form parameter within the request sent to the IAM token service.
</td></tr>
</tbody></table>