feat: 添加多项功能和修复
功能新增: - OSS 存储使用情况显示(文件页面) - OSS 当日流量统计(阿里云云监控API) - 分享页面路由修复(/s/xxx 格式支持) Bug修复: - 修复分享页面资源路径(相对路径改绝对路径) - 修复分享码获取逻辑(支持路径格式) - 修复OSS配额undefined显示问题 - 修复登录流程OSS配置检查 - 修复文件数为null时的显示问题 依赖更新: - 添加 @alicloud/cms20190101 云监控SDK - 添加 @alicloud/openapi-client Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
21
backend/node_modules/@alicloud/credentials/LICENSE
generated
vendored
Normal file
21
backend/node_modules/@alicloud/credentials/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
258
backend/node_modules/@alicloud/credentials/README.md
generated
vendored
Normal file
258
backend/node_modules/@alicloud/credentials/README.md
generated
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
English | [简体中文](README-CN.md)
|
||||
|
||||
# Alibaba Cloud Credentials for TypeScript/Node.js
|
||||
|
||||
[](https://www.npmjs.com/package/@alicloud/credentials)
|
||||
[](https://github.com/aliyun/credentials-nodejs/actions/workflows/ci.yml)
|
||||
[](https://codecov.io/gh/aliyun/credentials-nodejs)
|
||||
[](LICENSE)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @alicloud/credentials
|
||||
```
|
||||
|
||||
**Node.js >= 12** required.
|
||||
|
||||
## Quick Examples
|
||||
|
||||
Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your [Credentials](https://usercenter.console.aliyun.com/#/manage/ak).
|
||||
|
||||
### Credential Type
|
||||
|
||||
#### access_key
|
||||
|
||||
Setup access_key credential through [User Information Management][ak], it have full authority over the account, please keep it safe. Sometimes for security reasons, you cannot hand over a primary account AccessKey with full access to the developer of a project. You may create a sub-account [RAM Sub-account][ram] , grant its [authorization][permissions],and use the AccessKey of RAM Sub-account.
|
||||
|
||||
```ts
|
||||
import Credential, { Config } from '@alicloud/credentials';
|
||||
|
||||
const config: Config = {
|
||||
type: 'access_key', // credential type
|
||||
accessKeyId: 'accessKeyId', // AccessKeyId of your account
|
||||
accessKeySecret: 'accessKeySecret', // AccessKeySecret of your account
|
||||
}
|
||||
const cred = new Credential(config);
|
||||
const {
|
||||
accessKeyId,
|
||||
accessKeySecret,
|
||||
type
|
||||
} = await cred.getCredential();
|
||||
```
|
||||
|
||||
#### sts
|
||||
|
||||
Create a temporary security credential by applying Temporary Security Credentials (TSC) through the Security Token Service (STS).
|
||||
|
||||
```ts
|
||||
import Credential, { Config } from '@alicloud/credentials';
|
||||
|
||||
const config: Config = {
|
||||
type: 'sts', // credential type
|
||||
accessKeyId: 'accessKeyId', // AccessKeyId of your account
|
||||
accessKeySecret: 'accessKeySecret', // AccessKeySecret of your account
|
||||
securityToken: 'securityToken', // Temporary Security Token
|
||||
}
|
||||
const cred = new Credential(config);
|
||||
const {
|
||||
accessKeyId,
|
||||
accessKeySecret,
|
||||
securityToken,
|
||||
type
|
||||
} = await cred.getCredential();
|
||||
```
|
||||
|
||||
#### ram_role_arn
|
||||
|
||||
By specifying [RAM Role][RAM Role], the credential will be able to automatically request maintenance of STS Token. If you want to limit the permissions([How to make a policy][policy]) of STS Token, you can assign value for `Policy`.
|
||||
|
||||
```ts
|
||||
import Credential, { Config } from '@alicloud/credentials';
|
||||
|
||||
const config: Config = {
|
||||
type: 'ram_role_arn', // credential type
|
||||
accessKeyId: 'accessKeyId', // AccessKeyId of your account
|
||||
accessKeySecret: 'accessKeySecret', // AccessKeySecret of your account
|
||||
roleArn: 'roleArn', // Format: acs:ram::USER_ID:role/ROLE_NAME
|
||||
roleSessionName: 'roleSessionName', // Role Session Name
|
||||
policy: 'policy', // Not required, limit the permissions of STS Token
|
||||
roleSessionExpiration: 3600, // Not required, limit the Valid time of STS Token
|
||||
}
|
||||
const cred = new Credential(config);
|
||||
const {
|
||||
accessKeyId,
|
||||
accessKeySecret,
|
||||
securityToken,
|
||||
type
|
||||
} = await cred.getCredential();
|
||||
```
|
||||
|
||||
#### oidc_role_arn
|
||||
|
||||
By specifying [OIDC Role][OIDC Role], the credential will be able to automatically request maintenance of STS Token. If you want to limit the permissions([How to make a policy][policy]) of STS Token, you can assign value for `Policy`.
|
||||
|
||||
```ts
|
||||
import Credential, { Config } from '@alicloud/credentials';
|
||||
|
||||
const config: Config = {
|
||||
type: 'oidc_role_arn', // credential type
|
||||
roleArn: 'roleArn', // Format: acs:ram::USER_Id:role/ROLE_NAME roleArn can be replaced by setting environment variable: ALIBABA_CLOUD_ROLE_ARN
|
||||
oidcProviderArn: 'oidcProviderArn', // Format: acs:ram::USER_Id:oidc-provider/ROLE_NAME oidcProviderArn can be replaced by setting environment variable: ALIBABA_CLOUD_OIDC_PROVIDER_ARN
|
||||
oidcTokenFilePath: '/Users/xxx/xxx', // Format: path OIDCTokenFilePath can be replaced by setting environment variable: ALIBABA_CLOUD_OIDC_TOKEN_FILE
|
||||
roleSessionName: 'roleSessionName', // Role Session Name
|
||||
policy: 'policy', // Not required, limit the permissions of STS Token
|
||||
roleSessionExpiration: 3600, // Not required, limit the Valid time of STS Token
|
||||
}
|
||||
const cred = new Credential(config);
|
||||
const {
|
||||
accessKeyId,
|
||||
accessKeySecret,
|
||||
securityToken,
|
||||
type
|
||||
} = await cred.getCredential();
|
||||
```
|
||||
|
||||
#### ecs_ram_role
|
||||
|
||||
By specifying the role name, the credential will be able to automatically request maintenance of STS Token.
|
||||
|
||||
```ts
|
||||
import Credential, { Config } from '@alicloud/credentials';
|
||||
const config: Config = {
|
||||
type: 'ecs_ram_role', // credential type
|
||||
roleName: 'roleName', // `roleName` is optional. It will be retrieved automatically if not set. It is highly recommended to set it up to reduce requests.
|
||||
disableIMDSv1: true, // `disableIMDSv1` is optional and is recommended to be turned on. It can be replaced by setting environment variable: ALIBABA_CLOUD_IMDSV1_DISABLED
|
||||
}
|
||||
const cred = new Credential(config);
|
||||
const {
|
||||
accessKeyId,
|
||||
accessKeySecret,
|
||||
securityToken,
|
||||
type
|
||||
} = await cred.getCredential();
|
||||
```
|
||||
|
||||
#### rsa_key_pair
|
||||
|
||||
By specifying the public key ID and the private key file, the credential will be able to automatically request maintenance of the AccessKey before sending the request. Only Japan station is supported.
|
||||
|
||||
```ts
|
||||
import Credential, { Config } from '@alicloud/credentials';
|
||||
const config: Config = {
|
||||
type: 'rsa_key_pair', // credential type
|
||||
privateKeyFile: 'privateKeyFile', // The file path to store the PrivateKey
|
||||
publicKeyId: 'publicKeyId', // PublicKeyId of your account
|
||||
}
|
||||
const cred = new Credential(config);
|
||||
const {
|
||||
accessKeyId,
|
||||
accessKeySecret,
|
||||
securityToken,
|
||||
type
|
||||
} = await cred.getCredential();
|
||||
```
|
||||
|
||||
#### credentials_uri
|
||||
|
||||
By specifying a local or remote URI to get credentials and refresh automanticly.
|
||||
|
||||
```ts
|
||||
import Credential, { Config } from '@alicloud/credentials';
|
||||
const config: Config = {
|
||||
type: 'credentials_uri',
|
||||
credentialsURI: 'http://a_local_or_remote_address/' //credentialsURI can be replaced by setting environment variable: ALIBABA_CLOUD_CREDENTIALS_URI
|
||||
};
|
||||
const cred = new Credential(config);
|
||||
const {
|
||||
accessKeyId,
|
||||
accessKeySecret,
|
||||
securityToken,
|
||||
type
|
||||
} = await cred.getCredential();
|
||||
```
|
||||
|
||||
The URI must reponse meets following conditions:
|
||||
|
||||
- response status code is 200
|
||||
- response body struct must be:
|
||||
|
||||
```json
|
||||
{
|
||||
"Code": "Success",
|
||||
"AccessKeySecret": "AccessKeySecret",
|
||||
"AccessKeyId": "AccessKeyId",
|
||||
"Expiration": "2021-09-26T03:46:38Z",
|
||||
"SecurityToken": "SecurityToken"
|
||||
}
|
||||
```
|
||||
|
||||
#### bearer
|
||||
|
||||
If credential is required by the Cloud Call Centre (CCC), please apply for Bearer Token maintenance by yourself.
|
||||
|
||||
```ts
|
||||
import Credential, { Config } from '@alicloud/credentials';
|
||||
const config: Config = {
|
||||
type: 'bearer', // credential type
|
||||
bearerToken: 'bearerToken', // BearerToken of your account
|
||||
}
|
||||
const cred = new Credential(config);
|
||||
let bearerToken: string = await cred.getBearerToken();
|
||||
let type: string = cred.getType();
|
||||
```
|
||||
|
||||
### Provider
|
||||
|
||||
If you call `new Credential()` with empty, it will use provider chain to get credential for you.
|
||||
|
||||
#### 1. Environment Credentials
|
||||
|
||||
The program first looks for environment credentials in the environment variable. If the `ALIBABA_CLOUD_ACCESS_KEY_ID` and `ALIBABA_CLOUD_ACCESS_KEY_SECRET` environment variables are defined and are not empty, the program will use them to create the default credential. If not, the program loads and looks for the client in the configuration file.
|
||||
|
||||
#### 2. Config File
|
||||
|
||||
If there is `~/.alibabacloud/credentials` default file (Windows shows `C:\Users\USER_NAME\.alibabacloud\credentials`), the program will automatically create credential with the name of 'default'. The default file may not exist, but a parse error throws an exception. The specified files can also be loaded indefinitely: `AlibabaCloud::load('/data/credentials', 'vfs://AlibabaCloud/credentials', ...);` This configuration file can be shared between different projects and between different tools. Because it is outside the project and will not be accidentally committed to the version control. Environment variables can be used on Windows to refer to the home directory %UserProfile%. Unix-like systems can use the environment variable $HOME or ~ (tilde). The path to the default file can be modified by defining the `ALIBABA_CLOUD_CREDENTIALS_FILE` environment variable.
|
||||
|
||||
```ini
|
||||
[default] # Default credential
|
||||
type = access_key # Certification type: access_key
|
||||
access_key_id = foo # access key id
|
||||
access_key_secret = bar # access key secret
|
||||
```
|
||||
|
||||
#### 3. Instance RAM Role
|
||||
|
||||
If the environment variable `ALIBABA_CLOUD_ECS_METADATA` is defined and not empty, the program will take the value of the environment variable as the role name and request `http://100.100.100.200/latest/meta-data/ram/security-credentials/` to get the temporary Security credential.
|
||||
|
||||
#### 4. Credentials URI
|
||||
|
||||
If the environment variable `ALIBABA_CLOUD_CREDENTIALS_URI` is defined and not empty,
|
||||
the program will take the value of the environment variable as the credentials uri.
|
||||
|
||||
## Test & Coverage
|
||||
|
||||
- run test
|
||||
|
||||
```sh
|
||||
npm run test
|
||||
```
|
||||
|
||||
- run code coverage
|
||||
|
||||
```sh
|
||||
npm run cov
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
|
||||
|
||||
[ak]: https://usercenter.console.aliyun.com/#/manage/ak
|
||||
[ram]: https://ram.console.aliyun.com/users
|
||||
[permissions]: https://ram.console.aliyun.com/permissions
|
||||
[RAM Role]: https://ram.console.aliyun.com/#/role/list
|
||||
[OIDC Role]: https://help.aliyun.com/zh/ram/user-guide/role-based-sso-by-using-oidc
|
||||
[policy]: https://help.aliyun.com/zh/ram/user-guide/policy-management/
|
||||
60
backend/node_modules/@alicloud/credentials/dist/package.json
generated
vendored
Normal file
60
backend/node_modules/@alicloud/credentials/dist/package.json
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "@alicloud/credentials",
|
||||
"version": "2.4.4",
|
||||
"description": "alibaba cloud node.js sdk credentials",
|
||||
"main": "dist/src/client.js",
|
||||
"scripts": {
|
||||
"prepublishOnly": "tsc",
|
||||
"build": "tsc",
|
||||
"lint": "eslint --fix ./src --ext .ts",
|
||||
"test": "mocha -b -r ts-node/register test/**/*.test.ts test/*.test.ts --timeout 15000",
|
||||
"test-dev": "nyc -e .ts -r=html -r=text -r=lcov mocha -b -r ts-node/register",
|
||||
"cov": "nyc -e .ts -r=html -r=text -r=lcov npm run test",
|
||||
"ci": "npm run cov",
|
||||
"integration": "mocha -b -r ts-node/register -R spec integration/*.test.ts",
|
||||
"clean": "rm -rf coverage"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/aliyun/nodejs-credentials.git"
|
||||
},
|
||||
"keywords": [
|
||||
"alibaba cloud",
|
||||
"sdk",
|
||||
"credentials"
|
||||
],
|
||||
"author": "Alibaba Cloud SDK",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/debug": "^4.1.12",
|
||||
"@types/expect.js": "^0.3.29",
|
||||
"@types/ini": "^1.3.30",
|
||||
"@types/mocha": "^10.0.6",
|
||||
"@types/node": "^20.11.10",
|
||||
"@types/rewire": "^2.5.28",
|
||||
"@typescript-eslint/eslint-plugin": "^6.18.1",
|
||||
"@typescript-eslint/parser": "^6.18.1",
|
||||
"eslint": "^8.56.0",
|
||||
"expect.js": "^0.3.1",
|
||||
"mm": "^2.4.1",
|
||||
"mocha": "^10.1.0",
|
||||
"nyc": "^15.1.0",
|
||||
"rewire": "^7.0.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@alicloud/tea-typescript": "^1.8.0",
|
||||
"httpx": "^2.3.3",
|
||||
"ini": "^1.3.5",
|
||||
"kitx": "^2.0.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/aliyun/nodejs-credentials/issues"
|
||||
},
|
||||
"homepage": "https://github.com/aliyun/nodejs-credentials#readme",
|
||||
"files": [
|
||||
"src",
|
||||
"dist"
|
||||
]
|
||||
}
|
||||
5
backend/node_modules/@alicloud/credentials/dist/src/access_key_credential.d.ts
generated
vendored
Normal file
5
backend/node_modules/@alicloud/credentials/dist/src/access_key_credential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import DefaultCredential from './default_credential';
|
||||
import ICredential from './icredential';
|
||||
export default class AccessKeyCredential extends DefaultCredential implements ICredential {
|
||||
constructor(accessKeyId: string, accessKeySecret: string);
|
||||
}
|
||||
25
backend/node_modules/@alicloud/credentials/dist/src/access_key_credential.js
generated
vendored
Normal file
25
backend/node_modules/@alicloud/credentials/dist/src/access_key_credential.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const default_credential_1 = __importDefault(require("./default_credential"));
|
||||
const config_1 = __importDefault(require("./config"));
|
||||
class AccessKeyCredential extends default_credential_1.default {
|
||||
constructor(accessKeyId, accessKeySecret) {
|
||||
if (!accessKeyId) {
|
||||
throw new Error('Missing required accessKeyId option in config for access_key');
|
||||
}
|
||||
if (!accessKeySecret) {
|
||||
throw new Error('Missing required accessKeySecret option in config for access_key');
|
||||
}
|
||||
const conf = new config_1.default({
|
||||
type: 'access_key',
|
||||
accessKeyId,
|
||||
accessKeySecret
|
||||
});
|
||||
super(conf);
|
||||
}
|
||||
}
|
||||
exports.default = AccessKeyCredential;
|
||||
//# sourceMappingURL=access_key_credential.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/access_key_credential.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/access_key_credential.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"access_key_credential.js","sourceRoot":"","sources":["../../src/access_key_credential.ts"],"names":[],"mappings":";;;;;AAAA,8EAAqD;AAErD,sDAA8B;AAE9B,MAAqB,mBAAoB,SAAQ,4BAAiB;IAChE,YAAY,WAAmB,EAAE,eAAuB;QACtD,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;SACjF;QAED,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;SACrF;QACD,MAAM,IAAI,GAAG,IAAI,gBAAM,CAAC;YACtB,IAAI,EAAE,YAAY;YAClB,WAAW;YACX,eAAe;SAChB,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;CACF;AAhBD,sCAgBC"}
|
||||
5
backend/node_modules/@alicloud/credentials/dist/src/bearer_token_credential.d.ts
generated
vendored
Normal file
5
backend/node_modules/@alicloud/credentials/dist/src/bearer_token_credential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import DefaultCredential from './default_credential';
|
||||
import ICredential from './icredential';
|
||||
export default class BearerTokenCredential extends DefaultCredential implements ICredential {
|
||||
constructor(bearerToken: string);
|
||||
}
|
||||
21
backend/node_modules/@alicloud/credentials/dist/src/bearer_token_credential.js
generated
vendored
Normal file
21
backend/node_modules/@alicloud/credentials/dist/src/bearer_token_credential.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const default_credential_1 = __importDefault(require("./default_credential"));
|
||||
const config_1 = __importDefault(require("./config"));
|
||||
class BearerTokenCredential extends default_credential_1.default {
|
||||
constructor(bearerToken) {
|
||||
if (!bearerToken) {
|
||||
throw new Error('Missing required bearerToken option in config for bearer');
|
||||
}
|
||||
const conf = new config_1.default({
|
||||
type: 'bearer'
|
||||
});
|
||||
super(conf);
|
||||
this.bearerToken = bearerToken;
|
||||
}
|
||||
}
|
||||
exports.default = BearerTokenCredential;
|
||||
//# sourceMappingURL=bearer_token_credential.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/bearer_token_credential.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/bearer_token_credential.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"bearer_token_credential.js","sourceRoot":"","sources":["../../src/bearer_token_credential.ts"],"names":[],"mappings":";;;;;AAAA,8EAAqD;AAErD,sDAA8B;AAE9B,MAAqB,qBAAsB,SAAQ,4BAAiB;IAElE,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;SAC7E;QACD,MAAM,IAAI,GAAG,IAAI,gBAAM,CAAC;YACtB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AAZD,wCAYC"}
|
||||
43
backend/node_modules/@alicloud/credentials/dist/src/client.d.ts
generated
vendored
Normal file
43
backend/node_modules/@alicloud/credentials/dist/src/client.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import ICredential from './icredential';
|
||||
import Config from './config';
|
||||
import CredentialModel from './credential_model';
|
||||
import CredentialsProvider from './credentials_provider';
|
||||
import StaticAKCredentialsProvider from './providers/static_ak';
|
||||
import StaticSTSCredentialsProvider from './providers/static_sts';
|
||||
import RAMRoleARNCredentialsProvider from './providers/ram_role_arn';
|
||||
import OIDCRoleArnCredentialsProvider from './providers/oidc_role_arn';
|
||||
import ECSRAMRoleCredentialsProvider from './providers/ecs_ram_role';
|
||||
import DefaultCredentialsProvider from './providers/default';
|
||||
import URICredentialsProvider from './providers/uri';
|
||||
import CLIProfileCredentialsProvider from './providers/cli_profile';
|
||||
import ProfileCredentialsProvider from './providers/profile';
|
||||
import EnvironmentVariableCredentialsProvider from './providers/env';
|
||||
export { CredentialModel, Config, DefaultCredentialsProvider, CredentialsProvider, StaticAKCredentialsProvider, StaticSTSCredentialsProvider, RAMRoleARNCredentialsProvider, OIDCRoleArnCredentialsProvider, ECSRAMRoleCredentialsProvider, URICredentialsProvider, EnvironmentVariableCredentialsProvider, ProfileCredentialsProvider, CLIProfileCredentialsProvider };
|
||||
export default class Credential implements ICredential {
|
||||
credential: ICredential;
|
||||
constructor(config?: Config | null, provider?: CredentialsProvider | {
|
||||
[key: string]: any;
|
||||
} | null);
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getAccessKeyId(): Promise<string>;
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getAccessKeySecret(): Promise<string>;
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getSecurityToken(): Promise<string>;
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getBearerToken(): string;
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getType(): string;
|
||||
getCredential(): Promise<CredentialModel>;
|
||||
private load;
|
||||
}
|
||||
229
backend/node_modules/@alicloud/credentials/dist/src/client.js
generated
vendored
Normal file
229
backend/node_modules/@alicloud/credentials/dist/src/client.js
generated
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CLIProfileCredentialsProvider = exports.ProfileCredentialsProvider = exports.EnvironmentVariableCredentialsProvider = exports.URICredentialsProvider = exports.ECSRAMRoleCredentialsProvider = exports.OIDCRoleArnCredentialsProvider = exports.RAMRoleARNCredentialsProvider = exports.StaticSTSCredentialsProvider = exports.StaticAKCredentialsProvider = exports.DefaultCredentialsProvider = exports.Config = exports.CredentialModel = void 0;
|
||||
const rsa_key_pair_credential_1 = __importDefault(require("./rsa_key_pair_credential"));
|
||||
const bearer_token_credential_1 = __importDefault(require("./bearer_token_credential"));
|
||||
const config_1 = __importDefault(require("./config"));
|
||||
exports.Config = config_1.default;
|
||||
const credential_model_1 = __importDefault(require("./credential_model"));
|
||||
exports.CredentialModel = credential_model_1.default;
|
||||
const static_ak_1 = __importDefault(require("./providers/static_ak"));
|
||||
exports.StaticAKCredentialsProvider = static_ak_1.default;
|
||||
const static_sts_1 = __importDefault(require("./providers/static_sts"));
|
||||
exports.StaticSTSCredentialsProvider = static_sts_1.default;
|
||||
const ram_role_arn_1 = __importDefault(require("./providers/ram_role_arn"));
|
||||
exports.RAMRoleARNCredentialsProvider = ram_role_arn_1.default;
|
||||
const oidc_role_arn_1 = __importDefault(require("./providers/oidc_role_arn"));
|
||||
exports.OIDCRoleArnCredentialsProvider = oidc_role_arn_1.default;
|
||||
const ecs_ram_role_1 = __importDefault(require("./providers/ecs_ram_role"));
|
||||
exports.ECSRAMRoleCredentialsProvider = ecs_ram_role_1.default;
|
||||
const default_1 = __importDefault(require("./providers/default"));
|
||||
exports.DefaultCredentialsProvider = default_1.default;
|
||||
const uri_1 = __importDefault(require("./providers/uri"));
|
||||
exports.URICredentialsProvider = uri_1.default;
|
||||
const cli_profile_1 = __importDefault(require("./providers/cli_profile"));
|
||||
exports.CLIProfileCredentialsProvider = cli_profile_1.default;
|
||||
const profile_1 = __importDefault(require("./providers/profile"));
|
||||
exports.ProfileCredentialsProvider = profile_1.default;
|
||||
const env_1 = __importDefault(require("./providers/env"));
|
||||
exports.EnvironmentVariableCredentialsProvider = env_1.default;
|
||||
class InnerCredentialsClient {
|
||||
constructor(type, provider) {
|
||||
this.type = type;
|
||||
this.provider = provider;
|
||||
}
|
||||
/**
|
||||
* @deprecated use getCredential() instead of
|
||||
* @returns the access key id of credentials
|
||||
*/
|
||||
async getAccessKeyId() {
|
||||
const credentials = await this.provider.getCredentials();
|
||||
return credentials.accessKeyId;
|
||||
}
|
||||
/**
|
||||
* @deprecated use getCredential() instead of
|
||||
* @returns the access key secret of credentials
|
||||
*/
|
||||
async getAccessKeySecret() {
|
||||
const credentials = await this.provider.getCredentials();
|
||||
return credentials.accessKeySecret;
|
||||
}
|
||||
/**
|
||||
* @deprecated use getCredential() instead of
|
||||
* @returns the security token of credentials
|
||||
*/
|
||||
async getSecurityToken() {
|
||||
const credentials = await this.provider.getCredentials();
|
||||
return credentials.securityToken;
|
||||
}
|
||||
getBearerToken() {
|
||||
return;
|
||||
}
|
||||
getType() {
|
||||
return this.type;
|
||||
}
|
||||
async getCredential() {
|
||||
const credentials = await this.provider.getCredentials();
|
||||
return new credential_model_1.default({
|
||||
accessKeyId: credentials.accessKeyId,
|
||||
accessKeySecret: credentials.accessKeySecret,
|
||||
securityToken: credentials.securityToken,
|
||||
bearerToken: undefined,
|
||||
type: this.getType(),
|
||||
providerName: credentials.providerName,
|
||||
});
|
||||
}
|
||||
}
|
||||
function isCredentialsProviderClass(t) {
|
||||
if (!t) {
|
||||
return false;
|
||||
}
|
||||
return typeof t.getCredentials === 'function' && typeof t.getProviderName === 'function';
|
||||
}
|
||||
class Credential {
|
||||
constructor(config = null, provider = null) {
|
||||
if (isCredentialsProviderClass(provider)) {
|
||||
this.load(null, provider);
|
||||
}
|
||||
else {
|
||||
this.load(config, null);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getAccessKeyId() {
|
||||
return this.credential.getAccessKeyId();
|
||||
}
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getAccessKeySecret() {
|
||||
return this.credential.getAccessKeySecret();
|
||||
}
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getSecurityToken() {
|
||||
return this.credential.getSecurityToken();
|
||||
}
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getBearerToken() {
|
||||
return this.credential.getBearerToken();
|
||||
}
|
||||
/**
|
||||
* @deprecated Use getCredential() instead of
|
||||
*/
|
||||
getType() {
|
||||
return this.credential.getType();
|
||||
}
|
||||
getCredential() {
|
||||
return this.credential.getCredential();
|
||||
}
|
||||
load(config, provider) {
|
||||
if (provider) {
|
||||
this.credential = new InnerCredentialsClient(provider.getProviderName(), provider);
|
||||
return;
|
||||
}
|
||||
if (!config) {
|
||||
this.credential = new InnerCredentialsClient('default', default_1.default.builder().build());
|
||||
return;
|
||||
}
|
||||
if (!config.type) {
|
||||
throw new Error('Missing required type option');
|
||||
}
|
||||
switch (config.type) {
|
||||
case 'access_key':
|
||||
this.credential = new InnerCredentialsClient('access_key', static_ak_1.default.builder()
|
||||
.withAccessKeyId(config.accessKeyId)
|
||||
.withAccessKeySecret(config.accessKeySecret)
|
||||
.build());
|
||||
break;
|
||||
case 'sts':
|
||||
this.credential = new InnerCredentialsClient('sts', static_sts_1.default.builder()
|
||||
.withAccessKeyId(config.accessKeyId)
|
||||
.withAccessKeySecret(config.accessKeySecret)
|
||||
.withSecurityToken(config.securityToken)
|
||||
.build());
|
||||
break;
|
||||
case 'ecs_ram_role':
|
||||
this.credential = new InnerCredentialsClient('ecs_ram_role', ecs_ram_role_1.default.builder()
|
||||
.withRoleName(config.roleName)
|
||||
.withDisableIMDSv1(config.disableIMDSv1)
|
||||
.withAsyncCredentialUpdateEnabled(config.asyncCredentialUpdateEnabled)
|
||||
.withReadTimeout(config.timeout)
|
||||
.withConnectTimeout(config.connectTimeout)
|
||||
.build());
|
||||
break;
|
||||
case 'ram_role_arn':
|
||||
{
|
||||
let credentialsProvider;
|
||||
if (config.securityToken) {
|
||||
credentialsProvider = static_sts_1.default.builder()
|
||||
.withAccessKeyId(config.accessKeyId)
|
||||
.withAccessKeySecret(config.accessKeySecret)
|
||||
.withSecurityToken(config.securityToken)
|
||||
.build();
|
||||
}
|
||||
else {
|
||||
credentialsProvider = static_ak_1.default.builder()
|
||||
.withAccessKeyId(config.accessKeyId)
|
||||
.withAccessKeySecret(config.accessKeySecret)
|
||||
.build();
|
||||
}
|
||||
this.credential = new InnerCredentialsClient('ram_role_arn', ram_role_arn_1.default.builder()
|
||||
.withCredentialsProvider(credentialsProvider)
|
||||
.withRoleArn(config.roleArn)
|
||||
.withPolicy(config.policy)
|
||||
.withDurationSeconds(config.roleSessionExpiration)
|
||||
.withRoleSessionName(config.roleSessionName)
|
||||
.withReadTimeout(config.timeout)
|
||||
.withConnectTimeout(config.connectTimeout)
|
||||
.withEnableVpc(config.enableVpc)
|
||||
.withStsEndpoint(config.stsEndpoint)
|
||||
.withStsRegionId(config.stsRegionId)
|
||||
.withExternalId(config.externalId)
|
||||
// .withHttpOptions(runtime)
|
||||
.build());
|
||||
}
|
||||
break;
|
||||
case 'oidc_role_arn':
|
||||
this.credential = new InnerCredentialsClient('oidc_role_arn', oidc_role_arn_1.default.builder()
|
||||
.withRoleArn(config.roleArn)
|
||||
.withOIDCProviderArn(config.oidcProviderArn)
|
||||
.withOIDCTokenFilePath(config.oidcTokenFilePath)
|
||||
.withRoleSessionName(config.roleSessionName)
|
||||
.withPolicy(config.policy)
|
||||
.withDurationSeconds(config.roleSessionExpiration)
|
||||
.withStsEndpoint(config.stsEndpoint)
|
||||
.withStsRegionId(config.stsRegionId)
|
||||
.withEnableVpc(config.enableVpc)
|
||||
.withReadTimeout(config.timeout)
|
||||
.withConnectTimeout(config.connectTimeout)
|
||||
.build());
|
||||
break;
|
||||
case 'rsa_key_pair':
|
||||
this.credential = new rsa_key_pair_credential_1.default(config.publicKeyId, config.privateKeyFile);
|
||||
break;
|
||||
case 'bearer':
|
||||
this.credential = new bearer_token_credential_1.default(config.bearerToken);
|
||||
break;
|
||||
case 'credentials_uri':
|
||||
this.credential = new InnerCredentialsClient('credentials_uri', uri_1.default.builder()
|
||||
.withCredentialsURI(config.credentialsURI)
|
||||
.withReadTimeout(config.timeout)
|
||||
.withConnectTimeout(config.connectTimeout)
|
||||
.build());
|
||||
break;
|
||||
default:
|
||||
throw new Error('Invalid type option, support: access_key, sts, ecs_ram_role, ram_role_arn, rsa_key_pair, credentials_uri');
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.default = Credential;
|
||||
//# sourceMappingURL=client.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/client.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/client.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
36
backend/node_modules/@alicloud/credentials/dist/src/config.d.ts
generated
vendored
Normal file
36
backend/node_modules/@alicloud/credentials/dist/src/config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import * as $tea from '@alicloud/tea-typescript';
|
||||
export default class Config extends $tea.Model {
|
||||
accessKeyId?: string;
|
||||
accessKeySecret?: string;
|
||||
securityToken?: string;
|
||||
bearerToken?: string;
|
||||
durationSeconds?: number;
|
||||
roleArn?: string;
|
||||
policy?: string;
|
||||
roleSessionExpiration?: number;
|
||||
roleSessionName?: string;
|
||||
publicKeyId?: string;
|
||||
privateKeyFile?: string;
|
||||
roleName?: string;
|
||||
enableIMDSv2?: boolean;
|
||||
disableIMDSv1: boolean;
|
||||
asyncCredentialUpdateEnabled: boolean;
|
||||
metadataTokenDuration?: number;
|
||||
credentialsURI?: string;
|
||||
oidcProviderArn: string;
|
||||
oidcTokenFilePath: string;
|
||||
type?: string;
|
||||
externalId?: string;
|
||||
stsEndpoint?: string;
|
||||
timeout?: number;
|
||||
connectTimeout?: number;
|
||||
static names(): {
|
||||
[key: string]: string;
|
||||
};
|
||||
static types(): {
|
||||
[key: string]: any;
|
||||
};
|
||||
constructor(config?: {
|
||||
[key: string]: any;
|
||||
});
|
||||
}
|
||||
93
backend/node_modules/@alicloud/credentials/dist/src/config.js
generated
vendored
Normal file
93
backend/node_modules/@alicloud/credentials/dist/src/config.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const $tea = __importStar(require("@alicloud/tea-typescript"));
|
||||
class Config extends $tea.Model {
|
||||
static names() {
|
||||
return {
|
||||
accessKeyId: 'accessKeyId',
|
||||
accessKeySecret: 'accessKeySecret',
|
||||
securityToken: 'securityToken',
|
||||
bearerToken: 'bearerToken',
|
||||
durationSeconds: 'durationSeconds',
|
||||
roleArn: 'roleArn',
|
||||
policy: 'policy',
|
||||
roleSessionExpiration: 'roleSessionExpiration',
|
||||
roleSessionName: 'roleSessionName',
|
||||
externalId: 'externalId',
|
||||
stsEndpoint: 'stsEndpoint',
|
||||
stsRegionId: 'stsRegionId',
|
||||
enableVpc: 'enableVpc',
|
||||
timeout: 'readTimeout',
|
||||
connectTimeout: 'connectTimeout',
|
||||
publicKeyId: 'publicKeyId',
|
||||
privateKeyFile: 'privateKeyFile',
|
||||
roleName: 'roleName',
|
||||
enableIMDSv2: 'enableIMDSv2',
|
||||
disableIMDSv1: 'disableIMDSv1',
|
||||
asyncCredentialUpdateEnabled: 'asyncCredentialUpdateEnabled',
|
||||
metadataTokenDuration: 'metadataTokenDuration',
|
||||
credentialsURI: 'credentialsURI',
|
||||
oidcProviderArn: 'oidcProviderArn',
|
||||
oidcTokenFilePath: 'oidcTokenFilePath',
|
||||
type: 'type',
|
||||
};
|
||||
}
|
||||
static types() {
|
||||
return {
|
||||
accessKeyId: 'string',
|
||||
accessKeySecret: 'string',
|
||||
securityToken: 'string',
|
||||
bearerToken: 'string',
|
||||
durationSeconds: 'number',
|
||||
roleArn: 'string',
|
||||
policy: 'string',
|
||||
roleSessionExpiration: 'number',
|
||||
roleSessionName: 'string',
|
||||
externalId: 'string',
|
||||
stsEndpoint: 'string',
|
||||
stsRegionId: 'string',
|
||||
enableVpc: 'string',
|
||||
timeout: 'number',
|
||||
connectTimeout: 'number',
|
||||
publicKeyId: 'string',
|
||||
privateKeyFile: 'string',
|
||||
roleName: 'string',
|
||||
enableIMDSv2: 'boolean',
|
||||
disableIMDSv1: 'boolean',
|
||||
asyncCredentialUpdateEnabled: 'boolean',
|
||||
metadataTokenDuration: 'number',
|
||||
credentialsURI: 'string',
|
||||
oidcProviderArn: 'string',
|
||||
oidcTokenFilePath: 'string',
|
||||
type: 'string',
|
||||
};
|
||||
}
|
||||
constructor(config) {
|
||||
super(config);
|
||||
}
|
||||
}
|
||||
exports.default = Config;
|
||||
//# sourceMappingURL=config.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/config.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/config.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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AAQ;YACrB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,QAAQ;YAClB,YAAY,EAAE,SAAS;YACvB,aAAa,EAAE,SAAS;YACxB,4BAA4B,EAAE,SAAS;YACvC,qBAAqB,EAAE,QAAQ;YAC/B,cAAc,EAAE,QAAQ;YACxB,eAAe,EAAE,QAAQ;YACzB,iBAAiB,EAAE,QAAQ;YAC3B,IAAI,EAAE,QAAQ;SACf,CAAC;IACJ,CAAC;IAED,YAAY,MAA+B;QACzC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;CACF;AA3FD,yBA2FC"}
|
||||
18
backend/node_modules/@alicloud/credentials/dist/src/credential_model.d.ts
generated
vendored
Normal file
18
backend/node_modules/@alicloud/credentials/dist/src/credential_model.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as $tea from '@alicloud/tea-typescript';
|
||||
export default class CredentialModel extends $tea.Model {
|
||||
accessKeyId?: string;
|
||||
accessKeySecret?: string;
|
||||
securityToken?: string;
|
||||
bearerToken?: string;
|
||||
type?: string;
|
||||
providerName?: string;
|
||||
static names(): {
|
||||
[key: string]: string;
|
||||
};
|
||||
static types(): {
|
||||
[key: string]: any;
|
||||
};
|
||||
constructor(map?: {
|
||||
[key: string]: any;
|
||||
});
|
||||
}
|
||||
53
backend/node_modules/@alicloud/credentials/dist/src/credential_model.js
generated
vendored
Normal file
53
backend/node_modules/@alicloud/credentials/dist/src/credential_model.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const $tea = __importStar(require("@alicloud/tea-typescript"));
|
||||
class CredentialModel extends $tea.Model {
|
||||
static names() {
|
||||
return {
|
||||
accessKeyId: 'accessKeyId',
|
||||
accessKeySecret: 'accessKeySecret',
|
||||
securityToken: 'securityToken',
|
||||
bearerToken: 'bearerToken',
|
||||
type: 'type',
|
||||
providerName: 'providerName',
|
||||
};
|
||||
}
|
||||
static types() {
|
||||
return {
|
||||
accessKeyId: 'string',
|
||||
accessKeySecret: 'string',
|
||||
securityToken: 'string',
|
||||
bearerToken: 'string',
|
||||
type: 'string',
|
||||
providerName: 'string',
|
||||
};
|
||||
}
|
||||
constructor(map) {
|
||||
super(map);
|
||||
}
|
||||
}
|
||||
exports.default = CredentialModel;
|
||||
//# sourceMappingURL=credential_model.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/credential_model.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/credential_model.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"credential_model.js","sourceRoot":"","sources":["../../src/credential_model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAiD;AAEjD,MAAqB,eAAgB,SAAQ,IAAI,CAAC,KAAK;IAOrD,MAAM,CAAC,KAAK;QACV,OAAO;YACL,WAAW,EAAE,aAAa;YAC1B,eAAe,EAAE,iBAAiB;YAClC,aAAa,EAAE,eAAe;YAC9B,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,MAAM;YACZ,YAAY,EAAE,cAAc;SAC7B,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK;QACV,OAAO;YACL,WAAW,EAAE,QAAQ;YACrB,eAAe,EAAE,QAAQ;YACzB,aAAa,EAAE,QAAQ;YACvB,WAAW,EAAE,QAAQ;YACrB,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,QAAQ;SACvB,CAAC;IACJ,CAAC;IAED,YAAY,GAA4B;QACtC,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF;AAhCD,kCAgCC"}
|
||||
19
backend/node_modules/@alicloud/credentials/dist/src/credentials.d.ts
generated
vendored
Normal file
19
backend/node_modules/@alicloud/credentials/dist/src/credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export default class Credentials {
|
||||
readonly accessKeyId: string;
|
||||
readonly accessKeySecret: string;
|
||||
readonly securityToken: string;
|
||||
readonly providerName: string;
|
||||
constructor(builder: CredentialsBuilder);
|
||||
static builder(): CredentialsBuilder;
|
||||
}
|
||||
export declare class CredentialsBuilder {
|
||||
accessKeyId: string;
|
||||
accessKeySecret: string;
|
||||
securityToken: string;
|
||||
providerName: string;
|
||||
withAccessKeyId(value: string): this;
|
||||
withAccessKeySecret(value: string): this;
|
||||
withSecurityToken(value: string): this;
|
||||
withProviderName(value: string): this;
|
||||
build(): Credentials;
|
||||
}
|
||||
38
backend/node_modules/@alicloud/credentials/dist/src/credentials.js
generated
vendored
Normal file
38
backend/node_modules/@alicloud/credentials/dist/src/credentials.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CredentialsBuilder = void 0;
|
||||
class Credentials {
|
||||
constructor(builder) {
|
||||
this.accessKeyId = builder.accessKeyId;
|
||||
this.accessKeySecret = builder.accessKeySecret;
|
||||
this.securityToken = builder.securityToken;
|
||||
this.providerName = builder.providerName;
|
||||
}
|
||||
static builder() {
|
||||
return new CredentialsBuilder();
|
||||
}
|
||||
}
|
||||
exports.default = Credentials;
|
||||
class CredentialsBuilder {
|
||||
withAccessKeyId(value) {
|
||||
this.accessKeyId = value;
|
||||
return this;
|
||||
}
|
||||
withAccessKeySecret(value) {
|
||||
this.accessKeySecret = value;
|
||||
return this;
|
||||
}
|
||||
withSecurityToken(value) {
|
||||
this.securityToken = value;
|
||||
return this;
|
||||
}
|
||||
withProviderName(value) {
|
||||
this.providerName = value;
|
||||
return this;
|
||||
}
|
||||
build() {
|
||||
return new Credentials(this);
|
||||
}
|
||||
}
|
||||
exports.CredentialsBuilder = CredentialsBuilder;
|
||||
//# sourceMappingURL=credentials.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/credentials.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/credentials.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/credentials.ts"],"names":[],"mappings":";;;AAAA,MAAqB,WAAW;IAM9B,YAAY,OAA4B;QACtC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,kBAAkB,EAAE,CAAC;IAClC,CAAC;CACF;AAhBD,8BAgBC;AAED,MAAa,kBAAkB;IAMtB,eAAe,CAAC,KAAa;QAClC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,mBAAmB,CAAC,KAAa;QACtC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,iBAAiB,CAAC,KAAa;QACpC,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,gBAAgB,CAAC,KAAa;QACnC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK;QACV,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AA7BD,gDA6BC"}
|
||||
5
backend/node_modules/@alicloud/credentials/dist/src/credentials_provider.d.ts
generated
vendored
Normal file
5
backend/node_modules/@alicloud/credentials/dist/src/credentials_provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import Credentials from './credentials';
|
||||
export default interface CredentialsProvider {
|
||||
getCredentials: () => Promise<Credentials>;
|
||||
getProviderName: () => string;
|
||||
}
|
||||
3
backend/node_modules/@alicloud/credentials/dist/src/credentials_provider.js
generated
vendored
Normal file
3
backend/node_modules/@alicloud/credentials/dist/src/credentials_provider.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=credentials_provider.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/credentials_provider.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/credentials_provider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"credentials_provider.js","sourceRoot":"","sources":["../../src/credentials_provider.ts"],"names":[],"mappings":""}
|
||||
17
backend/node_modules/@alicloud/credentials/dist/src/default_credential.d.ts
generated
vendored
Normal file
17
backend/node_modules/@alicloud/credentials/dist/src/default_credential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import Config from './config';
|
||||
import CredentialModel from './credential_model';
|
||||
import ICredential from './icredential';
|
||||
export default class DefaultCredential implements ICredential {
|
||||
accessKeyId: string;
|
||||
accessKeySecret: string;
|
||||
securityToken?: string;
|
||||
bearerToken?: string;
|
||||
type: string;
|
||||
constructor(config: Config);
|
||||
getAccessKeyId(): Promise<string>;
|
||||
getAccessKeySecret(): Promise<string>;
|
||||
getSecurityToken(): Promise<string>;
|
||||
getBearerToken(): string;
|
||||
getType(): string;
|
||||
getCredential(): Promise<CredentialModel>;
|
||||
}
|
||||
41
backend/node_modules/@alicloud/credentials/dist/src/default_credential.js
generated
vendored
Normal file
41
backend/node_modules/@alicloud/credentials/dist/src/default_credential.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const credential_model_1 = __importDefault(require("./credential_model"));
|
||||
class DefaultCredential {
|
||||
constructor(config) {
|
||||
this.accessKeyId = config.accessKeyId || '';
|
||||
this.accessKeySecret = config.accessKeySecret || '';
|
||||
this.securityToken = config.securityToken || '';
|
||||
this.bearerToken = config.bearerToken || '';
|
||||
this.type = config.type || '';
|
||||
}
|
||||
async getAccessKeyId() {
|
||||
return this.accessKeyId;
|
||||
}
|
||||
async getAccessKeySecret() {
|
||||
return this.accessKeySecret;
|
||||
}
|
||||
async getSecurityToken() {
|
||||
return this.securityToken;
|
||||
}
|
||||
getBearerToken() {
|
||||
return this.bearerToken;
|
||||
}
|
||||
getType() {
|
||||
return this.type;
|
||||
}
|
||||
async getCredential() {
|
||||
return new credential_model_1.default({
|
||||
accessKeyId: this.accessKeyId,
|
||||
accessKeySecret: this.accessKeySecret,
|
||||
securityToken: this.securityToken,
|
||||
bearerToken: this.bearerToken,
|
||||
type: this.type,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = DefaultCredential;
|
||||
//# sourceMappingURL=default_credential.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/default_credential.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/default_credential.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"default_credential.js","sourceRoot":"","sources":["../../src/default_credential.ts"],"names":[],"mappings":";;;;;AACA,0EAAiD;AAGjD,MAAqB,iBAAiB;IAOpC,YAAY,MAAc;QACxB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC;QAC5C,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC;QACpD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,IAAI,0BAAe,CAAC;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC,CAAC;IACL,CAAC;CACF;AA5CD,oCA4CC"}
|
||||
24
backend/node_modules/@alicloud/credentials/dist/src/ecs_ram_role_credential.d.ts
generated
vendored
Normal file
24
backend/node_modules/@alicloud/credentials/dist/src/ecs_ram_role_credential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import SessionCredential from './session_credential';
|
||||
import ICredential from './icredential';
|
||||
export default class EcsRamRoleCredential extends SessionCredential implements ICredential {
|
||||
roleName: string;
|
||||
enableIMDSv2: boolean;
|
||||
metadataTokenDuration?: number;
|
||||
runtime: {
|
||||
[key: string]: any;
|
||||
};
|
||||
metadataToken?: string;
|
||||
staleTime?: number;
|
||||
readTimeout?: number;
|
||||
connectTimeout?: number;
|
||||
constructor(roleName?: string, runtime?: {
|
||||
[key: string]: any;
|
||||
}, enableIMDSv2?: boolean, metadataTokenDuration?: number);
|
||||
getBody(url: string, options?: {
|
||||
[key: string]: any;
|
||||
}): Promise<string>;
|
||||
getMetadataToken(): Promise<string>;
|
||||
updateCredential(): Promise<void>;
|
||||
getRoleName(): Promise<string>;
|
||||
needToRefresh(): boolean;
|
||||
}
|
||||
80
backend/node_modules/@alicloud/credentials/dist/src/ecs_ram_role_credential.js
generated
vendored
Normal file
80
backend/node_modules/@alicloud/credentials/dist/src/ecs_ram_role_credential.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const session_credential_1 = __importDefault(require("./session_credential"));
|
||||
const httpx_1 = __importDefault(require("httpx"));
|
||||
const config_1 = __importDefault(require("./config"));
|
||||
const SECURITY_CRED_URL = 'http://100.100.100.200/latest/meta-data/ram/security-credentials/';
|
||||
const SECURITY_CRED_TOKEN_URL = 'http://100.100.100.200/latest/api/token';
|
||||
class EcsRamRoleCredential extends session_credential_1.default {
|
||||
constructor(roleName = '', runtime = {}, enableIMDSv2 = false, metadataTokenDuration = 21600) {
|
||||
const conf = new config_1.default({
|
||||
type: 'ecs_ram_role',
|
||||
});
|
||||
super(conf);
|
||||
this.roleName = roleName;
|
||||
this.enableIMDSv2 = enableIMDSv2;
|
||||
this.metadataTokenDuration = metadataTokenDuration;
|
||||
this.runtime = runtime;
|
||||
this.sessionCredential = null;
|
||||
this.metadataToken = null;
|
||||
this.staleTime = 0;
|
||||
}
|
||||
async getBody(url, options = {}) {
|
||||
const response = await httpx_1.default.request(url, options);
|
||||
return (await httpx_1.default.read(response, 'utf8'));
|
||||
}
|
||||
async getMetadataToken() {
|
||||
if (this.needToRefresh()) {
|
||||
let tmpTime = new Date().getTime() + this.metadataTokenDuration * 1000;
|
||||
const response = await httpx_1.default.request(SECURITY_CRED_TOKEN_URL, {
|
||||
headers: {
|
||||
'X-aliyun-ecs-metadata-token-ttl-seconds': `${this.metadataTokenDuration}`
|
||||
},
|
||||
method: "PUT"
|
||||
});
|
||||
if (response.statusCode !== 200) {
|
||||
throw new Error(`Failed to get token from ECS Metadata Service. HttpCode=${response.statusCode}`);
|
||||
}
|
||||
this.staleTime = tmpTime;
|
||||
return (await httpx_1.default.read(response, 'utf8'));
|
||||
}
|
||||
return this.metadataToken;
|
||||
}
|
||||
async updateCredential() {
|
||||
let options = {};
|
||||
if (this.enableIMDSv2) {
|
||||
this.metadataToken = await this.getMetadataToken();
|
||||
options = {
|
||||
headers: {
|
||||
'X-aliyun-ecs-metadata-token': this.metadataToken
|
||||
},
|
||||
readTimeout: this.readTimeout,
|
||||
connectTimeout: this.connectTimeout
|
||||
};
|
||||
}
|
||||
const roleName = await this.getRoleName();
|
||||
const url = SECURITY_CRED_URL + roleName;
|
||||
const body = await this.getBody(url, options);
|
||||
const json = JSON.parse(body);
|
||||
this.sessionCredential = {
|
||||
AccessKeyId: json.AccessKeyId,
|
||||
AccessKeySecret: json.AccessKeySecret,
|
||||
Expiration: json.Expiration,
|
||||
SecurityToken: json.SecurityToken,
|
||||
};
|
||||
}
|
||||
async getRoleName() {
|
||||
if (this.roleName && this.roleName.length) {
|
||||
return this.roleName;
|
||||
}
|
||||
return await this.getBody(SECURITY_CRED_URL);
|
||||
}
|
||||
needToRefresh() {
|
||||
return new Date().getTime() >= this.staleTime;
|
||||
}
|
||||
}
|
||||
exports.default = EcsRamRoleCredential;
|
||||
//# sourceMappingURL=ecs_ram_role_credential.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/ecs_ram_role_credential.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/ecs_ram_role_credential.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ecs_ram_role_credential.js","sourceRoot":"","sources":["../../src/ecs_ram_role_credential.ts"],"names":[],"mappings":";;;;;AAAA,8EAAqD;AACrD,kDAA0B;AAE1B,sDAA8B;AAE9B,MAAM,iBAAiB,GAAG,mEAAmE,CAAC;AAC9F,MAAM,uBAAuB,GAAG,yCAAyC,CAAC;AAE1E,MAAqB,oBAAqB,SAAQ,4BAAiB;IAUjE,YAAY,WAAmB,EAAE,EAAE,UAAkC,EAAE,EAAE,eAAwB,KAAK,EAAE,wBAAgC,KAAK;QAC3I,MAAM,IAAI,GAAG,IAAI,gBAAM,CAAC;YACtB,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,OAAO,CA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D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,iBAAiB,GAAG,QAAQ,CAAC;QACzC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,iBAAiB,GAAG;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;SAClC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW;QACf,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YACzC,OAAO,IAAI,CAAC,QAAQ,CAAC;SACtB;QAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC/C,CAAC;IAED,aAAa;QACX,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC;IAChD,CAAC;CACF;AAlFD,uCAkFC"}
|
||||
9
backend/node_modules/@alicloud/credentials/dist/src/icredential.d.ts
generated
vendored
Normal file
9
backend/node_modules/@alicloud/credentials/dist/src/icredential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import CredentialModel from './credential_model';
|
||||
export default interface ICredential {
|
||||
getAccessKeyId: () => Promise<string>;
|
||||
getAccessKeySecret: () => Promise<string>;
|
||||
getSecurityToken: () => Promise<string>;
|
||||
getBearerToken: () => string;
|
||||
getType: () => string;
|
||||
getCredential: () => Promise<CredentialModel>;
|
||||
}
|
||||
3
backend/node_modules/@alicloud/credentials/dist/src/icredential.js
generated
vendored
Normal file
3
backend/node_modules/@alicloud/credentials/dist/src/icredential.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=icredential.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/icredential.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/icredential.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"icredential.js","sourceRoot":"","sources":["../../src/icredential.ts"],"names":[],"mappings":""}
|
||||
19
backend/node_modules/@alicloud/credentials/dist/src/oidc_role_arn_credential.d.ts
generated
vendored
Normal file
19
backend/node_modules/@alicloud/credentials/dist/src/oidc_role_arn_credential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import SessionCredential from './session_credential';
|
||||
import Config from './config';
|
||||
export default class OidcRoleArnCredential extends SessionCredential {
|
||||
roleArn: string;
|
||||
oidcProviderArn: string;
|
||||
oidcTokenFilePath: string;
|
||||
policy: string;
|
||||
durationSeconds: number;
|
||||
roleSessionName: string;
|
||||
runtime: {
|
||||
[key: string]: any;
|
||||
};
|
||||
host: string;
|
||||
constructor(config: Config, runtime?: {
|
||||
[key: string]: any;
|
||||
});
|
||||
private getOdicToken;
|
||||
updateCredential(): Promise<void>;
|
||||
}
|
||||
79
backend/node_modules/@alicloud/credentials/dist/src/oidc_role_arn_credential.js
generated
vendored
Normal file
79
backend/node_modules/@alicloud/credentials/dist/src/oidc_role_arn_credential.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const session_credential_1 = __importDefault(require("./session_credential"));
|
||||
const http_1 = require("./util/http");
|
||||
const config_1 = __importDefault(require("./config"));
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
class OidcRoleArnCredential extends session_credential_1.default {
|
||||
constructor(config, runtime = {}) {
|
||||
if (!config.roleArn) {
|
||||
config.roleArn = process.env.ALIBABA_CLOUD_ROLE_ARN;
|
||||
if (!config.roleArn) {
|
||||
throw new Error('roleArn does not exist and env ALIBABA_CLOUD_ROLE_ARN is null.');
|
||||
}
|
||||
}
|
||||
if (!config.oidcProviderArn) {
|
||||
config.oidcProviderArn = process.env.ALIBABA_CLOUD_OIDC_PROVIDER_ARN;
|
||||
if (!config.oidcProviderArn) {
|
||||
throw new Error('oidcProviderArn does not exist and env ALIBABA_CLOUD_OIDC_PROVIDER_ARN is null.');
|
||||
}
|
||||
}
|
||||
if (!config.oidcTokenFilePath) {
|
||||
config.oidcTokenFilePath = process.env.ALIBABA_CLOUD_OIDC_TOKEN_FILE;
|
||||
if (!config.oidcTokenFilePath) {
|
||||
throw new Error('oidcTokenFilePath is not exists and env ALIBABA_CLOUD_OIDC_TOKEN_FILE is null.');
|
||||
}
|
||||
}
|
||||
if (!config.roleSessionName && process.env.ALIBABA_CLOUD_ROLE_SESSION_NAME) {
|
||||
config.roleSessionName = process.env.ALIBABA_CLOUD_ROLE_SESSION_NAME;
|
||||
}
|
||||
const conf = new config_1.default({
|
||||
type: 'oidc_role_arn'
|
||||
});
|
||||
super(conf);
|
||||
this.oidcTokenFilePath = config.oidcTokenFilePath;
|
||||
this.roleArn = config.roleArn;
|
||||
this.policy = config.policy;
|
||||
this.oidcProviderArn = config.oidcProviderArn;
|
||||
this.durationSeconds = config.roleSessionExpiration || 3600;
|
||||
this.roleSessionName = config.roleSessionName || 'role_session_name';
|
||||
runtime.method = 'POST';
|
||||
runtime.anonymous = true;
|
||||
this.runtime = runtime;
|
||||
this.host = 'https://sts.aliyuncs.com';
|
||||
}
|
||||
getOdicToken(oidcTokenFilePath) {
|
||||
if (!fs_1.default.existsSync(oidcTokenFilePath)) {
|
||||
throw new Error(`oidcTokenFilePath ${oidcTokenFilePath} is not exists.`);
|
||||
}
|
||||
let oidcToken = null;
|
||||
try {
|
||||
oidcToken = fs_1.default.readFileSync(oidcTokenFilePath, 'utf-8');
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`oidcTokenFilePath ${oidcTokenFilePath} cannot be read.`);
|
||||
}
|
||||
return oidcToken;
|
||||
}
|
||||
async updateCredential() {
|
||||
const oidcToken = this.getOdicToken(this.oidcTokenFilePath);
|
||||
const params = {
|
||||
Action: 'AssumeRoleWithOIDC',
|
||||
RoleArn: this.roleArn,
|
||||
OIDCProviderArn: this.oidcProviderArn,
|
||||
OIDCToken: oidcToken,
|
||||
DurationSeconds: this.durationSeconds,
|
||||
RoleSessionName: this.roleSessionName
|
||||
};
|
||||
if (this.policy) {
|
||||
params.policy = this.policy;
|
||||
}
|
||||
const json = await (0, http_1.request)(this.host, params, this.runtime);
|
||||
this.sessionCredential = json.Credentials;
|
||||
}
|
||||
}
|
||||
exports.default = OidcRoleArnCredential;
|
||||
//# sourceMappingURL=oidc_role_arn_credential.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/oidc_role_arn_credential.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/oidc_role_arn_credential.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"oidc_role_arn_credential.js","sourceRoot":"","sources":["../../src/oidc_role_arn_credential.ts"],"names":[],"mappings":";;;;;AAAA,8EAAqD;AACrD,sCAAsC;AACtC,sDAA8B;AAC9B,4CAAoB;AAEpB,MAAqB,qBAAsB,SAAQ,4BAAiB;IAUlE,YAAY,MAAc,EAAE,UAAkC,EAAE;QAC9D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACnB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;YACpD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;gBACnB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;aACnF;SACF;QAED,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE;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CAAC,iBAAyB;QAC5C,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,qBAAqB,iBAAiB,kBAAkB,CAAC,CAAC;SAC3E;QACD,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,IAAI;YACF,SAAS,GAAG,YAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;SACzD;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,iBAAiB,kBAAkB,CAAC,CAAC;SAC3E;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC5D,MAAM,MAAM,GAA2B;YACrC,MAAM,EAAE,oBAAoB;YAC5B,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,SAAS,EAAE,SAAS;YACpB,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAC;QACF,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;SAC7B;QACD,MAAM,IAAI,GAAG,MAAM,IAAA,cAAO,EAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC;IAC5C,CAAC;CACF;AAjFD,wCAiFC"}
|
||||
5
backend/node_modules/@alicloud/credentials/dist/src/provider/credentials_uri_provider.d.ts
generated
vendored
Normal file
5
backend/node_modules/@alicloud/credentials/dist/src/provider/credentials_uri_provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import ICredential from '../icredential';
|
||||
declare const _default: {
|
||||
getCredential(): ICredential;
|
||||
};
|
||||
export default _default;
|
||||
16
backend/node_modules/@alicloud/credentials/dist/src/provider/credentials_uri_provider.js
generated
vendored
Normal file
16
backend/node_modules/@alicloud/credentials/dist/src/provider/credentials_uri_provider.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const uri_credential_1 = __importDefault(require("../uri_credential"));
|
||||
exports.default = {
|
||||
getCredential() {
|
||||
const credentialsURI = process.env.ALIBABA_CLOUD_CREDENTIALS_URI;
|
||||
if (credentialsURI) {
|
||||
return new uri_credential_1.default(credentialsURI);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=credentials_uri_provider.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/provider/credentials_uri_provider.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/provider/credentials_uri_provider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"credentials_uri_provider.js","sourceRoot":"","sources":["../../../src/provider/credentials_uri_provider.ts"],"names":[],"mappings":";;;;;AAAA,uEAA8C;AAG9C,kBAAe;IACb,aAAa;QACX,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;QACjE,IAAI,cAAc,EAAE;YAClB,OAAO,IAAI,wBAAa,CAAC,cAAc,CAAC,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA"}
|
||||
5
backend/node_modules/@alicloud/credentials/dist/src/provider/environment_variable_credentials_provider.d.ts
generated
vendored
Normal file
5
backend/node_modules/@alicloud/credentials/dist/src/provider/environment_variable_credentials_provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import ICredential from '../icredential';
|
||||
declare const _default: {
|
||||
getCredential(): ICredential;
|
||||
};
|
||||
export default _default;
|
||||
23
backend/node_modules/@alicloud/credentials/dist/src/provider/environment_variable_credentials_provider.js
generated
vendored
Normal file
23
backend/node_modules/@alicloud/credentials/dist/src/provider/environment_variable_credentials_provider.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const access_key_credential_1 = __importDefault(require("../access_key_credential"));
|
||||
exports.default = {
|
||||
getCredential() {
|
||||
const accessKeyId = process.env.ALIBABA_CLOUD_ACCESS_KEY_ID;
|
||||
const accessKeySecret = process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET;
|
||||
if (accessKeyId === undefined || accessKeySecret === undefined) {
|
||||
return null;
|
||||
}
|
||||
if (accessKeyId === null || accessKeyId === '') {
|
||||
throw new Error('Environment variable ALIBABA_CLOUD_ACCESS_KEY_ID cannot be empty');
|
||||
}
|
||||
if (accessKeySecret === null || accessKeySecret === '') {
|
||||
throw new Error('Environment variable ALIBABA_CLOUD_ACCESS_KEY_SECRET cannot be empty');
|
||||
}
|
||||
return new access_key_credential_1.default(accessKeyId, accessKeySecret);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=environment_variable_credentials_provider.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/provider/environment_variable_credentials_provider.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/provider/environment_variable_credentials_provider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"environment_variable_credentials_provider.js","sourceRoot":"","sources":["../../../src/provider/environment_variable_credentials_provider.ts"],"names":[],"mappings":";;;;;AACA,qFAA2D;AAG3D,kBAAe;IACb,aAAa;QACX,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC;QAC5D,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC;QAEpE,IAAI,WAAW,KAAK,SAAS,IAAI,eAAe,KAAK,SAAS,EAAE;YAC9D,OAAO,IAAI,CAAC;SACb;QAED,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,KAAK,EAAE,EAAE;YAC9C,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;SACrF;QAED,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,EAAE,EAAE;YACtD,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;SACzF;QAED,OAAO,IAAI,+BAAmB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IAC/D,CAAC;CACF,CAAA"}
|
||||
5
backend/node_modules/@alicloud/credentials/dist/src/provider/instance_ram_role_credentials_provider.d.ts
generated
vendored
Normal file
5
backend/node_modules/@alicloud/credentials/dist/src/provider/instance_ram_role_credentials_provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import ICredential from '../icredential';
|
||||
declare const _default: {
|
||||
getCredential(): ICredential;
|
||||
};
|
||||
export default _default;
|
||||
17
backend/node_modules/@alicloud/credentials/dist/src/provider/instance_ram_role_credentials_provider.js
generated
vendored
Normal file
17
backend/node_modules/@alicloud/credentials/dist/src/provider/instance_ram_role_credentials_provider.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const ecs_ram_role_credential_1 = __importDefault(require("../ecs_ram_role_credential"));
|
||||
exports.default = {
|
||||
getCredential() {
|
||||
const roleName = process.env.ALIBABA_CLOUD_ECS_METADATA;
|
||||
const enableIMDSv2 = process.env.ALIBABA_CLOUD_ECS_IMDSV2_ENABLE;
|
||||
if (roleName && roleName.length) {
|
||||
return new ecs_ram_role_credential_1.default(roleName, {}, enableIMDSv2 && enableIMDSv2.toLowerCase() === 'true');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=instance_ram_role_credentials_provider.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/provider/instance_ram_role_credentials_provider.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/provider/instance_ram_role_credentials_provider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"instance_ram_role_credentials_provider.js","sourceRoot":"","sources":["../../../src/provider/instance_ram_role_credentials_provider.ts"],"names":[],"mappings":";;;;;AAIA,yFAA8D;AAE9D,kBAAe;IACb,aAAa;QACX,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;QACxD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC;QACjE,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,EAAE;YAC/B,OAAO,IAAI,iCAAoB,CAAC,QAAQ,EAAE,EAAE,EAAE,YAAY,IAAI,YAAY,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;SACtG;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA"}
|
||||
5
backend/node_modules/@alicloud/credentials/dist/src/provider/oidc_role_arn_credentials_provider.d.ts
generated
vendored
Normal file
5
backend/node_modules/@alicloud/credentials/dist/src/provider/oidc_role_arn_credentials_provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import ICredential from '../icredential';
|
||||
declare const _default: {
|
||||
getCredential(): ICredential;
|
||||
};
|
||||
export default _default;
|
||||
18
backend/node_modules/@alicloud/credentials/dist/src/provider/oidc_role_arn_credentials_provider.js
generated
vendored
Normal file
18
backend/node_modules/@alicloud/credentials/dist/src/provider/oidc_role_arn_credentials_provider.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const oidc_role_arn_credential_1 = __importDefault(require("../oidc_role_arn_credential"));
|
||||
const config_1 = __importDefault(require("../config"));
|
||||
exports.default = {
|
||||
getCredential() {
|
||||
if (process.env.ALIBABA_CLOUD_ROLE_ARN
|
||||
&& process.env.ALIBABA_CLOUD_OIDC_PROVIDER_ARN
|
||||
&& process.env.ALIBABA_CLOUD_OIDC_TOKEN_FILE) {
|
||||
return new oidc_role_arn_credential_1.default(new config_1.default({}));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=oidc_role_arn_credentials_provider.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/provider/oidc_role_arn_credentials_provider.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/provider/oidc_role_arn_credentials_provider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"oidc_role_arn_credentials_provider.js","sourceRoot":"","sources":["../../../src/provider/oidc_role_arn_credentials_provider.ts"],"names":[],"mappings":";;;;;AAIA,2FAAgE;AAChE,uDAA+B;AAE/B,kBAAe;IACb,aAAa;QACX,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB;eACjC,OAAO,CAAC,GAAG,CAAC,+BAA+B;eAC3C,OAAO,CAAC,GAAG,CAAC,6BAA6B,EAAE;YAC9C,OAAO,IAAI,kCAAqB,CAAC,IAAI,gBAAM,CAAC,EAAE,CAAC,CAAC,CAAC;SAClD;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAA"}
|
||||
5
backend/node_modules/@alicloud/credentials/dist/src/provider/profile_credentials_provider.d.ts
generated
vendored
Normal file
5
backend/node_modules/@alicloud/credentials/dist/src/provider/profile_credentials_provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import ICredential from '../icredential';
|
||||
declare const _default: {
|
||||
getCredential(credentialName?: string): ICredential;
|
||||
};
|
||||
export default _default;
|
||||
100
backend/node_modules/@alicloud/credentials/dist/src/provider/profile_credentials_provider.js
generated
vendored
Normal file
100
backend/node_modules/@alicloud/credentials/dist/src/provider/profile_credentials_provider.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const access_key_credential_1 = __importDefault(require("../access_key_credential"));
|
||||
const sts_token_credential_1 = __importDefault(require("../sts_token_credential"));
|
||||
const ecs_ram_role_credential_1 = __importDefault(require("../ecs_ram_role_credential"));
|
||||
const ram_role_arn_credential_1 = __importDefault(require("../ram_role_arn_credential"));
|
||||
const oidc_role_arn_credential_1 = __importDefault(require("../oidc_role_arn_credential"));
|
||||
const rsa_key_pair_credential_1 = __importDefault(require("../rsa_key_pair_credential"));
|
||||
const bearer_token_credential_1 = __importDefault(require("../bearer_token_credential"));
|
||||
const utils = __importStar(require("../util/utils"));
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const config_1 = __importDefault(require("../config"));
|
||||
const DEFAULT_PATH = process.env.HOME + '/.alibabacloud/credentials';
|
||||
exports.default = {
|
||||
getCredential(credentialName = 'default') {
|
||||
let fileContent = null;
|
||||
const credentialFile = process.env.ALIBABA_CLOUD_CREDENTIALS_FILE;
|
||||
if (credentialFile === undefined) {
|
||||
if (fs_1.default.existsSync(DEFAULT_PATH)) {
|
||||
const content = utils.parseFile(DEFAULT_PATH, true);
|
||||
if (content) {
|
||||
fileContent = content;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (credentialFile === null || credentialFile === '') {
|
||||
throw new Error('Environment variable credentialFile cannot be empty');
|
||||
}
|
||||
if (!fs_1.default.existsSync(credentialFile)) {
|
||||
throw new Error(`credentialFile ${credentialFile} cannot be empty`);
|
||||
}
|
||||
fileContent = utils.parseFile(credentialFile);
|
||||
}
|
||||
if (!fileContent) {
|
||||
return null;
|
||||
}
|
||||
const config = fileContent[credentialName] || {};
|
||||
if (!config.type) {
|
||||
throw new Error('Missing required type option in credentialFile');
|
||||
}
|
||||
switch (config.type) {
|
||||
case 'access_key':
|
||||
return new access_key_credential_1.default(config.access_key_id, config.access_key_secret);
|
||||
case 'sts':
|
||||
return new sts_token_credential_1.default(config.access_key_id, config.access_key_secret, config.security_token);
|
||||
case 'ecs_ram_role':
|
||||
return new ecs_ram_role_credential_1.default(config.role_name);
|
||||
case 'ram_role_arn': {
|
||||
const conf = new config_1.default({
|
||||
roleArn: config.role_arn,
|
||||
accessKeyId: config.access_key_id,
|
||||
accessKeySecret: config.access_key_secret
|
||||
});
|
||||
return new ram_role_arn_credential_1.default(conf);
|
||||
}
|
||||
case 'oidc_role_arn': {
|
||||
const conf = new config_1.default({
|
||||
roleArn: config.role_arn,
|
||||
oidcProviderArn: config.oidc_provider_arn,
|
||||
oidcTokenFilePath: config.oidc_token_file_path
|
||||
});
|
||||
return new oidc_role_arn_credential_1.default(conf);
|
||||
}
|
||||
case 'rsa_key_pair':
|
||||
return new rsa_key_pair_credential_1.default(config.public_key_id, config.private_key_file);
|
||||
case 'bearer':
|
||||
return new bearer_token_credential_1.default(config.bearer_token);
|
||||
default:
|
||||
throw new Error('Invalid type option, support: access_key, sts, ecs_ram_role, ram_role_arn, oidc_role_arn, rsa_key_pair, bearer');
|
||||
}
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=profile_credentials_provider.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/provider/profile_credentials_provider.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/provider/profile_credentials_provider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"profile_credentials_provider.js","sourceRoot":"","sources":["../../../src/provider/profile_credentials_provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qFAA2D;AAC3D,mFAAyD;AACzD,yFAA8D;AAC9D,yFAA8D;AAC9D,2FAAgE;AAChE,yFAA8D;AAC9D,yFAA+D;AAE/D,qDAAuC;AACvC,4CAAoB;AAEpB,uDAA+B;AAE/B,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,4BAA4B,CAAC;AAErE,kBAAe;IACb,aAAa,CAAC,iBAAyB,SAAS;QAC9C,IAAI,WAAW,GAAG,IAAI,CAAC;QACvB,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC;QAClE,IAAI,cAAc,KAAK,SAAS,EAAE;YAChC,IAAI,YAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;gBAC/B,MAAM,OAAO,GAAG,K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;gBACH,OAAO,IAAI,iCAAoB,CAAC,IAAI,CAAC,CAAC;aACvC;YACD,KAAK,eAAe,CAAC,CAAC;gBACpB,MAAM,IAAI,GAAG,IAAI,gBAAM,CAAC;oBACtB,OAAO,EAAE,MAAM,CAAC,QAAQ;oBACxB,eAAe,EAAE,MAAM,CAAC,iBAAiB;oBACzC,iBAAiB,EAAE,MAAM,CAAC,oBAAoB;iBAC/C,CAAC,CAAC;gBACH,OAAO,IAAI,kCAAqB,CAAC,IAAI,CAAC,CAAC;aACxC;YACD,KAAK,cAAc;gBACjB,OAAO,IAAI,iCAAoB,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACjF,KAAK,QAAQ;gBACX,OAAO,IAAI,iCAAqB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACxD;gBACE,MAAM,IAAI,KAAK,CAAC,gHAAgH,CAAC,CAAC;SACnI;IACH,CAAC;CACF,CAAA"}
|
||||
6
backend/node_modules/@alicloud/credentials/dist/src/provider/provider_chain.d.ts
generated
vendored
Normal file
6
backend/node_modules/@alicloud/credentials/dist/src/provider/provider_chain.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import ICredential from '../icredential';
|
||||
type IProvider = {
|
||||
getCredential: () => ICredential;
|
||||
};
|
||||
export declare function getCredentials(providers?: IProvider[]): ICredential;
|
||||
export {};
|
||||
30
backend/node_modules/@alicloud/credentials/dist/src/provider/provider_chain.js
generated
vendored
Normal file
30
backend/node_modules/@alicloud/credentials/dist/src/provider/provider_chain.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getCredentials = void 0;
|
||||
const environment_variable_credentials_provider_1 = __importDefault(require("./environment_variable_credentials_provider"));
|
||||
const profile_credentials_provider_1 = __importDefault(require("./profile_credentials_provider"));
|
||||
const instance_ram_role_credentials_provider_1 = __importDefault(require("./instance_ram_role_credentials_provider"));
|
||||
const credentials_uri_provider_1 = __importDefault(require("./credentials_uri_provider"));
|
||||
const oidc_role_arn_credentials_provider_1 = __importDefault(require("./oidc_role_arn_credentials_provider"));
|
||||
const defaultProviders = [
|
||||
environment_variable_credentials_provider_1.default,
|
||||
oidc_role_arn_credentials_provider_1.default,
|
||||
profile_credentials_provider_1.default,
|
||||
instance_ram_role_credentials_provider_1.default,
|
||||
credentials_uri_provider_1.default
|
||||
];
|
||||
function getCredentials(providers = null) {
|
||||
const providerChain = providers || defaultProviders;
|
||||
for (const provider of providerChain) {
|
||||
const credential = provider.getCredential();
|
||||
if (credential) {
|
||||
return credential;
|
||||
}
|
||||
}
|
||||
throw new Error('Not found credentials');
|
||||
}
|
||||
exports.getCredentials = getCredentials;
|
||||
//# sourceMappingURL=provider_chain.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/provider/provider_chain.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/provider/provider_chain.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"provider_chain.js","sourceRoot":"","sources":["../../../src/provider/provider_chain.ts"],"names":[],"mappings":";;;;;;AAAA,4HAAiG;AACjG,kGAAwE;AACxE,sHAA0F;AAC1F,0FAAgE;AAChE,8GAAkF;AAQlF,MAAM,gBAAgB,GAAiB;IACrC,mDAAsC;IACtC,4CAA8B;IAC9B,sCAA0B;IAC1B,gDAAkC;IAClC,kCAAsB;CACvB,CAAC;AAEF,SAAgB,cAAc,CAAC,YAAyB,IAAI;IAC1D,MAAM,aAAa,GAAG,SAAS,IAAI,gBAAgB,CAAC;IACpD,KAAK,MAAM,QAAQ,IAAI,aAAa,EAAE;QACpC,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC5C,IAAI,UAAU,EAAE;YACd,OAAO,UAAU,CAAC;SACnB;KACF;IAED,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAC3C,CAAC;AAVD,wCAUC"}
|
||||
43
backend/node_modules/@alicloud/credentials/dist/src/providers/cli_profile.d.ts
generated
vendored
Normal file
43
backend/node_modules/@alicloud/credentials/dist/src/providers/cli_profile.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import Credentials from '../credentials';
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
declare class CLIProfileCredentialsProviderBuilder {
|
||||
profileName: string;
|
||||
build(): CLIProfileCredentialsProvider;
|
||||
withProfileName(profileName: string): this;
|
||||
}
|
||||
interface Profile {
|
||||
name: string;
|
||||
mode: string;
|
||||
access_key_id: string;
|
||||
access_key_secret: string;
|
||||
sts_token: string;
|
||||
region_id: string;
|
||||
ram_role_arn: string;
|
||||
ram_session_name: string;
|
||||
expired_seconds: number;
|
||||
sts_region: string;
|
||||
source_profile: string;
|
||||
ram_role_name: string;
|
||||
oidc_token_file: string;
|
||||
oidc_provider_arn: string;
|
||||
sts_endpoint: string;
|
||||
enable_vpc: boolean;
|
||||
duration_seconds: number;
|
||||
}
|
||||
declare class Configuration {
|
||||
current: string;
|
||||
profiles: Profile[];
|
||||
}
|
||||
export declare function getConfiguration(cfgPath: string): Promise<Configuration>;
|
||||
export declare function getProfile(conf: Configuration, profileName: string): Profile;
|
||||
export default class CLIProfileCredentialsProvider implements CredentialsProvider {
|
||||
static builder(): CLIProfileCredentialsProviderBuilder;
|
||||
private readonly profileName;
|
||||
private innerProvider;
|
||||
private homedir;
|
||||
constructor(builder: CLIProfileCredentialsProviderBuilder);
|
||||
private getCredentialsProvider;
|
||||
getCredentials(): Promise<Credentials>;
|
||||
getProviderName(): string;
|
||||
}
|
||||
export {};
|
||||
157
backend/node_modules/@alicloud/credentials/dist/src/providers/cli_profile.js
generated
vendored
Normal file
157
backend/node_modules/@alicloud/credentials/dist/src/providers/cli_profile.js
generated
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getProfile = exports.getConfiguration = void 0;
|
||||
const fs_1 = require("fs");
|
||||
const util_1 = require("util");
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const credentials_1 = __importDefault(require("../credentials"));
|
||||
const static_ak_1 = __importDefault(require("./static_ak"));
|
||||
const static_sts_1 = __importDefault(require("./static_sts"));
|
||||
const ram_role_arn_1 = __importDefault(require("./ram_role_arn"));
|
||||
const oidc_role_arn_1 = __importDefault(require("./oidc_role_arn"));
|
||||
const ecs_ram_role_1 = __importDefault(require("./ecs_ram_role"));
|
||||
const readFileAsync = (0, util_1.promisify)(fs_1.readFile);
|
||||
class CLIProfileCredentialsProviderBuilder {
|
||||
build() {
|
||||
// 优先级:
|
||||
// 1. 使用显示指定的 profileName
|
||||
// 2. 使用环境变量(ALIBABA_CLOUD_PROFILE)制定的 profileName
|
||||
// 3. 使用 CLI 配置中的当前 profileName
|
||||
if (!this.profileName) {
|
||||
this.profileName = process.env.ALIBABA_CLOUD_PROFILE;
|
||||
}
|
||||
if (process.env.ALIBABA_CLOUD_CLI_PROFILE_DISABLED && process.env.ALIBABA_CLOUD_CLI_PROFILE_DISABLED.toLowerCase() === 'true') {
|
||||
throw new Error('the CLI profile is disabled');
|
||||
}
|
||||
return new CLIProfileCredentialsProvider(this);
|
||||
}
|
||||
withProfileName(profileName) {
|
||||
this.profileName = profileName;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
class Configuration {
|
||||
}
|
||||
async function getConfiguration(cfgPath) {
|
||||
let content;
|
||||
try {
|
||||
content = await readFileAsync(cfgPath, 'utf8');
|
||||
}
|
||||
catch (ex) {
|
||||
throw new Error(`reading aliyun cli config from '${cfgPath}' failed.`);
|
||||
}
|
||||
let conf;
|
||||
try {
|
||||
conf = JSON.parse(content);
|
||||
}
|
||||
catch (ex) {
|
||||
throw new Error(`parse aliyun cli config from '${cfgPath}' failed: ${content}`);
|
||||
}
|
||||
if (!conf || !conf.profiles || conf.profiles.length === 0) {
|
||||
throw new Error(`no any configured profiles in '${cfgPath}'`);
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
exports.getConfiguration = getConfiguration;
|
||||
function getProfile(conf, profileName) {
|
||||
for (const p of conf.profiles) {
|
||||
if (p.name === profileName) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
throw new Error(`unable to get profile with '${profileName}'`);
|
||||
}
|
||||
exports.getProfile = getProfile;
|
||||
class CLIProfileCredentialsProvider {
|
||||
static builder() {
|
||||
return new CLIProfileCredentialsProviderBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
// used for mock
|
||||
this.homedir = os_1.default.homedir();
|
||||
this.profileName = builder.profileName;
|
||||
}
|
||||
getCredentialsProvider(conf, profileName) {
|
||||
const p = getProfile(conf, profileName);
|
||||
switch (p.mode) {
|
||||
case 'AK':
|
||||
return static_ak_1.default.builder()
|
||||
.withAccessKeyId(p.access_key_id)
|
||||
.withAccessKeySecret(p.access_key_secret)
|
||||
.build();
|
||||
case 'StsToken':
|
||||
return static_sts_1.default.builder()
|
||||
.withAccessKeyId(p.access_key_id)
|
||||
.withAccessKeySecret(p.access_key_secret)
|
||||
.withSecurityToken(p.sts_token)
|
||||
.build();
|
||||
case 'RamRoleArn': {
|
||||
const previousProvider = static_ak_1.default.builder()
|
||||
.withAccessKeyId(p.access_key_id)
|
||||
.withAccessKeySecret(p.access_key_secret)
|
||||
.build();
|
||||
return ram_role_arn_1.default.builder()
|
||||
.withCredentialsProvider(previousProvider)
|
||||
.withRoleArn(p.ram_role_arn)
|
||||
.withRoleSessionName(p.ram_session_name)
|
||||
.withDurationSeconds(p.expired_seconds)
|
||||
.withStsRegionId(p.sts_region)
|
||||
.withStsEndpoint(p.sts_endpoint)
|
||||
.withEnableVpc(p.enable_vpc)
|
||||
.build();
|
||||
}
|
||||
case 'EcsRamRole':
|
||||
return ecs_ram_role_1.default.builder().withRoleName(p.ram_role_name).build();
|
||||
case 'OIDC':
|
||||
return oidc_role_arn_1.default.builder()
|
||||
.withOIDCTokenFilePath(p.oidc_token_file)
|
||||
.withOIDCProviderArn(p.oidc_provider_arn)
|
||||
.withRoleArn(p.ram_role_arn)
|
||||
.withStsRegionId(p.sts_region)
|
||||
.withDurationSeconds(p.expired_seconds)
|
||||
.withRoleSessionName(p.ram_session_name)
|
||||
.withDurationSeconds(p.duration_seconds)
|
||||
.withEnableVpc(p.enable_vpc)
|
||||
.build();
|
||||
case 'ChainableRamRoleArn': {
|
||||
const previousProvider = this.getCredentialsProvider(conf, p.source_profile);
|
||||
return ram_role_arn_1.default.builder()
|
||||
.withCredentialsProvider(previousProvider)
|
||||
.withRoleArn(p.ram_role_arn)
|
||||
.withRoleSessionName(p.ram_session_name)
|
||||
.withDurationSeconds(p.expired_seconds)
|
||||
.withStsRegionId(p.sts_region)
|
||||
.build();
|
||||
}
|
||||
default:
|
||||
throw new Error(`unsupported profile mode '${p.mode}'`);
|
||||
}
|
||||
}
|
||||
async getCredentials() {
|
||||
if (!this.innerProvider) {
|
||||
if (!this.homedir) {
|
||||
throw new Error('cannot found home dir');
|
||||
}
|
||||
const cfgPath = path_1.default.join(this.homedir, '.aliyun/config.json');
|
||||
const conf = await getConfiguration(cfgPath);
|
||||
const profileName = this.profileName || conf.current;
|
||||
this.innerProvider = this.getCredentialsProvider(conf, profileName);
|
||||
}
|
||||
const credentials = await this.innerProvider.getCredentials();
|
||||
return credentials_1.default.builder()
|
||||
.withAccessKeyId(credentials.accessKeyId)
|
||||
.withAccessKeySecret(credentials.accessKeySecret)
|
||||
.withSecurityToken(credentials.securityToken)
|
||||
.withProviderName(`${this.getProviderName()}/${this.innerProvider.getProviderName()}`)
|
||||
.build();
|
||||
}
|
||||
getProviderName() {
|
||||
return 'cli_profile';
|
||||
}
|
||||
}
|
||||
exports.default = CLIProfileCredentialsProvider;
|
||||
//# sourceMappingURL=cli_profile.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/cli_profile.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/cli_profile.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"cli_profile.js","sourceRoot":"","sources":["../../../src/providers/cli_profile.ts"],"names":[],"mappings":";;;;;;AAAA,2BAA8B;AAC9B,+BAAiC;AAEjC,gDAAwB;AACxB,4CAAoB;AACpB,iEAAyC;AAEzC,4DAAsD;AACtD,8DAAwD;AACxD,kEAA2D;AAC3D,oEAA6D;AAC7D,kEAA2D;AAE3D,MAAM,aAAa,GAAG,IAAA,gBAAS,EAAC,aAAQ,CAAC,CAAC;AAE1C,MAAM,oCAAoC;IAExC,KAAK;QACH,OAAO;QACP,yBAAyB;QACzB,kDAAkD;QAClD,+BAA+B;QAC/B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;SACtD;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,kCAAkC,IAAI,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE;YAC7H,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAChD;QAED,OAAO,IAAI,6BAA6B,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,eAAe,CAAC,WAAmB;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAsBD,MAAM,aAAa;CAGlB;AAEM,KAAK,UAAU,gBAAgB,CAAC,OAAe;IACpD,IAAI,OAAe,CAAC;IACpB,IAAI;QACF,OAAO,GAAG,MAAM,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAA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sBAAsB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;SACpE;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAA;QAC7D,OAAO,qBAAW,CAAC,OAAO,EAAE;aACzB,eAAe,CAAC,WAAW,CAAC,WAAW,CAAC;aACxC,mBAAmB,CAAC,WAAW,CAAC,eAAe,CAAC;aAChD,iBAAiB,CAAC,WAAW,CAAC,aAAa,CAAC;aAC5C,gBAAgB,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,IAAI,CAAC,aAAa,CAAC,eAAe,EAAE,EAAE,CAAC;aACrF,KAAK,EAAE,CAAC;IACb,CAAC;IAED,eAAe;QACb,OAAO,aAAa,CAAC;IACvB,CAAC;CAEF;AAlGD,gDAkGC"}
|
||||
14
backend/node_modules/@alicloud/credentials/dist/src/providers/default.d.ts
generated
vendored
Normal file
14
backend/node_modules/@alicloud/credentials/dist/src/providers/default.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import Credentials from '../credentials';
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
export default class DefaultCredentialsProvider implements CredentialsProvider {
|
||||
private readonly providers;
|
||||
private lastUsedProvider;
|
||||
static builder(): DefaultCredentialsProviderBuilder;
|
||||
constructor(builder: DefaultCredentialsProviderBuilder);
|
||||
getCredentials(): Promise<Credentials>;
|
||||
getProviderName(): string;
|
||||
}
|
||||
declare class DefaultCredentialsProviderBuilder {
|
||||
build(): DefaultCredentialsProvider;
|
||||
}
|
||||
export {};
|
||||
112
backend/node_modules/@alicloud/credentials/dist/src/providers/default.js
generated
vendored
Normal file
112
backend/node_modules/@alicloud/credentials/dist/src/providers/default.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const credentials_1 = __importDefault(require("../credentials"));
|
||||
const cli_profile_1 = __importDefault(require("./cli_profile"));
|
||||
const ecs_ram_role_1 = __importDefault(require("./ecs_ram_role"));
|
||||
const env_1 = __importDefault(require("./env"));
|
||||
const oidc_role_arn_1 = __importDefault(require("./oidc_role_arn"));
|
||||
const uri_1 = __importDefault(require("./uri"));
|
||||
const profile_1 = __importDefault(require("./profile"));
|
||||
class DefaultCredentialsProvider {
|
||||
static builder() {
|
||||
return new DefaultCredentialsProviderBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
this.providers = [];
|
||||
// Add static ak or sts credentials provider from env
|
||||
try {
|
||||
const envProvider = env_1.default.builder().build();
|
||||
this.providers.push(envProvider);
|
||||
}
|
||||
catch (ex) {
|
||||
// ignore
|
||||
}
|
||||
// oidc check
|
||||
try {
|
||||
const oidcProvider = oidc_role_arn_1.default.builder().build();
|
||||
this.providers.push(oidcProvider);
|
||||
}
|
||||
catch (ex) {
|
||||
// ignore
|
||||
}
|
||||
// cli credentials provider
|
||||
try {
|
||||
const cliProfileProvider = cli_profile_1.default.builder().build();
|
||||
this.providers.push(cliProfileProvider);
|
||||
}
|
||||
catch (ex) {
|
||||
// ignore
|
||||
}
|
||||
// profile credentials provider
|
||||
try {
|
||||
const profileProvider = profile_1.default.builder().build();
|
||||
this.providers.push(profileProvider);
|
||||
}
|
||||
catch (ex) {
|
||||
// ignore
|
||||
}
|
||||
// Add IMDS
|
||||
try {
|
||||
const ecsRamRoleProvider = ecs_ram_role_1.default.builder().withRoleName(process.env.ALIBABA_CLOUD_ECS_METADATA).build();
|
||||
this.providers.push(ecsRamRoleProvider);
|
||||
}
|
||||
catch (ex) {
|
||||
// ignore
|
||||
}
|
||||
// credentials uri
|
||||
try {
|
||||
const uriProvider = uri_1.default.builder().withCredentialsURI(process.env.ALIBABA_CLOUD_CREDENTIALS_URI).build();
|
||||
this.providers.push(uriProvider);
|
||||
}
|
||||
catch (ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
async getCredentials() {
|
||||
if (this.lastUsedProvider) {
|
||||
const inner = await this.lastUsedProvider.getCredentials();
|
||||
return credentials_1.default.builder()
|
||||
.withAccessKeyId(inner.accessKeyId)
|
||||
.withAccessKeySecret(inner.accessKeySecret)
|
||||
.withSecurityToken(inner.securityToken)
|
||||
.withProviderName(`${this.getProviderName()}/${this.lastUsedProvider.getProviderName()}`)
|
||||
.build();
|
||||
}
|
||||
const errors = [];
|
||||
for (const provider of this.providers) {
|
||||
this.lastUsedProvider = provider;
|
||||
let inner;
|
||||
try {
|
||||
inner = await provider.getCredentials();
|
||||
}
|
||||
catch (ex) {
|
||||
errors.push(ex);
|
||||
continue;
|
||||
}
|
||||
if (inner) {
|
||||
return credentials_1.default.builder()
|
||||
.withAccessKeyId(inner.accessKeyId)
|
||||
.withAccessKeySecret(inner.accessKeySecret)
|
||||
.withSecurityToken(inner.securityToken)
|
||||
.withProviderName(`${this.getProviderName()}/${this.lastUsedProvider.getProviderName()}`)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
throw new Error(`unable to get credentials from any of the providers in the chain: ${errors.map((e) => {
|
||||
return e.message;
|
||||
}).join(', ')}`);
|
||||
}
|
||||
getProviderName() {
|
||||
return 'default';
|
||||
}
|
||||
}
|
||||
exports.default = DefaultCredentialsProvider;
|
||||
class DefaultCredentialsProviderBuilder {
|
||||
build() {
|
||||
return new DefaultCredentialsProvider(this);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=default.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/default.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/default.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/providers/default.ts"],"names":[],"mappings":";;;;;AAAA,iEAAyC;AAEzC,gEAA0D;AAC1D,kEAA2D;AAC3D,gDAA2D;AAC3D,oEAA6D;AAC7D,gDAA2C;AAC3C,wDA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AC,KAAK,CAAC,aAAa,CAAC;qBACtC,gBAAgB,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,IAAI,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,EAAE,CAAC;qBACxF,KAAK,EAAE,CAAC;aACZ;SACF;QAED,MAAM,IAAI,KAAK,CAAC,qEAAqE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACpG,OAAO,CAAC,CAAC,OAAO,CAAC;QACnB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;IAED,eAAe;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAlGD,6CAkGC;AAED,MAAM,iCAAiC;IACrC,KAAK;QACH,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
||||
35
backend/node_modules/@alicloud/credentials/dist/src/providers/ecs_ram_role.d.ts
generated
vendored
Normal file
35
backend/node_modules/@alicloud/credentials/dist/src/providers/ecs_ram_role.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/// <reference types="node" />
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
import { SessionCredentialProvider } from './session';
|
||||
export default class ECSRAMRoleCredentialsProvider extends SessionCredentialProvider implements CredentialsProvider {
|
||||
private readonly roleName;
|
||||
private readonly disableIMDSv1;
|
||||
private checker;
|
||||
private doRequest;
|
||||
private readonly readTimeout;
|
||||
private readonly connectTimeout;
|
||||
private shouldRefreshCred;
|
||||
static builder(): ECSRAMRoleCredentialsProviderBuilder;
|
||||
constructor(builder: ECSRAMRoleCredentialsProviderBuilder);
|
||||
checkCredentialsUpdateAsynchronously(): NodeJS.Timeout;
|
||||
close(): void;
|
||||
private getMetadataToken;
|
||||
private getRoleName;
|
||||
private getCredentialsInternal;
|
||||
getProviderName(): string;
|
||||
}
|
||||
declare class ECSRAMRoleCredentialsProviderBuilder {
|
||||
roleName: string;
|
||||
disableIMDSv1: boolean;
|
||||
readTimeout?: number;
|
||||
connectTimeout?: number;
|
||||
asyncCredentialUpdateEnabled?: boolean;
|
||||
constructor();
|
||||
withRoleName(roleName: string): ECSRAMRoleCredentialsProviderBuilder;
|
||||
withDisableIMDSv1(disableIMDSv1: boolean): ECSRAMRoleCredentialsProviderBuilder;
|
||||
withReadTimeout(readTimeout: number): ECSRAMRoleCredentialsProviderBuilder;
|
||||
withConnectTimeout(connectTimeout: number): ECSRAMRoleCredentialsProviderBuilder;
|
||||
withAsyncCredentialUpdateEnabled(asyncCredentialUpdateEnabled: boolean): ECSRAMRoleCredentialsProviderBuilder;
|
||||
build(): ECSRAMRoleCredentialsProvider;
|
||||
}
|
||||
export {};
|
||||
187
backend/node_modules/@alicloud/credentials/dist/src/providers/ecs_ram_role.js
generated
vendored
Normal file
187
backend/node_modules/@alicloud/credentials/dist/src/providers/ecs_ram_role.js
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const http_1 = require("./http");
|
||||
const session_1 = require("./session");
|
||||
const PREFETCH_TIME = 60 * 60;
|
||||
const defaultMetadataTokenDuration = 21600; // 6 hours
|
||||
class ECSRAMRoleCredentialsProvider extends session_1.SessionCredentialProvider {
|
||||
static builder() {
|
||||
return new ECSRAMRoleCredentialsProviderBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
super(session_1.STALE_TIME, PREFETCH_TIME);
|
||||
// for mock
|
||||
this.doRequest = http_1.doRequest;
|
||||
this.refresher = this.getCredentialsInternal;
|
||||
this.roleName = builder.roleName;
|
||||
this.disableIMDSv1 = builder.disableIMDSv1;
|
||||
this.readTimeout = builder.readTimeout;
|
||||
this.connectTimeout = builder.connectTimeout;
|
||||
this.checker = null;
|
||||
this.shouldRefreshCred = false;
|
||||
if (builder.asyncCredentialUpdateEnabled) {
|
||||
this.checker = this.checkCredentialsUpdateAsynchronously();
|
||||
}
|
||||
}
|
||||
checkCredentialsUpdateAsynchronously() {
|
||||
return setTimeout(async () => {
|
||||
try {
|
||||
if (this.shouldRefreshCred) {
|
||||
await this.getCredentials();
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.error('CheckCredentialsUpdateAsynchronously Error:', err);
|
||||
}
|
||||
finally {
|
||||
this.checker = this.checkCredentialsUpdateAsynchronously();
|
||||
}
|
||||
}, 1000 * 60);
|
||||
}
|
||||
close() {
|
||||
if (this.checker != null) {
|
||||
clearTimeout(this.checker);
|
||||
this.checker = null;
|
||||
}
|
||||
}
|
||||
async getMetadataToken() {
|
||||
// PUT http://100.100.100.200/latest/api/token
|
||||
const request = http_1.Request.builder()
|
||||
.withMethod('PUT')
|
||||
.withProtocol('http')
|
||||
.withHost('100.100.100.200')
|
||||
.withPath('/latest/api/token')
|
||||
.withHeaders({
|
||||
'x-aliyun-ecs-metadata-token-ttl-seconds': `${defaultMetadataTokenDuration}`
|
||||
})
|
||||
.withReadTimeout(this.readTimeout || 1000)
|
||||
.withConnectTimeout(this.connectTimeout || 1000)
|
||||
.build();
|
||||
// ConnectTimeout: 5 * time.Second,
|
||||
// ReadTimeout: 5 * time.Second,
|
||||
try {
|
||||
const response = await this.doRequest(request);
|
||||
if (response.statusCode !== 200) {
|
||||
throw new Error(`get metadata token failed with ${response.statusCode}`);
|
||||
}
|
||||
return response.body.toString('utf8');
|
||||
}
|
||||
catch (error) {
|
||||
if (this.disableIMDSv1) {
|
||||
throw error;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
async getRoleName() {
|
||||
const builder = http_1.Request.builder()
|
||||
.withMethod('GET')
|
||||
.withProtocol('http')
|
||||
.withHost('100.100.100.200')
|
||||
.withPath('/latest/meta-data/ram/security-credentials/')
|
||||
.withReadTimeout(this.readTimeout || 1000)
|
||||
.withConnectTimeout(this.connectTimeout || 1000);
|
||||
const metadataToken = await this.getMetadataToken();
|
||||
if (metadataToken !== null) {
|
||||
builder.withHeaders({
|
||||
'x-aliyun-ecs-metadata-token': metadataToken
|
||||
});
|
||||
}
|
||||
// ConnectTimeout: 5 * time.Second,
|
||||
// ReadTimeout: 5 * time.Second,
|
||||
const request = builder.build();
|
||||
const response = await this.doRequest(request);
|
||||
if (response.statusCode !== 200) {
|
||||
throw new Error(`get role name failed: ${request.method} ${request.toRequestURL()} ${response.statusCode}`);
|
||||
}
|
||||
return response.body.toString().trim();
|
||||
}
|
||||
async getCredentialsInternal() {
|
||||
let roleName = this.roleName;
|
||||
if (!roleName) {
|
||||
roleName = await this.getRoleName();
|
||||
}
|
||||
const builder = http_1.Request.builder()
|
||||
.withMethod('GET')
|
||||
.withProtocol('http')
|
||||
.withHost('100.100.100.200')
|
||||
.withPath(`/latest/meta-data/ram/security-credentials/${roleName}`)
|
||||
.withReadTimeout(this.readTimeout || 1000)
|
||||
.withConnectTimeout(this.connectTimeout || 1000);
|
||||
// ConnectTimeout: 5 * time.Second,
|
||||
// ReadTimeout: 5 * time.Second,
|
||||
// Headers: map[string]string{ },
|
||||
const metadataToken = await this.getMetadataToken();
|
||||
if (metadataToken !== null) {
|
||||
builder.withHeaders({
|
||||
'x-aliyun-ecs-metadata-token': metadataToken
|
||||
});
|
||||
}
|
||||
const request = builder.build();
|
||||
const response = await this.doRequest(request);
|
||||
if (response.statusCode !== 200) {
|
||||
throw new Error(`get sts token failed, httpStatus: ${response.statusCode}, message = ${response.body.toString()}`);
|
||||
}
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(response.body.toString());
|
||||
}
|
||||
catch (ex) {
|
||||
throw new Error(`get sts token failed, json parse failed: ${ex.message}`);
|
||||
}
|
||||
if (!data || !data.AccessKeyId || !data.AccessKeySecret || !data.SecurityToken) {
|
||||
throw new Error('get sts token failed');
|
||||
}
|
||||
if (data.Code !== 'Success') {
|
||||
throw new Error('refresh Ecs sts token err, Code is not Success');
|
||||
}
|
||||
this.shouldRefreshCred = true;
|
||||
return new session_1.Session(data.AccessKeyId, data.AccessKeySecret, data.SecurityToken, data.Expiration);
|
||||
}
|
||||
getProviderName() {
|
||||
return 'ecs_ram_role';
|
||||
}
|
||||
}
|
||||
exports.default = ECSRAMRoleCredentialsProvider;
|
||||
class ECSRAMRoleCredentialsProviderBuilder {
|
||||
constructor() {
|
||||
this.disableIMDSv1 = false;
|
||||
this.asyncCredentialUpdateEnabled = false;
|
||||
}
|
||||
withRoleName(roleName) {
|
||||
this.roleName = roleName;
|
||||
return this;
|
||||
}
|
||||
withDisableIMDSv1(disableIMDSv1) {
|
||||
this.disableIMDSv1 = disableIMDSv1;
|
||||
return this;
|
||||
}
|
||||
withReadTimeout(readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
return this;
|
||||
}
|
||||
withConnectTimeout(connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
return this;
|
||||
}
|
||||
withAsyncCredentialUpdateEnabled(asyncCredentialUpdateEnabled) {
|
||||
this.asyncCredentialUpdateEnabled = asyncCredentialUpdateEnabled;
|
||||
return this;
|
||||
}
|
||||
build() {
|
||||
// 允许通过环境变量强制关闭 IMDS
|
||||
if (process.env.ALIBABA_CLOUD_ECS_METADATA_DISABLED && process.env.ALIBABA_CLOUD_ECS_METADATA_DISABLED.toLowerCase() === 'true') {
|
||||
throw new Error('IMDS credentials is disabled');
|
||||
}
|
||||
// 设置 roleName 默认值
|
||||
if (!this.roleName) {
|
||||
this.roleName = process.env.ALIBABA_CLOUD_ECS_METADATA;
|
||||
}
|
||||
// 允许通过环境变量强制关闭 V1
|
||||
if (process.env.ALIBABA_CLOUD_IMDSV1_DISABLED && process.env.ALIBABA_CLOUD_IMDSV1_DISABLED.toLowerCase() === 'true') {
|
||||
this.disableIMDSv1 = true;
|
||||
}
|
||||
return new ECSRAMRoleCredentialsProvider(this);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=ecs_ram_role.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/ecs_ram_role.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/ecs_ram_role.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
backend/node_modules/@alicloud/credentials/dist/src/providers/env.d.ts
generated
vendored
Normal file
12
backend/node_modules/@alicloud/credentials/dist/src/providers/env.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import Credentials from '../credentials';
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
export default class EnvironmentVariableCredentialsProvider implements CredentialsProvider {
|
||||
static builder(): EnvironmentVariableCredentialsProviderBuilder;
|
||||
getCredentials(): Promise<Credentials>;
|
||||
getProviderName(): string;
|
||||
constructor(builder: EnvironmentVariableCredentialsProviderBuilder);
|
||||
}
|
||||
declare class EnvironmentVariableCredentialsProviderBuilder {
|
||||
build(): EnvironmentVariableCredentialsProvider;
|
||||
}
|
||||
export {};
|
||||
40
backend/node_modules/@alicloud/credentials/dist/src/providers/env.js
generated
vendored
Normal file
40
backend/node_modules/@alicloud/credentials/dist/src/providers/env.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const credentials_1 = __importDefault(require("../credentials"));
|
||||
class EnvironmentVariableCredentialsProvider {
|
||||
static builder() {
|
||||
return new EnvironmentVariableCredentialsProviderBuilder();
|
||||
}
|
||||
async getCredentials() {
|
||||
const accessKeyId = process.env.ALIBABA_CLOUD_ACCESS_KEY_ID;
|
||||
if (!accessKeyId) {
|
||||
throw new Error('unable to get credentials from enviroment variables, Access key ID must be specified via environment variable (ALIBABA_CLOUD_ACCESS_KEY_ID)');
|
||||
}
|
||||
const accessKeySecret = process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET;
|
||||
if (!accessKeySecret) {
|
||||
throw new Error('unable to get credentials from enviroment variables, Access key secret must be specified via environment variable (ALIBABA_CLOUD_ACCESS_KEY_SECRET)');
|
||||
}
|
||||
const securityToken = process.env.ALIBABA_CLOUD_SECURITY_TOKEN;
|
||||
return credentials_1.default.builder()
|
||||
.withAccessKeyId(accessKeyId)
|
||||
.withAccessKeySecret(accessKeySecret)
|
||||
.withSecurityToken(securityToken)
|
||||
.withProviderName(this.getProviderName())
|
||||
.build();
|
||||
}
|
||||
getProviderName() {
|
||||
return 'env';
|
||||
}
|
||||
constructor(builder) {
|
||||
}
|
||||
}
|
||||
exports.default = EnvironmentVariableCredentialsProvider;
|
||||
class EnvironmentVariableCredentialsProviderBuilder {
|
||||
build() {
|
||||
return new EnvironmentVariableCredentialsProvider(this);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=env.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/env.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/env.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/providers/env.ts"],"names":[],"mappings":";;;;;AAAA,iEAAyC;AAGzC,MAAqB,sCAAsC;IACzD,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,6CAA6C,EAAE,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC;QAC5D,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,6IAA6I,CAAC,CAAA;SAC/J;QAED,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC;QACpE,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,qJAAqJ,CAAC,CAAA;SACvK;QAED,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC;QAE/D,OAAO,qBAAW,CAAC,OAAO,EAAE;aACzB,eAAe,CAAC,WAAW,CAAC;aAC5B,mBAAmB,CAAC,eAAe,CAAC;aACpC,iBAAiB,CAAC,aAAa,CAAC;aAChC,gBAAgB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;aACxC,KAAK,EAAE,CAAC;IACb,CAAC;IAGD,eAAe;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IAED,YAAY,OAAsD;IAElE,CAAC;CACF;AAlCD,yDAkCC;AAED,MAAM,6CAA6C;IACjD,KAAK;QACH,OAAO,IAAI,sCAAsC,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;CACF"}
|
||||
85
backend/node_modules/@alicloud/credentials/dist/src/providers/http.d.ts
generated
vendored
Normal file
85
backend/node_modules/@alicloud/credentials/dist/src/providers/http.d.ts
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
export declare class Request {
|
||||
readonly queries: {
|
||||
[key: string]: string;
|
||||
};
|
||||
readonly headers: {
|
||||
[key: string]: string;
|
||||
};
|
||||
readonly method: string;
|
||||
readonly protocol: any;
|
||||
readonly host: any;
|
||||
readonly path: any;
|
||||
readonly bodyForm: {
|
||||
[key: string]: string;
|
||||
};
|
||||
readonly bodyBytes: Buffer;
|
||||
readonly url: string;
|
||||
readonly readTimeout: number;
|
||||
readonly connectTimeout: number;
|
||||
static builder(): RequestBuilder;
|
||||
constructor(builder: RequestBuilder);
|
||||
toRequestURL(): string;
|
||||
}
|
||||
export declare class RequestBuilder {
|
||||
method: string;
|
||||
protocol: string;
|
||||
host: string;
|
||||
path: string;
|
||||
queries: {
|
||||
[key: string]: string;
|
||||
};
|
||||
headers: {
|
||||
[key: string]: string;
|
||||
};
|
||||
bodyForm: {
|
||||
[key: string]: string;
|
||||
};
|
||||
bodyBytes: Buffer;
|
||||
readTimeout: number;
|
||||
connectTimeout: number;
|
||||
url: string;
|
||||
build(): Request;
|
||||
withMethod(method: string): this;
|
||||
withProtocol(protocol: string): this;
|
||||
withHost(host: string): this;
|
||||
withPath(path: string): this;
|
||||
withQueries(queries: {
|
||||
[key: string]: string;
|
||||
}): this;
|
||||
withHeaders(headers: {
|
||||
[key: string]: string;
|
||||
}): this;
|
||||
withBodyForm(bodyForm: {
|
||||
[key: string]: string;
|
||||
}): this;
|
||||
withURL(url: string): this;
|
||||
withReadTimeout(readTimeout: number): this;
|
||||
withConnectTimeout(connectTimeout: number): this;
|
||||
}
|
||||
export declare class Response {
|
||||
readonly statusCode: number;
|
||||
readonly body: Buffer;
|
||||
readonly headers: {
|
||||
[key: string]: string;
|
||||
};
|
||||
static builder(): ResponseBuilder;
|
||||
constructor(builder: ResponseBuilder);
|
||||
}
|
||||
declare class ResponseBuilder {
|
||||
statusCode: number;
|
||||
headers: {
|
||||
[key: string]: string;
|
||||
};
|
||||
body: Buffer;
|
||||
withStatusCode(statusCode: number): this;
|
||||
withHeaders(headers: {
|
||||
[key: string]: string;
|
||||
}): this;
|
||||
withBody(body: Buffer): this;
|
||||
constructor();
|
||||
build(): Response;
|
||||
}
|
||||
export declare function doRequest(req: Request): Promise<Response>;
|
||||
export {};
|
||||
158
backend/node_modules/@alicloud/credentials/dist/src/providers/http.js
generated
vendored
Normal file
158
backend/node_modules/@alicloud/credentials/dist/src/providers/http.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.doRequest = exports.Response = exports.RequestBuilder = exports.Request = void 0;
|
||||
const httpx_1 = __importDefault(require("httpx"));
|
||||
class Request {
|
||||
static builder() {
|
||||
return new RequestBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
this.method = builder.method;
|
||||
this.protocol = builder.protocol;
|
||||
this.host = builder.host;
|
||||
this.path = builder.path;
|
||||
this.queries = builder.queries;
|
||||
this.headers = builder.headers;
|
||||
this.bodyForm = builder.bodyForm;
|
||||
this.bodyBytes = builder.bodyBytes;
|
||||
this.url = builder.url;
|
||||
this.readTimeout = builder.readTimeout;
|
||||
this.connectTimeout = builder.connectTimeout;
|
||||
}
|
||||
toRequestURL() {
|
||||
if (this.url) {
|
||||
return this.url;
|
||||
}
|
||||
let url = `${this.protocol}://${this.host}${this.path}`;
|
||||
if (this.queries && Object.keys(this.queries).length > 0) {
|
||||
url += `?` + querystringify(this.queries);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
exports.Request = Request;
|
||||
class RequestBuilder {
|
||||
build() {
|
||||
// set default values
|
||||
if (!this.protocol) {
|
||||
this.protocol = 'https';
|
||||
}
|
||||
if (!this.path) {
|
||||
this.path = '/';
|
||||
}
|
||||
if (!this.headers) {
|
||||
this.headers = {};
|
||||
}
|
||||
if (!this.queries) {
|
||||
this.queries = {};
|
||||
}
|
||||
return new Request(this);
|
||||
}
|
||||
withMethod(method) {
|
||||
this.method = method;
|
||||
return this;
|
||||
}
|
||||
withProtocol(protocol) {
|
||||
this.protocol = protocol;
|
||||
return this;
|
||||
}
|
||||
withHost(host) {
|
||||
this.host = host;
|
||||
return this;
|
||||
}
|
||||
withPath(path) {
|
||||
this.path = path;
|
||||
return this;
|
||||
}
|
||||
withQueries(queries) {
|
||||
this.queries = queries;
|
||||
return this;
|
||||
}
|
||||
withHeaders(headers) {
|
||||
this.headers = headers;
|
||||
return this;
|
||||
}
|
||||
withBodyForm(bodyForm) {
|
||||
this.bodyForm = bodyForm;
|
||||
return this;
|
||||
}
|
||||
withURL(url) {
|
||||
this.url = url;
|
||||
return this;
|
||||
}
|
||||
withReadTimeout(readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
return this;
|
||||
}
|
||||
withConnectTimeout(connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
exports.RequestBuilder = RequestBuilder;
|
||||
class Response {
|
||||
static builder() {
|
||||
return new ResponseBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
this.statusCode = builder.statusCode;
|
||||
this.headers = builder.headers;
|
||||
this.body = builder.body;
|
||||
}
|
||||
}
|
||||
exports.Response = Response;
|
||||
class ResponseBuilder {
|
||||
withStatusCode(statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
return this;
|
||||
}
|
||||
withHeaders(headers) {
|
||||
this.headers = headers;
|
||||
return this;
|
||||
}
|
||||
withBody(body) {
|
||||
this.body = body;
|
||||
return this;
|
||||
}
|
||||
constructor() {
|
||||
this.headers = {};
|
||||
}
|
||||
build() {
|
||||
return new Response(this);
|
||||
}
|
||||
}
|
||||
function querystringify(queries) {
|
||||
const fields = [];
|
||||
for (const [key, value] of Object.entries(queries)) {
|
||||
fields.push(key + '=' + encodeURIComponent(value));
|
||||
}
|
||||
return fields.join('&');
|
||||
}
|
||||
async function doRequest(req) {
|
||||
const url = req.toRequestURL();
|
||||
let body;
|
||||
if (req.bodyForm && Object.keys(req.bodyForm).length > 0) {
|
||||
body = querystringify(req.bodyForm);
|
||||
if (!req.headers['Content-Type']) {
|
||||
req.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
}
|
||||
const response = await httpx_1.default.request(url, {
|
||||
method: req.method,
|
||||
data: body,
|
||||
headers: req.headers,
|
||||
readTimeout: req.readTimeout,
|
||||
connectTimeout: req.connectTimeout
|
||||
});
|
||||
const responseBody = await httpx_1.default.read(response, '');
|
||||
return Response.builder()
|
||||
.withStatusCode(response.statusCode)
|
||||
.withHeaders(response.headers)
|
||||
.withBody(responseBody)
|
||||
.build();
|
||||
}
|
||||
exports.doRequest = doRequest;
|
||||
//# sourceMappingURL=http.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/http.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/http.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/providers/http.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0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KACpD;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAEM,KAAK,UAAU,SAAS,CAAC,GAAY;IAC1C,MAAM,GAAG,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC;IAE/B,IAAI,IAAI,CAAC;IACT,IAAI,GAAG,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QACxD,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;YAChC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,mCAAmC,CAAC;SACnE;KACF;IAED,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,cAAc,EAAE,GAAG,CAAC,cAAc;KACnC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACpD,OAAO,QAAQ,CAAC,OAAO,EAAE;SACtB,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC;SACnC,WAAW,CAAC,QAAQ,CAAC,OAAoC,CAAC;SAC1D,QAAQ,CAAC,YAAsB,CAAC;SAChC,KAAK,EAAE,CAAC;AACb,CAAC;AAzBD,8BAyBC"}
|
||||
48
backend/node_modules/@alicloud/credentials/dist/src/providers/oidc_role_arn.d.ts
generated
vendored
Normal file
48
backend/node_modules/@alicloud/credentials/dist/src/providers/oidc_role_arn.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
import { Session, SessionCredentialProvider } from './session';
|
||||
declare class OIDCRoleArnCredentialsProviderBuilder {
|
||||
oidcProviderArn: any;
|
||||
oidcTokenFilePath: any;
|
||||
roleArn: any;
|
||||
roleSessionName: string;
|
||||
stsEndpoint: string;
|
||||
stsRegionId: string;
|
||||
policy: string;
|
||||
durationSeconds: number;
|
||||
enableVpc?: boolean;
|
||||
readTimeout?: number;
|
||||
connectTimeout?: number;
|
||||
withOIDCProviderArn(oidcProviderArn: string): this;
|
||||
withOIDCTokenFilePath(path: string): this;
|
||||
withRoleArn(roleArn: string): this;
|
||||
withRoleSessionName(roleSessionName: string): this;
|
||||
withDurationSeconds(durationSeconds: number): this;
|
||||
withStsEndpoint(stsEndpoint: string): this;
|
||||
withStsRegionId(regionId: string): this;
|
||||
withPolicy(policy: string): this;
|
||||
withEnableVpc(enableVpc: boolean): OIDCRoleArnCredentialsProviderBuilder;
|
||||
withReadTimeout(readTimeout: number): OIDCRoleArnCredentialsProviderBuilder;
|
||||
withConnectTimeout(connectTimeout: number): OIDCRoleArnCredentialsProviderBuilder;
|
||||
build(): OIDCRoleArnCredentialsProvider;
|
||||
}
|
||||
export default class OIDCRoleArnCredentialsProvider extends SessionCredentialProvider implements CredentialsProvider {
|
||||
private readonly roleArn;
|
||||
private readonly oidcProviderArn;
|
||||
private readonly oidcTokenFilePath;
|
||||
private readonly policy;
|
||||
private readonly durationSeconds;
|
||||
private readonly roleSessionName;
|
||||
runtime: {
|
||||
[key: string]: any;
|
||||
};
|
||||
private readonly stsEndpoint;
|
||||
private doRequest;
|
||||
private readonly readTimeout;
|
||||
private readonly connectTimeout;
|
||||
lastUpdateTimestamp: number;
|
||||
static builder(): OIDCRoleArnCredentialsProviderBuilder;
|
||||
constructor(builder: OIDCRoleArnCredentialsProviderBuilder);
|
||||
getProviderName(): string;
|
||||
getCredentialsInternal(): Promise<Session>;
|
||||
}
|
||||
export {};
|
||||
201
backend/node_modules/@alicloud/credentials/dist/src/providers/oidc_role_arn.js
generated
vendored
Normal file
201
backend/node_modules/@alicloud/credentials/dist/src/providers/oidc_role_arn.js
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs_1 = require("fs");
|
||||
const util_1 = require("util");
|
||||
const session_1 = require("./session");
|
||||
const utils = __importStar(require("../util/utils"));
|
||||
const http_1 = require("./http");
|
||||
const readFileAsync = (0, util_1.promisify)(fs_1.readFile);
|
||||
class OIDCRoleArnCredentialsProviderBuilder {
|
||||
withOIDCProviderArn(oidcProviderArn) {
|
||||
this.oidcProviderArn = oidcProviderArn;
|
||||
return this;
|
||||
}
|
||||
withOIDCTokenFilePath(path) {
|
||||
this.oidcTokenFilePath = path;
|
||||
return this;
|
||||
}
|
||||
withRoleArn(roleArn) {
|
||||
this.roleArn = roleArn;
|
||||
return this;
|
||||
}
|
||||
withRoleSessionName(roleSessionName) {
|
||||
this.roleSessionName = roleSessionName;
|
||||
return this;
|
||||
}
|
||||
withDurationSeconds(durationSeconds) {
|
||||
this.durationSeconds = durationSeconds;
|
||||
return this;
|
||||
}
|
||||
withStsEndpoint(stsEndpoint) {
|
||||
this.stsEndpoint = stsEndpoint;
|
||||
return this;
|
||||
}
|
||||
withStsRegionId(regionId) {
|
||||
this.stsRegionId = regionId;
|
||||
return this;
|
||||
}
|
||||
withPolicy(policy) {
|
||||
this.policy = policy;
|
||||
return this;
|
||||
}
|
||||
withEnableVpc(enableVpc) {
|
||||
this.enableVpc = enableVpc;
|
||||
return this;
|
||||
}
|
||||
withReadTimeout(readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
return this;
|
||||
}
|
||||
withConnectTimeout(connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
return this;
|
||||
}
|
||||
build() {
|
||||
// set default values
|
||||
if (!this.oidcProviderArn) {
|
||||
this.oidcProviderArn = process.env.ALIBABA_CLOUD_OIDC_PROVIDER_ARN;
|
||||
}
|
||||
if (!this.oidcTokenFilePath) {
|
||||
this.oidcTokenFilePath = process.env.ALIBABA_CLOUD_OIDC_TOKEN_FILE;
|
||||
}
|
||||
if (!this.roleSessionName) {
|
||||
this.roleSessionName = process.env.ALIBABA_CLOUD_ROLE_SESSION_NAME;
|
||||
}
|
||||
if (!this.durationSeconds) {
|
||||
this.durationSeconds = 3600;
|
||||
}
|
||||
if (!this.roleArn) {
|
||||
this.roleArn = process.env.ALIBABA_CLOUD_ROLE_ARN;
|
||||
}
|
||||
if (!this.roleArn) {
|
||||
throw new Error('roleArn does not exist and env ALIBABA_CLOUD_ROLE_ARN is null.');
|
||||
}
|
||||
if (!this.oidcProviderArn) {
|
||||
throw new Error('oidcProviderArn does not exist and env ALIBABA_CLOUD_OIDC_PROVIDER_ARN is null.');
|
||||
}
|
||||
if (!this.oidcTokenFilePath) {
|
||||
throw new Error('oidcTokenFilePath is not exists and env ALIBABA_CLOUD_OIDC_TOKEN_FILE is null.');
|
||||
}
|
||||
if (!this.roleSessionName) {
|
||||
this.roleSessionName = 'credentials-nodejs-' + Date.now();
|
||||
}
|
||||
if (this.durationSeconds < 900) {
|
||||
throw new Error('session duration should be in the range of 900s - max session duration');
|
||||
}
|
||||
if (!this.stsRegionId) {
|
||||
this.stsRegionId = process.env.ALIBABA_CLOUD_STS_REGION;
|
||||
}
|
||||
if (!this.enableVpc) {
|
||||
this.enableVpc = process.env.ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED && process.env.ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED.toLowerCase() === 'true' || false;
|
||||
}
|
||||
// sts endpoint
|
||||
if (!this.stsEndpoint) {
|
||||
if (this.stsRegionId) {
|
||||
if (this.enableVpc) {
|
||||
this.stsEndpoint = `sts-vpc.${this.stsRegionId}.aliyuncs.com`;
|
||||
}
|
||||
else {
|
||||
this.stsEndpoint = `sts.${this.stsRegionId}.aliyuncs.com`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.stsEndpoint = 'sts.aliyuncs.com';
|
||||
}
|
||||
}
|
||||
return new OIDCRoleArnCredentialsProvider(this);
|
||||
}
|
||||
}
|
||||
class OIDCRoleArnCredentialsProvider extends session_1.SessionCredentialProvider {
|
||||
static builder() {
|
||||
return new OIDCRoleArnCredentialsProviderBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
super(session_1.STALE_TIME);
|
||||
this.doRequest = http_1.doRequest;
|
||||
this.refresher = this.getCredentialsInternal;
|
||||
this.roleArn = builder.roleArn;
|
||||
this.oidcProviderArn = builder.oidcProviderArn;
|
||||
this.oidcTokenFilePath = builder.oidcTokenFilePath;
|
||||
this.policy = builder.policy;
|
||||
this.durationSeconds = builder.durationSeconds;
|
||||
this.roleSessionName = builder.roleSessionName;
|
||||
this.stsEndpoint = builder.stsEndpoint;
|
||||
this.readTimeout = builder.readTimeout;
|
||||
this.connectTimeout = builder.connectTimeout;
|
||||
// used for mock
|
||||
this.doRequest = http_1.doRequest;
|
||||
}
|
||||
getProviderName() {
|
||||
return 'oidc_role_arn';
|
||||
}
|
||||
async getCredentialsInternal() {
|
||||
const oidcToken = await readFileAsync(this.oidcTokenFilePath, 'utf8');
|
||||
const builder = http_1.Request.builder().withMethod('POST').withProtocol('https').withHost(this.stsEndpoint).withReadTimeout(this.readTimeout || 10000).withConnectTimeout(this.connectTimeout || 5000);
|
||||
const queries = Object.create(null);
|
||||
queries['Version'] = '2015-04-01';
|
||||
queries['Action'] = 'AssumeRoleWithOIDC';
|
||||
queries['Format'] = 'JSON';
|
||||
queries['Timestamp'] = utils.timestamp();
|
||||
builder.withQueries(queries);
|
||||
const bodyForm = Object.create(null);
|
||||
bodyForm['OIDCProviderArn'] = this.oidcProviderArn;
|
||||
bodyForm['OIDCToken'] = oidcToken;
|
||||
bodyForm['RoleArn'] = this.roleArn;
|
||||
if (this.policy) {
|
||||
bodyForm['Policy'] = this.policy;
|
||||
}
|
||||
bodyForm['RoleSessionName'] = this.roleSessionName;
|
||||
bodyForm['DurationSeconds'] = `${this.durationSeconds}`;
|
||||
builder.withBodyForm(bodyForm);
|
||||
const headers = Object.create(null);
|
||||
// set headers
|
||||
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
builder.withHeaders(headers);
|
||||
const request = builder.build();
|
||||
const response = await this.doRequest(request);
|
||||
if (response.statusCode !== 200) {
|
||||
throw new Error(`get sts token failed with OIDC: ${response.body.toString('utf8')}`);
|
||||
}
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(response.body.toString('utf8'));
|
||||
}
|
||||
catch (ex) {
|
||||
throw new Error(`get sts token failed with OIDC, unmarshal fail: ${response.body.toString('utf8')}`);
|
||||
}
|
||||
if (!data || !data.Credentials) {
|
||||
throw new Error(`get sts token failed with OIDC`);
|
||||
}
|
||||
const { AccessKeyId, AccessKeySecret, SecurityToken, Expiration } = data.Credentials;
|
||||
if (!AccessKeyId || !AccessKeySecret || !SecurityToken) {
|
||||
throw new Error('get sts token failed with OIDC');
|
||||
}
|
||||
return new session_1.Session(AccessKeyId, AccessKeySecret, SecurityToken, Expiration);
|
||||
}
|
||||
}
|
||||
exports.default = OIDCRoleArnCredentialsProvider;
|
||||
//# sourceMappingURL=oidc_role_arn.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/oidc_role_arn.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/oidc_role_arn.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
backend/node_modules/@alicloud/credentials/dist/src/providers/profile.d.ts
generated
vendored
Normal file
18
backend/node_modules/@alicloud/credentials/dist/src/providers/profile.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import Credentials from '../credentials';
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
export default class ProfileCredentialsProvider implements CredentialsProvider {
|
||||
private readonly profileName;
|
||||
private innerProvider;
|
||||
private readonly homedir;
|
||||
getCredentials(): Promise<Credentials>;
|
||||
getCredentialsProvider(ini: any): CredentialsProvider;
|
||||
getProviderName(): string;
|
||||
static builder(): ProfileCredentialsProviderBuilder;
|
||||
constructor(builder: ProfileCredentialsProviderBuilder);
|
||||
}
|
||||
declare class ProfileCredentialsProviderBuilder {
|
||||
profileName: string;
|
||||
withProfileName(profileName: string): this;
|
||||
build(): ProfileCredentialsProvider;
|
||||
}
|
||||
export {};
|
||||
99
backend/node_modules/@alicloud/credentials/dist/src/providers/profile.js
generated
vendored
Normal file
99
backend/node_modules/@alicloud/credentials/dist/src/providers/profile.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const os_1 = __importDefault(require("os"));
|
||||
const credentials_1 = __importDefault(require("../credentials"));
|
||||
const utils_1 = require("../util/utils");
|
||||
const static_ak_1 = __importDefault(require("./static_ak"));
|
||||
const ecs_ram_role_1 = __importDefault(require("./ecs_ram_role"));
|
||||
const ram_role_arn_1 = __importDefault(require("./ram_role_arn"));
|
||||
class ProfileCredentialsProvider {
|
||||
async getCredentials() {
|
||||
if (!this.innerProvider) {
|
||||
let sharedCfgPath = process.env.ALIBABA_CLOUD_CREDENTIALS_FILE;
|
||||
if (!sharedCfgPath) {
|
||||
if (!this.homedir) {
|
||||
throw new Error('cannot found home dir');
|
||||
}
|
||||
sharedCfgPath = path_1.default.join(this.homedir, '.alibabacloud/credentials');
|
||||
}
|
||||
const ini = await (0, utils_1.loadIni)(sharedCfgPath);
|
||||
this.innerProvider = this.getCredentialsProvider(ini);
|
||||
}
|
||||
const credentials = await this.innerProvider.getCredentials();
|
||||
return credentials_1.default.builder()
|
||||
.withAccessKeyId(credentials.accessKeyId)
|
||||
.withAccessKeySecret(credentials.accessKeySecret)
|
||||
.withSecurityToken(credentials.securityToken)
|
||||
.withProviderName(`${this.getProviderName()}/${this.innerProvider.getProviderName()}`)
|
||||
.build();
|
||||
}
|
||||
getCredentialsProvider(ini) {
|
||||
const config = ini[this.profileName] || {};
|
||||
if (!config.type) {
|
||||
throw new Error(`Can not find credential type for "${this.profileName}"`);
|
||||
}
|
||||
switch (config.type) {
|
||||
case 'access_key':
|
||||
return static_ak_1.default.builder()
|
||||
.withAccessKeyId(config.access_key_id)
|
||||
.withAccessKeySecret(config.access_key_secret)
|
||||
.build();
|
||||
case 'ecs_ram_role':
|
||||
return ecs_ram_role_1.default.builder()
|
||||
.withRoleName(config.role_name)
|
||||
.build();
|
||||
case 'ram_role_arn':
|
||||
{
|
||||
const previous = static_ak_1.default.builder()
|
||||
.withAccessKeyId(config.access_key_id)
|
||||
.withAccessKeySecret(config.access_key_secret)
|
||||
.build();
|
||||
return ram_role_arn_1.default.builder()
|
||||
.withCredentialsProvider(previous)
|
||||
.withRoleArn(config.role_arn)
|
||||
.withRoleSessionName(config.role_session_name)
|
||||
.withPolicy(config.policy)
|
||||
// .withStsEndpoint(config.stsEndpoint)
|
||||
// .withStsRegionId(config.stsRegionId)
|
||||
// .withEnableVpc(config.enableVpc)
|
||||
// .withExternalId(config.enableVpc)
|
||||
.build();
|
||||
}
|
||||
default:
|
||||
throw new Error('Invalid type option, support: access_key, ecs_ram_role, ram_role_arn');
|
||||
}
|
||||
}
|
||||
getProviderName() {
|
||||
return 'profile';
|
||||
}
|
||||
static builder() {
|
||||
return new ProfileCredentialsProviderBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
// used for mock
|
||||
this.homedir = os_1.default.homedir();
|
||||
this.profileName = builder.profileName;
|
||||
}
|
||||
}
|
||||
exports.default = ProfileCredentialsProvider;
|
||||
class ProfileCredentialsProviderBuilder {
|
||||
withProfileName(profileName) {
|
||||
this.profileName = profileName;
|
||||
return this;
|
||||
}
|
||||
build() {
|
||||
// 优先级:
|
||||
// 1. 使用显示指定的 profileName
|
||||
// 2. 使用环境变量(ALIBABA_CLOUD_PROFILE)指定的 profileName
|
||||
// 3. 兜底使用 default 作为 profileName
|
||||
if (!this.profileName) {
|
||||
this.profileName = process.env.ALIBABA_CLOUD_PROFILE || 'default';
|
||||
}
|
||||
return new ProfileCredentialsProvider(this);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=profile.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/profile.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/profile.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../src/providers/profile.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,4CAAoB;AAEpB,iEAAyC;AAEzC,yCAAwC;AAExC,4DAAsD;AACtD,kEAA2D;AAC3D,kEAA2D;AAG3D,MAAqB,0BAA0B;IAM7C,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC,IAAI,CAA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AI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,SAAS,CAAC;SACnE;QAED,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CAEF"}
|
||||
45
backend/node_modules/@alicloud/credentials/dist/src/providers/ram_role_arn.d.ts
generated
vendored
Normal file
45
backend/node_modules/@alicloud/credentials/dist/src/providers/ram_role_arn.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
import { SessionCredentialProvider } from './session';
|
||||
declare class RAMRoleARNCredentialsProviderBuilder {
|
||||
credentialsProvider: CredentialsProvider;
|
||||
roleArn: string;
|
||||
roleSessionName: string;
|
||||
durationSeconds: number;
|
||||
stsEndpoint: string;
|
||||
stsRegionId: string;
|
||||
policy: string;
|
||||
externalId: string;
|
||||
enableVpc?: boolean;
|
||||
readTimeout?: number;
|
||||
connectTimeout?: number;
|
||||
build(): RAMRoleARNCredentialsProvider;
|
||||
withCredentialsProvider(credentialsProvider: CredentialsProvider): RAMRoleARNCredentialsProviderBuilder;
|
||||
withRoleArn(roleArn: string): RAMRoleARNCredentialsProviderBuilder;
|
||||
withStsRegionId(regionId: string): RAMRoleARNCredentialsProviderBuilder;
|
||||
withStsEndpoint(endpoint: string): RAMRoleARNCredentialsProviderBuilder;
|
||||
withRoleSessionName(roleSessionName: string): RAMRoleARNCredentialsProviderBuilder;
|
||||
withPolicy(policy: string): RAMRoleARNCredentialsProviderBuilder;
|
||||
withExternalId(externalId: string): RAMRoleARNCredentialsProviderBuilder;
|
||||
withDurationSeconds(durationSeconds: number): RAMRoleARNCredentialsProviderBuilder;
|
||||
withEnableVpc(enableVpc: boolean): RAMRoleARNCredentialsProviderBuilder;
|
||||
withReadTimeout(readTimeout: number): RAMRoleARNCredentialsProviderBuilder;
|
||||
withConnectTimeout(connectTimeout: number): RAMRoleARNCredentialsProviderBuilder;
|
||||
}
|
||||
export default class RAMRoleARNCredentialsProvider extends SessionCredentialProvider implements CredentialsProvider {
|
||||
private readonly credentialsProvider;
|
||||
private readonly stsEndpoint;
|
||||
private readonly roleSessionName;
|
||||
private readonly policy;
|
||||
private readonly durationSeconds;
|
||||
private readonly externalId;
|
||||
private readonly roleArn;
|
||||
private readonly readTimeout;
|
||||
private readonly connectTimeout;
|
||||
private doRequest;
|
||||
private lastUpdateTimestamp;
|
||||
static builder(): RAMRoleARNCredentialsProviderBuilder;
|
||||
constructor(builder: RAMRoleARNCredentialsProviderBuilder);
|
||||
private getCredentialsInternal;
|
||||
getProviderName(): string;
|
||||
}
|
||||
export {};
|
||||
242
backend/node_modules/@alicloud/credentials/dist/src/providers/ram_role_arn.js
generated
vendored
Normal file
242
backend/node_modules/@alicloud/credentials/dist/src/providers/ram_role_arn.js
generated
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const kitx = __importStar(require("kitx"));
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const utils = __importStar(require("../util/utils"));
|
||||
const http_1 = require("./http");
|
||||
const session_1 = require("./session");
|
||||
const log = (0, debug_1.default)('sign');
|
||||
// type HttpOptions struct {
|
||||
// Proxy : string
|
||||
// ConnectTimeout int
|
||||
// ReadTimeout int
|
||||
// }
|
||||
class RAMRoleARNCredentialsProviderBuilder {
|
||||
build() {
|
||||
if (!this.credentialsProvider) {
|
||||
throw new Error('must specify a previous credentials provider to asssume role');
|
||||
}
|
||||
if (!(this.roleArn = this.roleArn || process.env.ALIBABA_CLOUD_ROLE_ARN))
|
||||
throw new Error('the RoleArn is empty');
|
||||
if (!this.roleSessionName) {
|
||||
this.roleSessionName = process.env.ALIBABA_CLOUD_ROLE_SESSION_NAME || 'credentials-nodejs-' + Date.now();
|
||||
}
|
||||
if (!this.stsRegionId) {
|
||||
this.stsRegionId = process.env.ALIBABA_CLOUD_STS_REGION;
|
||||
}
|
||||
if (!this.enableVpc) {
|
||||
this.enableVpc = process.env.ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED && process.env.ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED.toLowerCase() === 'true' || false;
|
||||
}
|
||||
// duration seconds
|
||||
if (!this.durationSeconds) {
|
||||
// default to 3600
|
||||
this.durationSeconds = 3600;
|
||||
}
|
||||
if (this.durationSeconds < 900) {
|
||||
throw new Error('session duration should be in the range of 900s - max session duration');
|
||||
}
|
||||
// sts endpoint
|
||||
if (!this.stsEndpoint) {
|
||||
if (this.stsRegionId) {
|
||||
if (this.enableVpc) {
|
||||
this.stsEndpoint = `sts-vpc.${this.stsRegionId}.aliyuncs.com`;
|
||||
}
|
||||
else {
|
||||
this.stsEndpoint = `sts.${this.stsRegionId}.aliyuncs.com`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.stsEndpoint = 'sts.aliyuncs.com';
|
||||
}
|
||||
}
|
||||
return new RAMRoleARNCredentialsProvider(this);
|
||||
}
|
||||
withCredentialsProvider(credentialsProvider) {
|
||||
this.credentialsProvider = credentialsProvider;
|
||||
return this;
|
||||
}
|
||||
withRoleArn(roleArn) {
|
||||
this.roleArn = roleArn;
|
||||
return this;
|
||||
}
|
||||
withStsRegionId(regionId) {
|
||||
this.stsRegionId = regionId;
|
||||
return this;
|
||||
}
|
||||
withStsEndpoint(endpoint) {
|
||||
this.stsEndpoint = endpoint;
|
||||
return this;
|
||||
}
|
||||
withRoleSessionName(roleSessionName) {
|
||||
this.roleSessionName = roleSessionName;
|
||||
return this;
|
||||
}
|
||||
withPolicy(policy) {
|
||||
this.policy = policy;
|
||||
return this;
|
||||
}
|
||||
withExternalId(externalId) {
|
||||
this.externalId = externalId;
|
||||
return this;
|
||||
}
|
||||
withDurationSeconds(durationSeconds) {
|
||||
this.durationSeconds = durationSeconds;
|
||||
return this;
|
||||
}
|
||||
withEnableVpc(enableVpc) {
|
||||
this.enableVpc = enableVpc;
|
||||
return this;
|
||||
}
|
||||
withReadTimeout(readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
return this;
|
||||
}
|
||||
withConnectTimeout(connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
function encode(str) {
|
||||
const result = encodeURIComponent(str);
|
||||
return result.replace(/!/g, '%21')
|
||||
.replace(/'/g, '%27')
|
||||
.replace(/\(/g, '%28')
|
||||
.replace(/\)/g, '%29')
|
||||
.replace(/\*/g, '%2A');
|
||||
}
|
||||
class RAMRoleARNCredentialsProvider extends session_1.SessionCredentialProvider {
|
||||
static builder() {
|
||||
return new RAMRoleARNCredentialsProviderBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
super(session_1.STALE_TIME);
|
||||
// used for mock
|
||||
this.doRequest = http_1.doRequest;
|
||||
this.refresher = this.getCredentialsInternal;
|
||||
this.credentialsProvider = builder.credentialsProvider;
|
||||
this.stsEndpoint = builder.stsEndpoint;
|
||||
this.roleSessionName = builder.roleSessionName;
|
||||
this.policy = builder.policy;
|
||||
this.durationSeconds = builder.durationSeconds;
|
||||
this.roleArn = builder.roleArn;
|
||||
this.externalId = builder.externalId;
|
||||
this.readTimeout = builder.readTimeout;
|
||||
this.connectTimeout = builder.connectTimeout;
|
||||
}
|
||||
async getCredentialsInternal() {
|
||||
const credentials = await this.credentialsProvider.getCredentials();
|
||||
const method = 'POST';
|
||||
const builder = http_1.Request.builder().withMethod(method).withProtocol('https').withHost(this.stsEndpoint).withReadTimeout(this.readTimeout || 10000).withConnectTimeout(this.connectTimeout || 5000);
|
||||
const queries = Object.create(null);
|
||||
queries['Version'] = '2015-04-01';
|
||||
queries['Action'] = 'AssumeRole';
|
||||
queries['Format'] = 'JSON';
|
||||
queries['Timestamp'] = utils.timestamp();
|
||||
queries['SignatureMethod'] = 'HMAC-SHA1';
|
||||
queries['SignatureVersion'] = '1.0';
|
||||
queries['SignatureNonce'] = kitx.makeNonce();
|
||||
queries['AccessKeyId'] = credentials.accessKeyId;
|
||||
if (credentials.securityToken) {
|
||||
queries['SecurityToken'] = credentials.securityToken;
|
||||
}
|
||||
const bodyForm = Object.create(null);
|
||||
bodyForm['RoleArn'] = this.roleArn;
|
||||
if (this.policy) {
|
||||
bodyForm['Policy'] = this.policy;
|
||||
}
|
||||
if (this.externalId) {
|
||||
bodyForm['ExternalId'] = this.externalId;
|
||||
}
|
||||
bodyForm['RoleSessionName'] = this.roleSessionName;
|
||||
bodyForm['DurationSeconds'] = `${this.durationSeconds}`;
|
||||
builder.withBodyForm(bodyForm);
|
||||
// caculate signature
|
||||
const signParams = Object.create(null);
|
||||
for (const [key, value] of Object.entries(queries)) {
|
||||
signParams[key] = value;
|
||||
}
|
||||
for (const [key, value] of Object.entries(bodyForm)) {
|
||||
signParams[key] = value;
|
||||
}
|
||||
const keys = Object.keys(signParams).sort();
|
||||
const stringToSign = `${method}&${encode('/')}&${encode(keys.map((key) => {
|
||||
return `${encode(key)}=${encode(signParams[key])}`;
|
||||
}).join('&'))}`;
|
||||
log('stringToSign[Client]:');
|
||||
log(stringToSign);
|
||||
const secret = credentials.accessKeySecret + '&';
|
||||
const signature = kitx.sha1(stringToSign, secret, 'base64');
|
||||
queries['Signature'] = signature;
|
||||
builder.withQueries(queries);
|
||||
const headers = Object.create(null);
|
||||
// set headers
|
||||
headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
headers['x-acs-credentials-provider'] = credentials.providerName;
|
||||
builder.withHeaders(headers);
|
||||
// if (this.httpOptions) {
|
||||
// req.connectTimeout = this.httpOptions.connectTimeout;
|
||||
// req.readTimeout = this.httpOptions.readTimeout;
|
||||
// req.proxy = this.httpOptions.proxy;
|
||||
// }
|
||||
const request = builder.build();
|
||||
const response = await this.doRequest(request);
|
||||
if (response.statusCode != 200) {
|
||||
if (response.headers['content-type'] && response.headers['content-type'].startsWith('application/json')) {
|
||||
const body = JSON.parse(response.body.toString('utf8'));
|
||||
const serverStringToSign = body.Message.slice('Specified signature is not matched with our calculation. server string to sign is:'.length);
|
||||
log('stringToSign[Server]:');
|
||||
log(stringToSign);
|
||||
if (body.Code === 'SignatureDoesNotMatch' && serverStringToSign === stringToSign) {
|
||||
throw new Error(`the access key secret is invalid`);
|
||||
}
|
||||
}
|
||||
throw new Error(`refresh session token failed: ${response.body.toString('utf8')}`);
|
||||
}
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(response.body.toString('utf8'));
|
||||
}
|
||||
catch (ex) {
|
||||
throw new Error(`refresh RoleArn sts token err, unmarshal fail: ${response.body.toString('utf8')}`);
|
||||
}
|
||||
if (!data || !data.Credentials) {
|
||||
throw new Error(`refresh RoleArn sts token err, fail to get credentials`);
|
||||
}
|
||||
if (!data.Credentials.AccessKeyId || !data.Credentials.AccessKeySecret || !data.Credentials.SecurityToken) {
|
||||
throw new Error('refresh RoleArn sts token err, fail to get credentials');
|
||||
}
|
||||
const { AccessKeyId, AccessKeySecret, SecurityToken, Expiration } = data.Credentials;
|
||||
return new session_1.Session(AccessKeyId, AccessKeySecret, SecurityToken, Expiration);
|
||||
}
|
||||
getProviderName() {
|
||||
return `ram_role_arn/${this.credentialsProvider.getProviderName()}`;
|
||||
}
|
||||
}
|
||||
exports.default = RAMRoleARNCredentialsProvider;
|
||||
//# sourceMappingURL=ram_role_arn.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/ram_role_arn.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/ram_role_arn.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
31
backend/node_modules/@alicloud/credentials/dist/src/providers/session.d.ts
generated
vendored
Normal file
31
backend/node_modules/@alicloud/credentials/dist/src/providers/session.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
import Credentials from '../credentials';
|
||||
export declare const STALE_TIME: number;
|
||||
export declare class Session {
|
||||
accessKeyId: string;
|
||||
accessKeySecret: string;
|
||||
securityToken: string;
|
||||
expiration: string;
|
||||
constructor(accessKeyId: string, accessKeySecret: string, securityToken: string, expiration: string);
|
||||
}
|
||||
export declare type SessionRefresher = () => Promise<Session>;
|
||||
export declare class SessionCredentialProvider implements CredentialsProvider {
|
||||
private expirationTimestamp;
|
||||
private session;
|
||||
private refreshFaliure;
|
||||
private readonly staleTime;
|
||||
private readonly prefetchTime;
|
||||
private staleTimestamp;
|
||||
private prefetchTimestamp;
|
||||
refresher: SessionRefresher;
|
||||
constructor(staleTime?: number, prefetchTime?: number);
|
||||
getCredentials(): Promise<Credentials>;
|
||||
refreshTimestamp(): void;
|
||||
maxStaleFailureJitter(): number;
|
||||
jitterTime(time: number, jitterStart: number, jitterEnd: number): number;
|
||||
refreshSession(): Promise<void>;
|
||||
getSession(): Promise<Session>;
|
||||
needUpdateCredential(): boolean;
|
||||
shouldPrefetchCredential(): boolean;
|
||||
getProviderName(): string;
|
||||
}
|
||||
119
backend/node_modules/@alicloud/credentials/dist/src/providers/session.js
generated
vendored
Normal file
119
backend/node_modules/@alicloud/credentials/dist/src/providers/session.js
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SessionCredentialProvider = exports.Session = exports.STALE_TIME = void 0;
|
||||
const time_1 = require("./time");
|
||||
const utils_1 = require("../util/utils");
|
||||
const credentials_1 = __importDefault(require("../credentials"));
|
||||
exports.STALE_TIME = 15 * 60;
|
||||
class Session {
|
||||
constructor(accessKeyId, accessKeySecret, securityToken, expiration) {
|
||||
this.accessKeyId = accessKeyId;
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
this.securityToken = securityToken;
|
||||
this.expiration = expiration;
|
||||
}
|
||||
}
|
||||
exports.Session = Session;
|
||||
class SessionCredentialProvider {
|
||||
constructor(staleTime = 0, prefetchTime = 0) {
|
||||
this.staleTime = staleTime || exports.STALE_TIME;
|
||||
if (prefetchTime) {
|
||||
this.prefetchTime = prefetchTime;
|
||||
this.prefetchTimestamp = Date.now() + (prefetchTime * 1000);
|
||||
}
|
||||
this.refreshFaliure = 0;
|
||||
}
|
||||
async getCredentials() {
|
||||
this.session = await this.getSession();
|
||||
return credentials_1.default.builder()
|
||||
.withAccessKeyId(this.session.accessKeyId)
|
||||
.withAccessKeySecret(this.session.accessKeySecret)
|
||||
.withSecurityToken(this.session.securityToken)
|
||||
.withProviderName(this.getProviderName())
|
||||
.build();
|
||||
}
|
||||
refreshTimestamp() {
|
||||
this.staleTimestamp = this.expirationTimestamp - this.staleTime;
|
||||
if (this.prefetchTimestamp) {
|
||||
this.prefetchTimestamp = (Date.now() + (this.prefetchTime * 1000)) / 1000;
|
||||
}
|
||||
}
|
||||
maxStaleFailureJitter() {
|
||||
const exponentialBackoffMillis = (1 << (this.refreshFaliure - 1));
|
||||
return exponentialBackoffMillis > 10 ? exponentialBackoffMillis : 10;
|
||||
}
|
||||
jitterTime(time, jitterStart, jitterEnd) {
|
||||
const jitterRange = jitterEnd - jitterStart;
|
||||
const jitterAmount = Math.abs(Math.floor(Math.random() * jitterRange));
|
||||
return time + jitterStart + jitterAmount;
|
||||
}
|
||||
async refreshSession() {
|
||||
try {
|
||||
const session = await this.refresher();
|
||||
const now = Date.now() / 1000;
|
||||
const oldSessionAvailable = this.staleTimestamp > now;
|
||||
const oldSession = this.session;
|
||||
this.expirationTimestamp = (0, time_1.parseUTC)(session.expiration) / 1000;
|
||||
this.session = session;
|
||||
this.refreshFaliure = 0;
|
||||
this.refreshTimestamp();
|
||||
// 过期时间大于15分钟,不用管
|
||||
if (this.staleTimestamp > now) {
|
||||
return;
|
||||
}
|
||||
// 不足或等于15分钟,但未过期,下次会再次刷新
|
||||
if (now < (this.staleTimestamp + this.staleTime)) {
|
||||
this.expirationTimestamp = now + this.staleTime;
|
||||
}
|
||||
// 已过期,看缓存,缓存若大于15分钟,返回缓存,若小于15分钟,则根据策略判断是立刻重试还是稍后重试
|
||||
if (now > (this.staleTimestamp + this.staleTime)) {
|
||||
if (oldSessionAvailable) {
|
||||
this.session = oldSession;
|
||||
this.expirationTimestamp = (0, time_1.parseUTC)(oldSession.expiration) / 1000;
|
||||
this.refreshTimestamp();
|
||||
return;
|
||||
}
|
||||
const waitUntilNextRefresh = 50 + (0, utils_1.getRandomInt)(20);
|
||||
this.expirationTimestamp = now + waitUntilNextRefresh + this.staleTime;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
if (!this.session) {
|
||||
throw err;
|
||||
}
|
||||
const now = Date.now() / 1000;
|
||||
if (now < this.staleTimestamp) {
|
||||
return;
|
||||
}
|
||||
this.refreshFaliure++;
|
||||
this.expirationTimestamp = this.jitterTime(now, 1, this.maxStaleFailureJitter()) + this.staleTime;
|
||||
}
|
||||
}
|
||||
async getSession() {
|
||||
if (this.needUpdateCredential() || this.shouldPrefetchCredential()) {
|
||||
await this.refreshSession();
|
||||
this.refreshTimestamp();
|
||||
}
|
||||
return this.session;
|
||||
}
|
||||
needUpdateCredential() {
|
||||
if (!this.session || !this.expirationTimestamp) {
|
||||
return true;
|
||||
}
|
||||
return (Date.now() / 1000) >= this.staleTimestamp;
|
||||
}
|
||||
shouldPrefetchCredential() {
|
||||
if (!this.prefetchTimestamp) {
|
||||
return false;
|
||||
}
|
||||
return this.expirationTimestamp - (Date.now() / 1000) <= this.prefetchTime;
|
||||
}
|
||||
getProviderName() {
|
||||
return 'session';
|
||||
}
|
||||
}
|
||||
exports.SessionCredentialProvider = SessionCredentialProvider;
|
||||
//# sourceMappingURL=session.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/session.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/session.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/providers/session.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAiC;AACjC,yCAA4C;AAE5C,iEAAwC;AAE3B,QAAA,UAAU,GAAG,EAAE,GAAG,EAAE,CAAC;AAElC,MAAa,OAAO;IAMlB,YAAY,WAAmB,EAAE,eAAuB,EAAE,aAAqB,EAAE,UAAkB;QACjG,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAZD,0BAYC;AAID,MAAa,yBAAyB;IAUpC,YAAY,YAAoB,CAAC,EAAE,eAAuB,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI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IAAI,IAAI,CAAC,YAAY,CAAC;IAC7E,CAAC;IAED,eAAe;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;CACJ;AApHD,8DAoHC"}
|
||||
23
backend/node_modules/@alicloud/credentials/dist/src/providers/static_ak.d.ts
generated
vendored
Normal file
23
backend/node_modules/@alicloud/credentials/dist/src/providers/static_ak.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import Credentials from '../credentials';
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare class StaticAKCredentialsProviderBuilder {
|
||||
accessKeyId: string;
|
||||
accessKeySecret: string;
|
||||
withAccessKeyId(accessKeyId: string): StaticAKCredentialsProviderBuilder;
|
||||
withAccessKeySecret(accessKeySecret: string): StaticAKCredentialsProviderBuilder;
|
||||
build(): StaticAKCredentialsProvider;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export default class StaticAKCredentialsProvider implements CredentialsProvider {
|
||||
static builder(): StaticAKCredentialsProviderBuilder;
|
||||
private readonly accessKeyId;
|
||||
private readonly accessKeySecret;
|
||||
constructor(builder: StaticAKCredentialsProviderBuilder);
|
||||
getProviderName(): string;
|
||||
getCredentials(): Promise<Credentials>;
|
||||
}
|
||||
61
backend/node_modules/@alicloud/credentials/dist/src/providers/static_ak.js
generated
vendored
Normal file
61
backend/node_modules/@alicloud/credentials/dist/src/providers/static_ak.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StaticAKCredentialsProviderBuilder = void 0;
|
||||
const credentials_1 = __importDefault(require("../credentials"));
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class StaticAKCredentialsProviderBuilder {
|
||||
withAccessKeyId(accessKeyId) {
|
||||
this.accessKeyId = accessKeyId;
|
||||
return this;
|
||||
}
|
||||
withAccessKeySecret(accessKeySecret) {
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
return this;
|
||||
}
|
||||
build() {
|
||||
if (!this.accessKeyId) {
|
||||
this.accessKeyId = process.env['ALIBABA_CLOUD_ACCESS_KEY_ID'];
|
||||
}
|
||||
if (!this.accessKeyId) {
|
||||
throw new Error('the access key id is empty');
|
||||
}
|
||||
if (!this.accessKeySecret) {
|
||||
this.accessKeySecret = process.env['ALIBABA_CLOUD_ACCESS_KEY_SECRET'];
|
||||
}
|
||||
if (!this.accessKeySecret) {
|
||||
throw new Error('the access key secret is empty');
|
||||
}
|
||||
return new StaticAKCredentialsProvider(this);
|
||||
}
|
||||
}
|
||||
exports.StaticAKCredentialsProviderBuilder = StaticAKCredentialsProviderBuilder;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class StaticAKCredentialsProvider {
|
||||
static builder() {
|
||||
return new StaticAKCredentialsProviderBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
this.accessKeyId = builder.accessKeyId;
|
||||
this.accessKeySecret = builder.accessKeySecret;
|
||||
}
|
||||
getProviderName() {
|
||||
return 'static_ak';
|
||||
}
|
||||
async getCredentials() {
|
||||
const credentials = credentials_1.default
|
||||
.builder()
|
||||
.withAccessKeyId(this.accessKeyId).withAccessKeySecret(this.accessKeySecret)
|
||||
.withProviderName('static_ak')
|
||||
.build();
|
||||
return credentials;
|
||||
}
|
||||
}
|
||||
exports.default = StaticAKCredentialsProvider;
|
||||
//# sourceMappingURL=static_ak.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/static_ak.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/static_ak.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"static_ak.js","sourceRoot":"","sources":["../../../src/providers/static_ak.ts"],"names":[],"mappings":";;;;;;AACA,iEAAyC;AAGzC;;GAEG;AAC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AAC,WAAW,CAAC;aAC7B,KAAK,EAAE,CAAC;QACX,OAAO,WAAW,CAAC;IACrB,CAAC;CACF;AAzBD,8CAyBC"}
|
||||
26
backend/node_modules/@alicloud/credentials/dist/src/providers/static_sts.d.ts
generated
vendored
Normal file
26
backend/node_modules/@alicloud/credentials/dist/src/providers/static_sts.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import Credentials from '../credentials';
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare class StaticSTSCredentialsProviderBuilder {
|
||||
accessKeyId: string;
|
||||
accessKeySecret: string;
|
||||
securityToken: string;
|
||||
withAccessKeyId(accessKeyId: string): StaticSTSCredentialsProviderBuilder;
|
||||
withAccessKeySecret(accessKeySecret: string): StaticSTSCredentialsProviderBuilder;
|
||||
withSecurityToken(securityToken: string): StaticSTSCredentialsProviderBuilder;
|
||||
build(): StaticSTSCredentialsProvider;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export default class StaticSTSCredentialsProvider implements CredentialsProvider {
|
||||
static builder(): StaticSTSCredentialsProviderBuilder;
|
||||
private readonly accessKeyId;
|
||||
private readonly accessKeySecret;
|
||||
private readonly securityToken;
|
||||
constructor(builder: StaticSTSCredentialsProviderBuilder);
|
||||
getProviderName(): string;
|
||||
getCredentials(): Promise<Credentials>;
|
||||
}
|
||||
72
backend/node_modules/@alicloud/credentials/dist/src/providers/static_sts.js
generated
vendored
Normal file
72
backend/node_modules/@alicloud/credentials/dist/src/providers/static_sts.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StaticSTSCredentialsProviderBuilder = void 0;
|
||||
const credentials_1 = __importDefault(require("../credentials"));
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class StaticSTSCredentialsProviderBuilder {
|
||||
withAccessKeyId(accessKeyId) {
|
||||
this.accessKeyId = accessKeyId;
|
||||
return this;
|
||||
}
|
||||
withAccessKeySecret(accessKeySecret) {
|
||||
this.accessKeySecret = accessKeySecret;
|
||||
return this;
|
||||
}
|
||||
withSecurityToken(securityToken) {
|
||||
this.securityToken = securityToken;
|
||||
return this;
|
||||
}
|
||||
build() {
|
||||
if (!this.accessKeyId) {
|
||||
this.accessKeyId = process.env['ALIBABA_CLOUD_ACCESS_KEY_ID'];
|
||||
}
|
||||
if (!this.accessKeyId) {
|
||||
throw new Error('the access key id is empty');
|
||||
}
|
||||
if (!this.accessKeySecret) {
|
||||
this.accessKeySecret = process.env['ALIBABA_CLOUD_ACCESS_KEY_SECRET'];
|
||||
}
|
||||
if (!this.accessKeySecret) {
|
||||
throw new Error('the access key secret is empty');
|
||||
}
|
||||
if (!this.securityToken) {
|
||||
this.securityToken = process.env['ALIBABA_CLOUD_SECURITY_TOKEN'];
|
||||
}
|
||||
if (!this.securityToken) {
|
||||
throw new Error('the security token is empty');
|
||||
}
|
||||
return new StaticSTSCredentialsProvider(this);
|
||||
}
|
||||
}
|
||||
exports.StaticSTSCredentialsProviderBuilder = StaticSTSCredentialsProviderBuilder;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class StaticSTSCredentialsProvider {
|
||||
static builder() {
|
||||
return new StaticSTSCredentialsProviderBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
this.accessKeyId = builder.accessKeyId;
|
||||
this.accessKeySecret = builder.accessKeySecret;
|
||||
this.securityToken = builder.securityToken;
|
||||
}
|
||||
getProviderName() {
|
||||
return 'static_sts';
|
||||
}
|
||||
async getCredentials() {
|
||||
return credentials_1.default.builder()
|
||||
.withAccessKeyId(this.accessKeyId)
|
||||
.withAccessKeySecret(this.accessKeySecret)
|
||||
.withSecurityToken(this.securityToken)
|
||||
.withProviderName(this.getProviderName())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
exports.default = StaticSTSCredentialsProvider;
|
||||
//# sourceMappingURL=static_sts.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/static_sts.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/static_sts.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"static_sts.js","sourceRoot":"","sources":["../../../src/providers/static_sts.ts"],"names":[],"mappings":";;;;;;AACA,iEAAyC;AAGzC;;GAEG;AACH,MAAa,mCAAmC;IAKvC,eAAe,CAAC,WAAmB;QACxC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,mBAAmB,CAAC,eAAuB;QAChD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,iBAAiB,CAAC,aAAqB;QAC5C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;SAC/D;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;SAC/C;QAED,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACzB,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;SACvE;QAED,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;SACnD;QAED,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;SAClE;QAED,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAChD;QAED,OAAO,IAAI,4BAA4B,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;CACF;AA/CD,kFA+CC;AAED;;GAEG;AACH,MAAqB,4BAA4B;IAC/C,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,mCAAmC,EAAE,CAAC;IACnD,CAAC;IAMD,YAAmB,OAA4C;QAC7D,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAC7C,CAAC;IAED,eAAe;QACb,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,OAAO,qBAAW,CAAC,OAAO,EAAE;aACzB,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC;aACjC,mBAAmB,CAAC,IAAI,CAAC,eAAe,CAAC;aACzC,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC;aACrC,gBAAgB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;aACxC,KAAK,EAAE,CAAC;IACb,CAAC;CACF;AA3BD,+CA2BC"}
|
||||
7
backend/node_modules/@alicloud/credentials/dist/src/providers/time.d.ts
generated
vendored
Normal file
7
backend/node_modules/@alicloud/credentials/dist/src/providers/time.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Parses a UTC format date time string and returns the number of milliseconds between midnight,
|
||||
* January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
|
||||
* @param value A UTC format date time string. For example: 2015-04-09T11:52:19Z
|
||||
* @returns The number of milliseconds between 1970.01.01 to the specified date.
|
||||
*/
|
||||
export declare function parseUTC(value: string): number;
|
||||
85
backend/node_modules/@alicloud/credentials/dist/src/providers/time.js
generated
vendored
Normal file
85
backend/node_modules/@alicloud/credentials/dist/src/providers/time.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseUTC = void 0;
|
||||
/**
|
||||
* Parses a UTC format date time string and returns the number of milliseconds between midnight,
|
||||
* January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
|
||||
* @param value A UTC format date time string. For example: 2015-04-09T11:52:19Z
|
||||
* @returns The number of milliseconds between 1970.01.01 to the specified date.
|
||||
*/
|
||||
function parseUTC(value) {
|
||||
if (!value) {
|
||||
throw new Error('invalid UTC format time string');
|
||||
}
|
||||
if (value.length === 20) {
|
||||
// 2024-08-30T07:03:06Z
|
||||
if (value[4] !== '-' || value[7] !== '-' || value[10] !== 'T' || value[13] !== ':' || value[16] !== ':' || value[19] !== 'Z') {
|
||||
throw new Error('invalid UTC format date string');
|
||||
}
|
||||
}
|
||||
else if (value.length === 24) {
|
||||
// 2024-08-30T07:03:06.117Z
|
||||
if (value[4] !== '-' || value[7] !== '-' || value[10] !== 'T' || value[13] !== ':' || value[16] !== ':' || value[19] !== '.' || value[23] !== 'Z') {
|
||||
throw new Error('invalid UTC format date string');
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error('invalid UTC format time string');
|
||||
}
|
||||
const yearStr = value.slice(0, 4);
|
||||
const year = Number.parseInt(yearStr, 10);
|
||||
if (isNaN(year)) {
|
||||
throw new Error('invalid year string');
|
||||
}
|
||||
const monthStr = value.slice(5, 7);
|
||||
const month = Number.parseInt(monthStr, 10);
|
||||
if (isNaN(month)) {
|
||||
throw new Error('invalid month string');
|
||||
}
|
||||
if (month < 1 || month > 12) {
|
||||
throw new Error('invalid month value');
|
||||
}
|
||||
const dateStr = value.slice(8, 10);
|
||||
const date = Number.parseInt(dateStr, 10);
|
||||
if (isNaN(date)) {
|
||||
throw new Error('invalid date string');
|
||||
}
|
||||
if (date < 1 || date > 31) {
|
||||
throw new Error('invalid date value');
|
||||
}
|
||||
const hoursStr = value.slice(11, 13);
|
||||
const hours = Number.parseInt(hoursStr, 10);
|
||||
if (isNaN(hours)) {
|
||||
throw new Error('invalid hours string');
|
||||
}
|
||||
if (hours < 0 || hours > 24) {
|
||||
throw new Error('invalid hours value');
|
||||
}
|
||||
const minutesStr = value.slice(14, 16);
|
||||
const minutes = Number.parseInt(minutesStr, 10);
|
||||
if (isNaN(minutes)) {
|
||||
throw new Error('invalid minutes string');
|
||||
}
|
||||
if (minutes < 0 || minutes > 60) {
|
||||
throw new Error('invalid minutes value');
|
||||
}
|
||||
const secondsStr = value.slice(17, 19);
|
||||
const seconds = Number.parseInt(secondsStr, 10);
|
||||
if (isNaN(seconds)) {
|
||||
throw new Error('invalid seconds string');
|
||||
}
|
||||
if (seconds < 0 || seconds > 60) {
|
||||
throw new Error('invalid seconds value');
|
||||
}
|
||||
if (value.length === 24) {
|
||||
const msStr = value.slice(20, 23);
|
||||
const ms = Number.parseInt(msStr, 10);
|
||||
if (isNaN(ms)) {
|
||||
throw new Error('invalid ms string');
|
||||
}
|
||||
return Date.UTC(year, month - 1, date, hours, minutes, seconds, ms);
|
||||
}
|
||||
return Date.UTC(year, month - 1, date, hours, minutes, seconds);
|
||||
}
|
||||
exports.parseUTC = parseUTC;
|
||||
//# sourceMappingURL=time.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/time.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/time.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../../src/providers/time.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,KAAa;IACpC,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE;QACvB,uBA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,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,EAAE,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAC1C;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;KAC3C;IAED,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,GAAG,EAAE,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAC1C;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAClC,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACtC,IAAI,KAAK,CAAC,EAAE,CAAC,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;SACtC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;KACrE;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC;AAtFD,4BAsFC"}
|
||||
27
backend/node_modules/@alicloud/credentials/dist/src/providers/uri.d.ts
generated
vendored
Normal file
27
backend/node_modules/@alicloud/credentials/dist/src/providers/uri.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import CredentialsProvider from '../credentials_provider';
|
||||
import { SessionCredentialProvider } from './session';
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export default class URICredentialsProvider extends SessionCredentialProvider implements CredentialsProvider {
|
||||
static builder(): URICredentialsProviderBuilder;
|
||||
private readonly credentialsURI;
|
||||
private doRequest;
|
||||
private readonly readTimeout;
|
||||
private readonly connectTimeout;
|
||||
constructor(builder: URICredentialsProviderBuilder);
|
||||
getProviderName(): string;
|
||||
private getCredentialsUri;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare class URICredentialsProviderBuilder {
|
||||
credentialsURI: string;
|
||||
readTimeout?: number;
|
||||
connectTimeout?: number;
|
||||
withCredentialsURI(credentialsURI: string): URICredentialsProviderBuilder;
|
||||
withReadTimeout(readTimeout: number): URICredentialsProviderBuilder;
|
||||
withConnectTimeout(connectTimeout: number): URICredentialsProviderBuilder;
|
||||
build(): URICredentialsProvider;
|
||||
}
|
||||
73
backend/node_modules/@alicloud/credentials/dist/src/providers/uri.js
generated
vendored
Normal file
73
backend/node_modules/@alicloud/credentials/dist/src/providers/uri.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.URICredentialsProviderBuilder = void 0;
|
||||
const session_1 = require("./session");
|
||||
const http_1 = require("./http");
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class URICredentialsProvider extends session_1.SessionCredentialProvider {
|
||||
static builder() {
|
||||
return new URICredentialsProviderBuilder();
|
||||
}
|
||||
constructor(builder) {
|
||||
super(session_1.STALE_TIME);
|
||||
this.doRequest = http_1.doRequest;
|
||||
this.refresher = this.getCredentialsUri;
|
||||
this.credentialsURI = builder.credentialsURI;
|
||||
this.readTimeout = builder.readTimeout;
|
||||
this.connectTimeout = builder.connectTimeout;
|
||||
}
|
||||
getProviderName() {
|
||||
return 'credential_uri';
|
||||
}
|
||||
async getCredentialsUri() {
|
||||
const builder = http_1.Request.builder()
|
||||
.withMethod('GET')
|
||||
.withURL(this.credentialsURI)
|
||||
.withReadTimeout(this.readTimeout || 10000)
|
||||
.withConnectTimeout(this.connectTimeout || 5000);
|
||||
const request = builder.build();
|
||||
const response = await this.doRequest(request);
|
||||
if (response.statusCode !== 200) {
|
||||
throw new Error(`get sts token failed, httpStatus: ${response.statusCode}, message = ${response.body.toString('utf8')}.`);
|
||||
}
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(response.body.toString('utf8'));
|
||||
}
|
||||
catch (ex) {
|
||||
throw new Error(`get sts token failed, json parse failed: ${ex.message}, result: ${response.body.toString('utf8')}.`);
|
||||
}
|
||||
if (!data || !data.AccessKeyId || !data.AccessKeySecret || !data.SecurityToken) {
|
||||
throw new Error(`error retrieving credentials from credentialsURI result: ${JSON.stringify(data)}.`);
|
||||
}
|
||||
return new session_1.Session(data.AccessKeyId, data.AccessKeySecret, data.SecurityToken, data.Expiration);
|
||||
}
|
||||
}
|
||||
exports.default = URICredentialsProvider;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class URICredentialsProviderBuilder {
|
||||
withCredentialsURI(credentialsURI) {
|
||||
this.credentialsURI = credentialsURI;
|
||||
return this;
|
||||
}
|
||||
withReadTimeout(readTimeout) {
|
||||
this.readTimeout = readTimeout;
|
||||
return this;
|
||||
}
|
||||
withConnectTimeout(connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
return this;
|
||||
}
|
||||
build() {
|
||||
if (!this.credentialsURI) {
|
||||
this.credentialsURI = process.env.ALIBABA_CLOUD_CREDENTIALS_URI;
|
||||
}
|
||||
return new URICredentialsProvider(this);
|
||||
}
|
||||
}
|
||||
exports.URICredentialsProviderBuilder = URICredentialsProviderBuilder;
|
||||
//# sourceMappingURL=uri.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/providers/uri.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/providers/uri.js.map
generated
vendored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||
16
backend/node_modules/@alicloud/credentials/dist/src/ram_role_arn_credential.d.ts
generated
vendored
Normal file
16
backend/node_modules/@alicloud/credentials/dist/src/ram_role_arn_credential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import SessionCredential from './session_credential';
|
||||
import Config from './config';
|
||||
export default class RamRoleArnCredential extends SessionCredential {
|
||||
roleArn: string;
|
||||
policy: string;
|
||||
durationSeconds: number;
|
||||
roleSessionName: string;
|
||||
runtime: {
|
||||
[key: string]: any;
|
||||
};
|
||||
host: string;
|
||||
constructor(config: Config, runtime?: {
|
||||
[key: string]: any;
|
||||
});
|
||||
updateCredential(): Promise<void>;
|
||||
}
|
||||
51
backend/node_modules/@alicloud/credentials/dist/src/ram_role_arn_credential.js
generated
vendored
Normal file
51
backend/node_modules/@alicloud/credentials/dist/src/ram_role_arn_credential.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const session_credential_1 = __importDefault(require("./session_credential"));
|
||||
const http_1 = require("./util/http");
|
||||
const config_1 = __importDefault(require("./config"));
|
||||
class RamRoleArnCredential extends session_credential_1.default {
|
||||
constructor(config, runtime = {}) {
|
||||
if (!config.accessKeyId) {
|
||||
throw new Error('Missing required accessKeyId option in config for ram_role_arn');
|
||||
}
|
||||
if (!config.accessKeySecret) {
|
||||
throw new Error('Missing required accessKeySecret option in config for ram_role_arn');
|
||||
}
|
||||
if (!config.roleArn) {
|
||||
throw new Error('Missing required roleArn option in config for ram_role_arn');
|
||||
}
|
||||
const conf = new config_1.default({
|
||||
type: 'ram_role_arn',
|
||||
accessKeyId: config.accessKeyId,
|
||||
accessKeySecret: config.accessKeySecret,
|
||||
securityToken: config.securityToken
|
||||
});
|
||||
super(conf);
|
||||
this.roleArn = config.roleArn;
|
||||
this.policy = config.policy;
|
||||
this.durationSeconds = config.roleSessionExpiration || 3600;
|
||||
this.roleSessionName = config.roleSessionName || 'role_session_name';
|
||||
this.runtime = runtime;
|
||||
this.host = 'https://sts.aliyuncs.com';
|
||||
}
|
||||
async updateCredential() {
|
||||
const params = {
|
||||
accessKeyId: this.accessKeyId,
|
||||
securityToken: this.securityToken,
|
||||
roleArn: this.roleArn,
|
||||
action: 'AssumeRole',
|
||||
durationSeconds: this.durationSeconds,
|
||||
roleSessionName: this.roleSessionName
|
||||
};
|
||||
if (this.policy) {
|
||||
params.policy = this.policy;
|
||||
}
|
||||
const json = await (0, http_1.request)(this.host, params, this.runtime, this.accessKeySecret);
|
||||
this.sessionCredential = json.Credentials;
|
||||
}
|
||||
}
|
||||
exports.default = RamRoleArnCredential;
|
||||
//# sourceMappingURL=ram_role_arn_credential.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/ram_role_arn_credential.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/ram_role_arn_credential.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ram_role_arn_credential.js","sourceRoot":"","sources":["../../src/ram_role_arn_credential.ts"],"names":[],"mappings":";;;;;AAAA,8EAAqD;AACrD,sCAAsC;AACtC,sDAA8B;AAE9B,MAAqB,oBAAqB,SAAQ,4BAAiB;IAQjE,YAAY,MAAc,EAAE,UAAgC,EAAE;QAC5D,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;SACnF;QAED,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC;SACvF;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;SAC/E;QAED,MAAM,IAAI,GAAG,IAAI,gBAAM,CAAC;YACtB,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,qBAAqB,IAAI,IAAI,CAAC;QAC5D,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,mBAAmB,CAAC;QACrE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,MAAM,GAAyB;YACnC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,YAAY;YACpB,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAC;QACF,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;SAC7B;QACD,MAAM,IAAI,GAAG,MAAM,IAAA,cAAO,EAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAClF,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC;IAC5C,CAAC;CACF;AAnDD,uCAmDC"}
|
||||
9
backend/node_modules/@alicloud/credentials/dist/src/rsa_key_pair_credential.d.ts
generated
vendored
Normal file
9
backend/node_modules/@alicloud/credentials/dist/src/rsa_key_pair_credential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import SessionCredential from './session_credential';
|
||||
import ICredential from './icredential';
|
||||
export default class RsaKeyPairCredential extends SessionCredential implements ICredential {
|
||||
privateKey: string;
|
||||
publicKeyId: string;
|
||||
roleName: string;
|
||||
constructor(publicKeyId: string, privateKeyFile: string);
|
||||
updateCredential(): Promise<void>;
|
||||
}
|
||||
66
backend/node_modules/@alicloud/credentials/dist/src/rsa_key_pair_credential.js
generated
vendored
Normal file
66
backend/node_modules/@alicloud/credentials/dist/src/rsa_key_pair_credential.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const session_credential_1 = __importDefault(require("./session_credential"));
|
||||
const utils = __importStar(require("./util/utils"));
|
||||
const http_1 = require("./util/http");
|
||||
const config_1 = __importDefault(require("./config"));
|
||||
const SECURITY_CRED_URL = 'http://100.100.100.200/latest/meta-data/ram/security-credentials/';
|
||||
class RsaKeyPairCredential extends session_credential_1.default {
|
||||
constructor(publicKeyId, privateKeyFile) {
|
||||
if (!publicKeyId) {
|
||||
throw new Error('Missing required publicKeyId option in config for rsa_key_pair');
|
||||
}
|
||||
if (!privateKeyFile) {
|
||||
throw new Error('Missing required privateKeyFile option in config for rsa_key_pair');
|
||||
}
|
||||
if (!fs_1.default.existsSync(privateKeyFile)) {
|
||||
throw new Error(`privateKeyFile ${privateKeyFile} cannot be empty`);
|
||||
}
|
||||
const conf = new config_1.default({
|
||||
type: 'rsa_key_pair'
|
||||
});
|
||||
super(conf);
|
||||
this.privateKey = utils.parseFile(privateKeyFile);
|
||||
this.publicKeyId = publicKeyId;
|
||||
}
|
||||
async updateCredential() {
|
||||
const url = SECURITY_CRED_URL + this.roleName;
|
||||
const json = await (0, http_1.request)(url, {
|
||||
accessKeyId: this.publicKeyId,
|
||||
action: 'GenerateSessionAccessKey',
|
||||
durationSeconds: 3600,
|
||||
signatureMethod: 'SHA256withRSA',
|
||||
signatureType: 'PRIVATEKEY',
|
||||
}, {}, this.privateKey);
|
||||
this.sessionCredential = json.Credentials;
|
||||
}
|
||||
}
|
||||
exports.default = RsaKeyPairCredential;
|
||||
//# sourceMappingURL=rsa_key_pair_credential.js.map
|
||||
1
backend/node_modules/@alicloud/credentials/dist/src/rsa_key_pair_credential.js.map
generated
vendored
Normal file
1
backend/node_modules/@alicloud/credentials/dist/src/rsa_key_pair_credential.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rsa_key_pair_credential.js","sourceRoot":"","sources":["../../src/rsa_key_pair_credential.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,8EAAqD;AACrD,oDAAsC;AACtC,sCAAsC;AAEtC,sDAA8B;AAE9B,MAAM,iBAAiB,GAAG,mEAAmE,CAAC;AAE9F,MAAqB,oBAAqB,SAAQ,4BAAiB;IAKjE,YAAY,WAAmB,EAAE,cAAsB;QACrD,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;SACnF;QAED,IAAI,CAAC,cAAc,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;SACtF;QAED,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,kBAAkB,cAAc,kBAAkB,CAAC,CAAC;SACrE;QAED,MAAM,IAAI,GAAG,IAAI,gBAAM,CAAC;YACtB,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAClD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,GAAG,GAAG,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,IAAA,cAAO,EAAC,GAAG,EAAE;YAC9B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,MAAM,EAAE,0BAA0B;YAClC,eAAe,EAAE,IAAI;YACrB,eAAe,EAAE,eAAe;YAChC,aAAa,EAAE,YAAY;SAC5B,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACxB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC;IAC5C,CAAC;CACF;AArCD,uCAqCC"}
|
||||
15
backend/node_modules/@alicloud/credentials/dist/src/session_credential.d.ts
generated
vendored
Normal file
15
backend/node_modules/@alicloud/credentials/dist/src/session_credential.d.ts
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import DefaultCredential from './default_credential';
|
||||
import Config from './config';
|
||||
import CredentialModel from './credential_model';
|
||||
export default class SessionCredential extends DefaultCredential {
|
||||
sessionCredential: any;
|
||||
durationSeconds: number;
|
||||
constructor(config: Config);
|
||||
updateCredential(): Promise<void>;
|
||||
ensureCredential(): Promise<void>;
|
||||
getAccessKeyId(): Promise<any>;
|
||||
getAccessKeySecret(): Promise<any>;
|
||||
getSecurityToken(): Promise<any>;
|
||||
needUpdateCredential(): boolean;
|
||||
getCredential(): Promise<CredentialModel>;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user