UNPKG

@aws-amplify/auth

Version:
1 lines 2.07 kB
{"version":3,"file":"CognitoUserPoolsTokenProvider.mjs","sources":["../../../../../src/providers/cognito/tokenProvider/CognitoUserPoolsTokenProvider.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { defaultStorage, } from '@aws-amplify/core';\nimport { refreshAuthTokens } from '../utils/refreshAuthTokens';\nimport { DefaultTokenStore } from './TokenStore';\nimport { TokenOrchestrator } from './TokenOrchestrator';\nexport class CognitoUserPoolsTokenProvider {\n constructor() {\n this.authTokenStore = new DefaultTokenStore();\n this.authTokenStore.setKeyValueStorage(defaultStorage);\n this.tokenOrchestrator = new TokenOrchestrator();\n this.tokenOrchestrator.setAuthTokenStore(this.authTokenStore);\n this.tokenOrchestrator.setTokenRefresher(refreshAuthTokens);\n }\n getTokens({ forceRefresh } = { forceRefresh: false }) {\n return this.tokenOrchestrator.getTokens({ forceRefresh });\n }\n setKeyValueStorage(keyValueStorage) {\n this.authTokenStore.setKeyValueStorage(keyValueStorage);\n }\n setAuthConfig(authConfig) {\n this.authTokenStore.setAuthConfig(authConfig);\n this.tokenOrchestrator.setAuthConfig(authConfig);\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKO,MAAM,6BAA6B,CAAC;AAC3C,IAAI,WAAW,GAAG;AAClB,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,iBAAiB,EAAE;AACrD,QAAQ,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC;AAC9D,QAAQ,IAAI,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,EAAE;AACxD,QAAQ,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC;AACrE,QAAQ,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,iBAAiB,CAAC;AACnE;AACA,IAAI,SAAS,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE;AAC1D,QAAQ,OAAO,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;AACjE;AACA,IAAI,kBAAkB,CAAC,eAAe,EAAE;AACxC,QAAQ,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,eAAe,CAAC;AAC/D;AACA,IAAI,aAAa,CAAC,UAAU,EAAE;AAC9B,QAAQ,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,UAAU,CAAC;AACrD,QAAQ,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,UAAU,CAAC;AACxD;AACA;;;;"}