Turn off fetching authorization token (#1766)
This commit is contained in:
parent
f881f7fd2f
commit
91d9e27049
|
@ -1,7 +1,6 @@
|
||||||
import * as Cosmos from "@azure/cosmos";
|
import * as Cosmos from "@azure/cosmos";
|
||||||
import { sendCachedDataMessage } from "Common/MessageHandler";
|
|
||||||
import { getAuthorizationTokenUsingResourceTokens } from "Common/getAuthorizationTokenUsingResourceTokens";
|
import { getAuthorizationTokenUsingResourceTokens } from "Common/getAuthorizationTokenUsingResourceTokens";
|
||||||
import { AuthorizationToken, MessageTypes } from "Contracts/MessageTypes";
|
import { AuthorizationToken } from "Contracts/MessageTypes";
|
||||||
import { checkDatabaseResourceTokensValidity } from "Platform/Fabric/FabricUtil";
|
import { checkDatabaseResourceTokensValidity } from "Platform/Fabric/FabricUtil";
|
||||||
import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility";
|
import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility";
|
||||||
import { AuthType } from "../AuthType";
|
import { AuthType } from "../AuthType";
|
||||||
|
@ -51,15 +50,23 @@ export const tokenProvider = async (requestInfo: Cosmos.RequestInfo) => {
|
||||||
case Cosmos.ResourceType.offer:
|
case Cosmos.ResourceType.offer:
|
||||||
case Cosmos.ResourceType.user:
|
case Cosmos.ResourceType.user:
|
||||||
case Cosmos.ResourceType.permission:
|
case Cosmos.ResourceType.permission:
|
||||||
// User master tokens
|
// For now, these operations aren't used, so fetching the authorization token is commented out.
|
||||||
const authorizationToken = await sendCachedDataMessage<AuthorizationToken>(
|
// This provider must return a real token to pass validation by the client, so we return the cached resource token
|
||||||
MessageTypes.GetAuthorizationToken,
|
// (which is a valid token, but won't work for these operations).
|
||||||
[requestInfo],
|
const resourceTokens2 = userContext.fabricContext.databaseConnectionInfo.resourceTokens;
|
||||||
userContext.fabricContext.connectionId,
|
return getAuthorizationTokenUsingResourceTokens(resourceTokens2, requestInfo.path, requestInfo.resourceId);
|
||||||
);
|
|
||||||
console.log("Response from Fabric: ", authorizationToken);
|
/* ************** TODO: Uncomment this code if we need to support these operations **************
|
||||||
headers[HttpHeaders.msDate] = authorizationToken.XDate;
|
// User master tokens
|
||||||
return decodeURIComponent(authorizationToken.PrimaryReadWriteToken);
|
const authorizationToken = await sendCachedDataMessage<AuthorizationToken>(
|
||||||
|
MessageTypes.GetAuthorizationToken,
|
||||||
|
[requestInfo],
|
||||||
|
userContext.fabricContext.connectionId,
|
||||||
|
);
|
||||||
|
console.log("Response from Fabric: ", authorizationToken);
|
||||||
|
headers[HttpHeaders.msDate] = authorizationToken.XDate;
|
||||||
|
return decodeURIComponent(authorizationToken.PrimaryReadWriteToken);
|
||||||
|
***********************************************************************************************/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue