@aws-sdk/token-providers 3.387.0 → 3.388.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -3
- package/dist-cjs/{client-sso-oidc-bundle/dist-node.js → bundle/client-sso-oidc-browser.js} +277 -120
- package/dist-cjs/{client-sso-oidc-bundle/dist-browser.js → bundle/client-sso-oidc-node.js} +355 -186
- package/dist-cjs/getNewSsoOidcToken.js +2 -2
- package/dist-cjs/getSsoOidcClient.js +2 -2
- package/dist-cjs/index.js +1 -1
- package/dist-es/{client-sso-oidc-bundle/dist-browser.js → bundle/client-sso-oidc-browser.js} +260 -97
- package/dist-es/{client-sso-oidc-bundle/dist-node.js → bundle/client-sso-oidc-node.js} +260 -97
- package/dist-es/getNewSsoOidcToken.js +1 -1
- package/dist-es/getSsoOidcClient.js +1 -1
- package/dist-es/index.js +1 -1
- package/dist-types/index.d.ts +1 -1
- package/dist-types/ts3.4/index.d.ts +1 -1
- package/package.json +35 -5
- /package/dist-types/{client-sso-oidc-bundle/dist-browser.d.ts → bundle/client-sso-oidc-browser.d.ts} +0 -0
- /package/dist-types/{client-sso-oidc-bundle/dist-node.d.ts → bundle/client-sso-oidc-node.d.ts} +0 -0
- /package/dist-types/ts3.4/{client-sso-oidc-bundle/dist-browser.d.ts → bundle/client-sso-oidc-browser.d.ts} +0 -0
- /package/dist-types/ts3.4/{client-sso-oidc-bundle/dist-node.d.ts → bundle/client-sso-oidc-node.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ type is going to be token based. For example, the `bearer` authorization type se
|
|
|
10
10
|
## Static Token Provider
|
|
11
11
|
|
|
12
12
|
```ts
|
|
13
|
-
import { fromStatic } from "@aws-sdk/token-providers"
|
|
13
|
+
import { fromStatic } from "@aws-sdk/token-providers";
|
|
14
14
|
|
|
15
15
|
const token = { token: "TOKEN" };
|
|
16
16
|
const staticTokenProvider = fromStatic(token);
|
|
@@ -21,7 +21,7 @@ const staticToken = await staticTokenProvider(); // returns { token: "TOKEN" }
|
|
|
21
21
|
## SSO Token Provider
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
|
-
import { fromSso } from "@aws-sdk/token-providers"
|
|
24
|
+
import { fromSso } from "@aws-sdk/token-providers";
|
|
25
25
|
|
|
26
26
|
// returns token from SSO token cache or ssoOidc.createToken() call.
|
|
27
27
|
const ssoToken = await fromSso();
|
|
@@ -30,10 +30,24 @@ const ssoToken = await fromSso();
|
|
|
30
30
|
## Token Provider Chain
|
|
31
31
|
|
|
32
32
|
```ts
|
|
33
|
-
import { nodeProvider } from "@aws-sdk/token-providers"
|
|
33
|
+
import { nodeProvider } from "@aws-sdk/token-providers";
|
|
34
34
|
|
|
35
35
|
// returns token from default providers.
|
|
36
36
|
const token = await nodeProvider();
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
[http-bearer-auth-trait]: https://smithy.io/2.0/spec/authentication-traits.html#smithy-api-httpbearerauth-trait
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
### Development
|
|
44
|
+
|
|
45
|
+
This package contains a minimal copy of the SSO OIDC client, instead of relying on the full client, which
|
|
46
|
+
would cause a circular dependency.
|
|
47
|
+
|
|
48
|
+
When regenerating the bundled version of the SSO OIDC client, run the esbuild.js script and then make the following changes:
|
|
49
|
+
|
|
50
|
+
- Remove any dependency of the generated client on the credential chain such that it would create
|
|
51
|
+
a circular dependency back to this package. Because we only need the `CreateTokenCommand`, the client, and this command's
|
|
52
|
+
associated `Exception`s, it is possible to remove auth dependencies.
|
|
53
|
+
- Ensure all required packages are declared in the `package.json` of token-providers.
|
|
@@ -19,109 +19,13 @@ var resolveClientEndpointParameters = (options) => {
|
|
|
19
19
|
defaultSigningName: "awsssooidc"
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
var package_default = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
version: "3.386.0",
|
|
26
|
-
scripts: {
|
|
27
|
-
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
28
|
-
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
29
|
-
"build:docs": "typedoc",
|
|
30
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
31
|
-
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
32
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
33
|
-
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
34
|
-
clean: "rimraf ./dist-* && rimraf *.tsbuildinfo",
|
|
35
|
-
"extract:docs": "api-extractor run --local",
|
|
36
|
-
"generate:client": "node ../../scripts/generate-clients/single-service --solo sso-oidc"
|
|
37
|
-
},
|
|
38
|
-
main: "./dist-cjs/index.js",
|
|
39
|
-
types: "./dist-types/index.d.ts",
|
|
40
|
-
module: "./dist-es/index.js",
|
|
41
|
-
sideEffects: false,
|
|
42
|
-
dependencies: {
|
|
43
|
-
"@aws-crypto/sha256-browser": "3.0.0",
|
|
44
|
-
"@aws-crypto/sha256-js": "3.0.0",
|
|
45
|
-
"@aws-sdk/middleware-host-header": "*",
|
|
46
|
-
"@aws-sdk/middleware-logger": "*",
|
|
47
|
-
"@aws-sdk/middleware-recursion-detection": "*",
|
|
48
|
-
"@aws-sdk/middleware-user-agent": "*",
|
|
49
|
-
"@aws-sdk/types": "*",
|
|
50
|
-
"@aws-sdk/util-endpoints": "*",
|
|
51
|
-
"@aws-sdk/util-user-agent-browser": "*",
|
|
52
|
-
"@aws-sdk/util-user-agent-node": "*",
|
|
53
|
-
"@smithy/config-resolver": "^2.0.2",
|
|
54
|
-
"@smithy/fetch-http-handler": "^2.0.2",
|
|
55
|
-
"@smithy/hash-node": "^2.0.2",
|
|
56
|
-
"@smithy/invalid-dependency": "^2.0.2",
|
|
57
|
-
"@smithy/middleware-content-length": "^2.0.2",
|
|
58
|
-
"@smithy/middleware-endpoint": "^2.0.2",
|
|
59
|
-
"@smithy/middleware-retry": "^2.0.2",
|
|
60
|
-
"@smithy/middleware-serde": "^2.0.2",
|
|
61
|
-
"@smithy/middleware-stack": "^2.0.0",
|
|
62
|
-
"@smithy/node-config-provider": "^2.0.2",
|
|
63
|
-
"@smithy/node-http-handler": "^2.0.2",
|
|
64
|
-
"@smithy/protocol-http": "^2.0.2",
|
|
65
|
-
"@smithy/smithy-client": "^2.0.2",
|
|
66
|
-
"@smithy/types": "^2.1.0",
|
|
67
|
-
"@smithy/url-parser": "^2.0.2",
|
|
68
|
-
"@smithy/util-base64": "^2.0.0",
|
|
69
|
-
"@smithy/util-body-length-browser": "^2.0.0",
|
|
70
|
-
"@smithy/util-body-length-node": "^2.0.0",
|
|
71
|
-
"@smithy/util-defaults-mode-browser": "^2.0.2",
|
|
72
|
-
"@smithy/util-defaults-mode-node": "^2.0.2",
|
|
73
|
-
"@smithy/util-retry": "^2.0.0",
|
|
74
|
-
"@smithy/util-utf8": "^2.0.0",
|
|
75
|
-
tslib: "^2.5.0"
|
|
76
|
-
},
|
|
77
|
-
devDependencies: {
|
|
78
|
-
"@smithy/service-client-documentation-generator": "^2.0.0",
|
|
79
|
-
"@tsconfig/node14": "1.0.3",
|
|
80
|
-
"@types/node": "^14.14.31",
|
|
81
|
-
concurrently: "7.0.0",
|
|
82
|
-
"downlevel-dts": "0.10.1",
|
|
83
|
-
rimraf: "3.0.2",
|
|
84
|
-
typedoc: "0.23.23",
|
|
85
|
-
typescript: "~4.9.5"
|
|
86
|
-
},
|
|
87
|
-
engines: {
|
|
88
|
-
node: ">=14.0.0"
|
|
89
|
-
},
|
|
90
|
-
typesVersions: {
|
|
91
|
-
"<4.0": {
|
|
92
|
-
"dist-types/*": [
|
|
93
|
-
"dist-types/ts3.4/*"
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
files: [
|
|
98
|
-
"dist-*/**"
|
|
99
|
-
],
|
|
100
|
-
author: {
|
|
101
|
-
name: "AWS SDK for JavaScript Team",
|
|
102
|
-
url: "https://aws.amazon.com/javascript/"
|
|
103
|
-
},
|
|
104
|
-
license: "Apache-2.0",
|
|
105
|
-
browser: {
|
|
106
|
-
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
|
|
107
|
-
},
|
|
108
|
-
"react-native": {
|
|
109
|
-
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native"
|
|
110
|
-
},
|
|
111
|
-
homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sso-oidc",
|
|
112
|
-
repository: {
|
|
113
|
-
type: "git",
|
|
114
|
-
url: "https://github.com/aws/aws-sdk-js-v3.git",
|
|
115
|
-
directory: "clients/client-sso-oidc"
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
|
|
22
|
+
var package_default = { version: "3.387.0" };
|
|
23
|
+
const sha256_browser_1 = require("@aws-crypto/sha256-browser");
|
|
24
|
+
const util_user_agent_browser_1 = require("@aws-sdk/util-user-agent-browser");
|
|
119
25
|
const config_resolver_2 = require("@smithy/config-resolver");
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const node_http_handler_1 = require("@smithy/node-http-handler");
|
|
124
|
-
const util_body_length_node_1 = require("@smithy/util-body-length-node");
|
|
26
|
+
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
|
|
27
|
+
const invalid_dependency_1 = require("@smithy/invalid-dependency");
|
|
28
|
+
const util_body_length_browser_1 = require("@smithy/util-body-length-browser");
|
|
125
29
|
const util_retry_1 = require("@smithy/util-retry");
|
|
126
30
|
const smithy_client_2 = require("@smithy/smithy-client");
|
|
127
31
|
const url_parser_1 = require("@smithy/url-parser");
|
|
@@ -171,32 +75,27 @@ var getRuntimeConfig = (config) => {
|
|
|
171
75
|
});
|
|
172
76
|
};
|
|
173
77
|
const smithy_client_3 = require("@smithy/smithy-client");
|
|
174
|
-
const
|
|
175
|
-
const smithy_client_4 = require("@smithy/smithy-client");
|
|
78
|
+
const util_defaults_mode_browser_1 = require("@smithy/util-defaults-mode-browser");
|
|
176
79
|
var getRuntimeConfig2 = (config) => {
|
|
177
80
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
178
|
-
(0,
|
|
179
|
-
const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
|
|
81
|
+
const defaultsMode = (0, util_defaults_mode_browser_1.resolveDefaultsModeConfig)(config);
|
|
180
82
|
const defaultConfigProvider = () => defaultsMode().then(smithy_client_3.loadConfigsForDefaultMode);
|
|
181
83
|
const clientSharedValues = getRuntimeConfig(config);
|
|
182
84
|
return {
|
|
183
85
|
...clientSharedValues,
|
|
184
86
|
...config,
|
|
185
|
-
runtime: "
|
|
87
|
+
runtime: "browser",
|
|
186
88
|
defaultsMode,
|
|
187
|
-
bodyLengthChecker: (_a = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _a !== void 0 ? _a :
|
|
188
|
-
defaultUserAgentProvider: (_b = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _b !== void 0 ? _b : (0,
|
|
189
|
-
maxAttempts: (_c = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _c !== void 0 ? _c :
|
|
190
|
-
region: (_d = config === null || config === void 0 ? void 0 : config.region) !== null && _d !== void 0 ? _d : (0,
|
|
191
|
-
requestHandler: (_e = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _e !== void 0 ? _e : new
|
|
192
|
-
retryMode: (_f = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _f !== void 0 ? _f : (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
streamCollector: (_h = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _h !== void 0 ? _h : node_http_handler_1.streamCollector,
|
|
198
|
-
useDualstackEndpoint: (_j = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _j !== void 0 ? _j : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
|
|
199
|
-
useFipsEndpoint: (_k = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _k !== void 0 ? _k : (0, node_config_provider_1.loadConfig)(config_resolver_2.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS)
|
|
89
|
+
bodyLengthChecker: (_a = config === null || config === void 0 ? void 0 : config.bodyLengthChecker) !== null && _a !== void 0 ? _a : util_body_length_browser_1.calculateBodyLength,
|
|
90
|
+
defaultUserAgentProvider: (_b = config === null || config === void 0 ? void 0 : config.defaultUserAgentProvider) !== null && _b !== void 0 ? _b : (0, util_user_agent_browser_1.defaultUserAgent)({ serviceId: clientSharedValues.serviceId, clientVersion: package_default.version }),
|
|
91
|
+
maxAttempts: (_c = config === null || config === void 0 ? void 0 : config.maxAttempts) !== null && _c !== void 0 ? _c : util_retry_1.DEFAULT_MAX_ATTEMPTS,
|
|
92
|
+
region: (_d = config === null || config === void 0 ? void 0 : config.region) !== null && _d !== void 0 ? _d : (0, invalid_dependency_1.invalidProvider)("Region is missing"),
|
|
93
|
+
requestHandler: (_e = config === null || config === void 0 ? void 0 : config.requestHandler) !== null && _e !== void 0 ? _e : new fetch_http_handler_1.FetchHttpHandler(defaultConfigProvider),
|
|
94
|
+
retryMode: (_f = config === null || config === void 0 ? void 0 : config.retryMode) !== null && _f !== void 0 ? _f : (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
|
|
95
|
+
sha256: (_g = config === null || config === void 0 ? void 0 : config.sha256) !== null && _g !== void 0 ? _g : sha256_browser_1.Sha256,
|
|
96
|
+
streamCollector: (_h = config === null || config === void 0 ? void 0 : config.streamCollector) !== null && _h !== void 0 ? _h : fetch_http_handler_1.streamCollector,
|
|
97
|
+
useDualstackEndpoint: (_j = config === null || config === void 0 ? void 0 : config.useDualstackEndpoint) !== null && _j !== void 0 ? _j : (() => Promise.resolve(config_resolver_2.DEFAULT_USE_DUALSTACK_ENDPOINT)),
|
|
98
|
+
useFipsEndpoint: (_k = config === null || config === void 0 ? void 0 : config.useFipsEndpoint) !== null && _k !== void 0 ? _k : (() => Promise.resolve(config_resolver_2.DEFAULT_USE_FIPS_ENDPOINT))
|
|
200
99
|
};
|
|
201
100
|
};
|
|
202
101
|
var SSOOIDCClient = class extends smithy_client_1.Client {
|
|
@@ -222,6 +121,7 @@ var SSOOIDCClient = class extends smithy_client_1.Client {
|
|
|
222
121
|
}
|
|
223
122
|
};
|
|
224
123
|
exports.SSOOIDCClient = SSOOIDCClient;
|
|
124
|
+
const smithy_client_4 = require("@smithy/smithy-client");
|
|
225
125
|
const middleware_endpoint_2 = require("@smithy/middleware-endpoint");
|
|
226
126
|
const middleware_serde_1 = require("@smithy/middleware-serde");
|
|
227
127
|
const smithy_client_5 = require("@smithy/smithy-client");
|
|
@@ -398,6 +298,20 @@ var UnsupportedGrantTypeException = class _UnsupportedGrantTypeException extends
|
|
|
398
298
|
}
|
|
399
299
|
};
|
|
400
300
|
exports.UnsupportedGrantTypeException = UnsupportedGrantTypeException;
|
|
301
|
+
var InvalidClientMetadataException = class _InvalidClientMetadataException extends SSOOIDCServiceException {
|
|
302
|
+
constructor(opts) {
|
|
303
|
+
super({
|
|
304
|
+
name: "InvalidClientMetadataException",
|
|
305
|
+
$fault: "client",
|
|
306
|
+
...opts
|
|
307
|
+
});
|
|
308
|
+
this.name = "InvalidClientMetadataException";
|
|
309
|
+
this.$fault = "client";
|
|
310
|
+
Object.setPrototypeOf(this, _InvalidClientMetadataException.prototype);
|
|
311
|
+
this.error = opts.error;
|
|
312
|
+
this.error_description = opts.error_description;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
401
315
|
var se_CreateTokenCommand = async (input, context) => {
|
|
402
316
|
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
403
317
|
const headers = {
|
|
@@ -425,6 +339,50 @@ var se_CreateTokenCommand = async (input, context) => {
|
|
|
425
339
|
body
|
|
426
340
|
});
|
|
427
341
|
};
|
|
342
|
+
var se_RegisterClientCommand = async (input, context) => {
|
|
343
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
344
|
+
const headers = {
|
|
345
|
+
"content-type": "application/json"
|
|
346
|
+
};
|
|
347
|
+
const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/client/register`;
|
|
348
|
+
let body;
|
|
349
|
+
body = JSON.stringify((0, smithy_client_6.take)(input, {
|
|
350
|
+
clientName: [],
|
|
351
|
+
clientType: [],
|
|
352
|
+
scopes: (_) => (0, smithy_client_6._json)(_)
|
|
353
|
+
}));
|
|
354
|
+
return new protocol_http_1.HttpRequest({
|
|
355
|
+
protocol,
|
|
356
|
+
hostname,
|
|
357
|
+
port,
|
|
358
|
+
method: "POST",
|
|
359
|
+
headers,
|
|
360
|
+
path: resolvedPath,
|
|
361
|
+
body
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
var se_StartDeviceAuthorizationCommand = async (input, context) => {
|
|
365
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
366
|
+
const headers = {
|
|
367
|
+
"content-type": "application/json"
|
|
368
|
+
};
|
|
369
|
+
const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}/device_authorization`;
|
|
370
|
+
let body;
|
|
371
|
+
body = JSON.stringify((0, smithy_client_6.take)(input, {
|
|
372
|
+
clientId: [],
|
|
373
|
+
clientSecret: [],
|
|
374
|
+
startUrl: []
|
|
375
|
+
}));
|
|
376
|
+
return new protocol_http_1.HttpRequest({
|
|
377
|
+
protocol,
|
|
378
|
+
hostname,
|
|
379
|
+
port,
|
|
380
|
+
method: "POST",
|
|
381
|
+
headers,
|
|
382
|
+
path: resolvedPath,
|
|
383
|
+
body
|
|
384
|
+
});
|
|
385
|
+
};
|
|
428
386
|
var de_CreateTokenCommand = async (output, context) => {
|
|
429
387
|
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
430
388
|
return de_CreateTokenCommandError(output, context);
|
|
@@ -492,6 +450,103 @@ var de_CreateTokenCommandError = async (output, context) => {
|
|
|
492
450
|
});
|
|
493
451
|
}
|
|
494
452
|
};
|
|
453
|
+
var de_RegisterClientCommand = async (output, context) => {
|
|
454
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
455
|
+
return de_RegisterClientCommandError(output, context);
|
|
456
|
+
}
|
|
457
|
+
const contents = (0, smithy_client_6.map)({
|
|
458
|
+
$metadata: deserializeMetadata(output)
|
|
459
|
+
});
|
|
460
|
+
const data = (0, smithy_client_6.expectNonNull)((0, smithy_client_6.expectObject)(await parseBody(output.body, context)), "body");
|
|
461
|
+
const doc = (0, smithy_client_6.take)(data, {
|
|
462
|
+
authorizationEndpoint: smithy_client_6.expectString,
|
|
463
|
+
clientId: smithy_client_6.expectString,
|
|
464
|
+
clientIdIssuedAt: smithy_client_6.expectLong,
|
|
465
|
+
clientSecret: smithy_client_6.expectString,
|
|
466
|
+
clientSecretExpiresAt: smithy_client_6.expectLong,
|
|
467
|
+
tokenEndpoint: smithy_client_6.expectString
|
|
468
|
+
});
|
|
469
|
+
Object.assign(contents, doc);
|
|
470
|
+
return contents;
|
|
471
|
+
};
|
|
472
|
+
var de_RegisterClientCommandError = async (output, context) => {
|
|
473
|
+
const parsedOutput = {
|
|
474
|
+
...output,
|
|
475
|
+
body: await parseErrorBody(output.body, context)
|
|
476
|
+
};
|
|
477
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
478
|
+
switch (errorCode) {
|
|
479
|
+
case "InternalServerException":
|
|
480
|
+
case "com.amazonaws.ssooidc#InternalServerException":
|
|
481
|
+
throw await de_InternalServerExceptionRes(parsedOutput, context);
|
|
482
|
+
case "InvalidClientMetadataException":
|
|
483
|
+
case "com.amazonaws.ssooidc#InvalidClientMetadataException":
|
|
484
|
+
throw await de_InvalidClientMetadataExceptionRes(parsedOutput, context);
|
|
485
|
+
case "InvalidRequestException":
|
|
486
|
+
case "com.amazonaws.ssooidc#InvalidRequestException":
|
|
487
|
+
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
|
488
|
+
case "InvalidScopeException":
|
|
489
|
+
case "com.amazonaws.ssooidc#InvalidScopeException":
|
|
490
|
+
throw await de_InvalidScopeExceptionRes(parsedOutput, context);
|
|
491
|
+
default:
|
|
492
|
+
const parsedBody = parsedOutput.body;
|
|
493
|
+
return throwDefaultError({
|
|
494
|
+
output,
|
|
495
|
+
parsedBody,
|
|
496
|
+
errorCode
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
var de_StartDeviceAuthorizationCommand = async (output, context) => {
|
|
501
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
502
|
+
return de_StartDeviceAuthorizationCommandError(output, context);
|
|
503
|
+
}
|
|
504
|
+
const contents = (0, smithy_client_6.map)({
|
|
505
|
+
$metadata: deserializeMetadata(output)
|
|
506
|
+
});
|
|
507
|
+
const data = (0, smithy_client_6.expectNonNull)((0, smithy_client_6.expectObject)(await parseBody(output.body, context)), "body");
|
|
508
|
+
const doc = (0, smithy_client_6.take)(data, {
|
|
509
|
+
deviceCode: smithy_client_6.expectString,
|
|
510
|
+
expiresIn: smithy_client_6.expectInt32,
|
|
511
|
+
interval: smithy_client_6.expectInt32,
|
|
512
|
+
userCode: smithy_client_6.expectString,
|
|
513
|
+
verificationUri: smithy_client_6.expectString,
|
|
514
|
+
verificationUriComplete: smithy_client_6.expectString
|
|
515
|
+
});
|
|
516
|
+
Object.assign(contents, doc);
|
|
517
|
+
return contents;
|
|
518
|
+
};
|
|
519
|
+
var de_StartDeviceAuthorizationCommandError = async (output, context) => {
|
|
520
|
+
const parsedOutput = {
|
|
521
|
+
...output,
|
|
522
|
+
body: await parseErrorBody(output.body, context)
|
|
523
|
+
};
|
|
524
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
525
|
+
switch (errorCode) {
|
|
526
|
+
case "InternalServerException":
|
|
527
|
+
case "com.amazonaws.ssooidc#InternalServerException":
|
|
528
|
+
throw await de_InternalServerExceptionRes(parsedOutput, context);
|
|
529
|
+
case "InvalidClientException":
|
|
530
|
+
case "com.amazonaws.ssooidc#InvalidClientException":
|
|
531
|
+
throw await de_InvalidClientExceptionRes(parsedOutput, context);
|
|
532
|
+
case "InvalidRequestException":
|
|
533
|
+
case "com.amazonaws.ssooidc#InvalidRequestException":
|
|
534
|
+
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
|
535
|
+
case "SlowDownException":
|
|
536
|
+
case "com.amazonaws.ssooidc#SlowDownException":
|
|
537
|
+
throw await de_SlowDownExceptionRes(parsedOutput, context);
|
|
538
|
+
case "UnauthorizedClientException":
|
|
539
|
+
case "com.amazonaws.ssooidc#UnauthorizedClientException":
|
|
540
|
+
throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
|
|
541
|
+
default:
|
|
542
|
+
const parsedBody = parsedOutput.body;
|
|
543
|
+
return throwDefaultError({
|
|
544
|
+
output,
|
|
545
|
+
parsedBody,
|
|
546
|
+
errorCode
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
};
|
|
495
550
|
var throwDefaultError = (0, smithy_client_6.withBaseException)(SSOOIDCServiceException);
|
|
496
551
|
var de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
|
|
497
552
|
const contents = (0, smithy_client_6.map)({});
|
|
@@ -563,6 +618,20 @@ var de_InvalidClientExceptionRes = async (parsedOutput, context) => {
|
|
|
563
618
|
});
|
|
564
619
|
return (0, smithy_client_6.decorateServiceException)(exception, parsedOutput.body);
|
|
565
620
|
};
|
|
621
|
+
var de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => {
|
|
622
|
+
const contents = (0, smithy_client_6.map)({});
|
|
623
|
+
const data = parsedOutput.body;
|
|
624
|
+
const doc = (0, smithy_client_6.take)(data, {
|
|
625
|
+
error: smithy_client_6.expectString,
|
|
626
|
+
error_description: smithy_client_6.expectString
|
|
627
|
+
});
|
|
628
|
+
Object.assign(contents, doc);
|
|
629
|
+
const exception = new InvalidClientMetadataException({
|
|
630
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
631
|
+
...contents
|
|
632
|
+
});
|
|
633
|
+
return (0, smithy_client_6.decorateServiceException)(exception, parsedOutput.body);
|
|
634
|
+
};
|
|
566
635
|
var de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
|
|
567
636
|
const contents = (0, smithy_client_6.map)({});
|
|
568
637
|
const data = parsedOutput.body;
|
|
@@ -736,3 +805,91 @@ var CreateTokenCommand = class _CreateTokenCommand extends smithy_client_5.Comma
|
|
|
736
805
|
}
|
|
737
806
|
};
|
|
738
807
|
exports.CreateTokenCommand = CreateTokenCommand;
|
|
808
|
+
const middleware_endpoint_3 = require("@smithy/middleware-endpoint");
|
|
809
|
+
const middleware_serde_2 = require("@smithy/middleware-serde");
|
|
810
|
+
const smithy_client_8 = require("@smithy/smithy-client");
|
|
811
|
+
var RegisterClientCommand = class _RegisterClientCommand extends smithy_client_8.Command {
|
|
812
|
+
constructor(input) {
|
|
813
|
+
super();
|
|
814
|
+
this.input = input;
|
|
815
|
+
}
|
|
816
|
+
static getEndpointParameterInstructions() {
|
|
817
|
+
return {
|
|
818
|
+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
|
819
|
+
Endpoint: { type: "builtInParams", name: "endpoint" },
|
|
820
|
+
Region: { type: "builtInParams", name: "region" },
|
|
821
|
+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
resolveMiddleware(clientStack, configuration, options) {
|
|
825
|
+
this.middlewareStack.use((0, middleware_serde_2.getSerdePlugin)(configuration, this.serialize, this.deserialize));
|
|
826
|
+
this.middlewareStack.use((0, middleware_endpoint_3.getEndpointPlugin)(configuration, _RegisterClientCommand.getEndpointParameterInstructions()));
|
|
827
|
+
const stack = clientStack.concat(this.middlewareStack);
|
|
828
|
+
const { logger } = configuration;
|
|
829
|
+
const clientName = "SSOOIDCClient";
|
|
830
|
+
const commandName = "RegisterClientCommand";
|
|
831
|
+
const handlerExecutionContext = {
|
|
832
|
+
logger,
|
|
833
|
+
clientName,
|
|
834
|
+
commandName,
|
|
835
|
+
inputFilterSensitiveLog: (_) => _,
|
|
836
|
+
outputFilterSensitiveLog: (_) => _
|
|
837
|
+
};
|
|
838
|
+
const { requestHandler } = configuration;
|
|
839
|
+
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
|
|
840
|
+
}
|
|
841
|
+
serialize(input, context) {
|
|
842
|
+
return se_RegisterClientCommand(input, context);
|
|
843
|
+
}
|
|
844
|
+
deserialize(output, context) {
|
|
845
|
+
return de_RegisterClientCommand(output, context);
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
const middleware_endpoint_4 = require("@smithy/middleware-endpoint");
|
|
849
|
+
const middleware_serde_3 = require("@smithy/middleware-serde");
|
|
850
|
+
const smithy_client_9 = require("@smithy/smithy-client");
|
|
851
|
+
var StartDeviceAuthorizationCommand = class _StartDeviceAuthorizationCommand extends smithy_client_9.Command {
|
|
852
|
+
constructor(input) {
|
|
853
|
+
super();
|
|
854
|
+
this.input = input;
|
|
855
|
+
}
|
|
856
|
+
static getEndpointParameterInstructions() {
|
|
857
|
+
return {
|
|
858
|
+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
|
859
|
+
Endpoint: { type: "builtInParams", name: "endpoint" },
|
|
860
|
+
Region: { type: "builtInParams", name: "region" },
|
|
861
|
+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
resolveMiddleware(clientStack, configuration, options) {
|
|
865
|
+
this.middlewareStack.use((0, middleware_serde_3.getSerdePlugin)(configuration, this.serialize, this.deserialize));
|
|
866
|
+
this.middlewareStack.use((0, middleware_endpoint_4.getEndpointPlugin)(configuration, _StartDeviceAuthorizationCommand.getEndpointParameterInstructions()));
|
|
867
|
+
const stack = clientStack.concat(this.middlewareStack);
|
|
868
|
+
const { logger } = configuration;
|
|
869
|
+
const clientName = "SSOOIDCClient";
|
|
870
|
+
const commandName = "StartDeviceAuthorizationCommand";
|
|
871
|
+
const handlerExecutionContext = {
|
|
872
|
+
logger,
|
|
873
|
+
clientName,
|
|
874
|
+
commandName,
|
|
875
|
+
inputFilterSensitiveLog: (_) => _,
|
|
876
|
+
outputFilterSensitiveLog: (_) => _
|
|
877
|
+
};
|
|
878
|
+
const { requestHandler } = configuration;
|
|
879
|
+
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
|
|
880
|
+
}
|
|
881
|
+
serialize(input, context) {
|
|
882
|
+
return se_StartDeviceAuthorizationCommand(input, context);
|
|
883
|
+
}
|
|
884
|
+
deserialize(output, context) {
|
|
885
|
+
return de_StartDeviceAuthorizationCommand(output, context);
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
var commands = {
|
|
889
|
+
CreateTokenCommand,
|
|
890
|
+
RegisterClientCommand,
|
|
891
|
+
StartDeviceAuthorizationCommand
|
|
892
|
+
};
|
|
893
|
+
var SSOOIDC = class extends SSOOIDCClient {
|
|
894
|
+
};
|
|
895
|
+
(0, smithy_client_4.createAggregatedClient)(commands, SSOOIDC);
|