New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@aws-sdk/middleware-token

Package Overview
Dependencies
Maintainers
5
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-sdk/middleware-token - npm Package Compare versions

Comparing version 3.178.0 to 3.183.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
**Note:** Version bump only for package @aws-sdk/middleware-token
# [3.178.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.177.0...v3.178.0) (2022-09-23)

@@ -8,0 +16,0 @@

6

dist-es/getTokenPlugin.js
import { tokenMiddleware, TokenMiddlewareOptions } from "./tokenMiddleware";
export var getTokenPlugin = function (options) { return ({
applyToStack: function (clientStack) {
export const getTokenPlugin = (options) => ({
applyToStack: (clientStack) => {
clientStack.addRelativeTo(tokenMiddleware(options), TokenMiddlewareOptions);
},
}); };
});
import { memoize } from "@aws-sdk/property-provider";
import { normalizeProvider } from "@aws-sdk/util-middleware";
var isTokenWithExpiry = function (token) { return token.expiration !== undefined; };
var isTokenExpiringWithinFiveMins = function (token) {
return isTokenWithExpiry(token) && token.expiration.getTime() - Date.now() < 300000;
};
export var normalizeTokenProvider = function (token) {
const isTokenWithExpiry = (token) => token.expiration !== undefined;
const isTokenExpiringWithinFiveMins = (token) => isTokenWithExpiry(token) && token.expiration.getTime() - Date.now() < 300000;
export const normalizeTokenProvider = (token) => {
if (typeof token === "function") {

@@ -9,0 +7,0 @@ return memoize(token, isTokenExpiringWithinFiveMins, isTokenWithExpiry);

@@ -1,3 +0,5 @@

import { __assign } from "tslib";
import { normalizeTokenProvider } from "./normalizeTokenProvider";
export var resolveTokenConfig = function (input) { return (__assign(__assign({}, input), { token: input.token ? normalizeTokenProvider(input.token) : input.tokenDefaultProvider(input) })); };
export const resolveTokenConfig = (input) => ({
...input,
token: input.token ? normalizeTokenProvider(input.token) : input.tokenDefaultProvider(input),
});

@@ -1,4 +0,3 @@

import { __awaiter, __generator } from "tslib";
import { HttpRequest } from "@aws-sdk/protocol-http";
export var TokenMiddlewareOptions = {
export const TokenMiddlewareOptions = {
name: "tokenMiddleware",

@@ -10,20 +9,8 @@ tags: ["TOKEN"],

};
export var tokenMiddleware = function (options) {
return function (next) {
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
var token;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!HttpRequest.isInstance(args.request))
return [2, next(args)];
return [4, options.token()];
case 1:
token = _a.sent();
args.request.headers["Authorization"] = "Bearer ".concat(token.token);
return [2, next(args)];
}
});
}); };
};
export const tokenMiddleware = (options) => (next) => async (args) => {
if (!HttpRequest.isInstance(args.request))
return next(args);
const token = await options.token();
args.request.headers["Authorization"] = `Bearer ${token.token}`;
return next(args);
};
{
"name": "@aws-sdk/middleware-token",
"version": "3.178.0",
"version": "3.183.0",
"description": "Middleware and Plugin for setting token authentication",

@@ -28,6 +28,6 @@ "main": "./dist-cjs/index.js",

"dependencies": {
"@aws-sdk/property-provider": "3.178.0",
"@aws-sdk/protocol-http": "3.178.0",
"@aws-sdk/types": "3.178.0",
"@aws-sdk/util-middleware": "3.178.0",
"@aws-sdk/property-provider": "3.183.0",
"@aws-sdk/protocol-http": "3.183.0",
"@aws-sdk/types": "3.183.0",
"@aws-sdk/util-middleware": "3.183.0",
"tslib": "^2.3.1"

@@ -34,0 +34,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc