@smithy/experimental-identity-and-auth 0.0.16 → 0.0.18

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.
@@ -17,6 +17,9 @@ class HttpApiKeyAuthSigner {
17
17
  if (!signingProperties.in) {
18
18
  throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing");
19
19
  }
20
+ if (!identity.apiKey) {
21
+ throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined");
22
+ }
20
23
  const clonedRequest = httpRequest.clone();
21
24
  if (signingProperties.in === HttpApiKeyAuthLocation.QUERY) {
22
25
  clonedRequest.query[signingProperties.name] = identity.apiKey;
@@ -4,6 +4,9 @@ exports.HttpBearerAuthSigner = void 0;
4
4
  class HttpBearerAuthSigner {
5
5
  async sign(httpRequest, identity, signingProperties) {
6
6
  const clonedRequest = httpRequest.clone();
7
+ if (!identity.token) {
8
+ throw new Error("request could not be signed with `token` since the `token` is not defined");
9
+ }
7
10
  clonedRequest.headers["Authorization"] = `Bearer ${identity.token}`;
8
11
  return clonedRequest;
9
12
  }
@@ -14,6 +14,9 @@ export class HttpApiKeyAuthSigner {
14
14
  if (!signingProperties.in) {
15
15
  throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing");
16
16
  }
17
+ if (!identity.apiKey) {
18
+ throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined");
19
+ }
17
20
  const clonedRequest = httpRequest.clone();
18
21
  if (signingProperties.in === HttpApiKeyAuthLocation.QUERY) {
19
22
  clonedRequest.query[signingProperties.name] = identity.apiKey;
@@ -1,6 +1,9 @@
1
1
  export class HttpBearerAuthSigner {
2
2
  async sign(httpRequest, identity, signingProperties) {
3
3
  const clonedRequest = httpRequest.clone();
4
+ if (!identity.token) {
5
+ throw new Error("request could not be signed with `token` since the `token` is not defined");
6
+ }
4
7
  clonedRequest.headers["Authorization"] = `Bearer ${identity.token}`;
5
8
  return clonedRequest;
6
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/experimental-identity-and-auth",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "yarn g:tsc -p tsconfig.cjs.json",
@@ -24,13 +24,12 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@smithy/middleware-endpoint": "^2.1.0",
27
+ "@smithy/middleware-endpoint": "^2.1.1",
28
28
  "@smithy/middleware-retry": "^2.0.16",
29
29
  "@smithy/middleware-serde": "^2.0.11",
30
30
  "@smithy/protocol-http": "^3.0.7",
31
31
  "@smithy/signature-v4": "^2.0.11",
32
32
  "@smithy/types": "^2.3.5",
33
- "@smithy/util-test": "^0.1.7",
34
33
  "tslib": "^2.5.0"
35
34
  },
36
35
  "engines": {
@@ -53,6 +52,7 @@
53
52
  "directory": "packages/experimental-identity-and-auth"
54
53
  },
55
54
  "devDependencies": {
55
+ "@smithy/util-test": "^0.1.7",
56
56
  "@tsconfig/recommended": "1.0.1",
57
57
  "concurrently": "7.0.0",
58
58
  "downlevel-dts": "0.10.1",