mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-03 23:26:09 +00:00
Address PR comments for Azure Client Secret Rotation
This commit is contained in:
+2
-6
@@ -153,12 +153,8 @@ export const azureClientSecretRotationFactory: TRotationFactory<
|
||||
* Maps the generated credentials into the secret payload format.
|
||||
*/
|
||||
const getSecretsPayload: TRotationFactoryGetSecretsPayload<TAzureClientSecretRotationGeneratedCredentials> = ({
|
||||
clientSecret,
|
||||
clientId
|
||||
}) => [
|
||||
{ key: secretsMapping.clientSecret, value: clientSecret },
|
||||
{ key: secretsMapping.clientId, value: clientId }
|
||||
];
|
||||
clientSecret
|
||||
}) => [{ key: secretsMapping.clientSecret, value: clientSecret }];
|
||||
|
||||
return {
|
||||
issueCredentials,
|
||||
|
||||
+1
-8
@@ -31,8 +31,6 @@ export const getAzureClientSecretsConnectionListItem = () => {
|
||||
};
|
||||
};
|
||||
|
||||
const EXPIRATION_TIME = 300000;
|
||||
|
||||
export const getAzureConnectionAccessToken = async (
|
||||
connectionId: string,
|
||||
appConnectionDAL: Pick<TAppConnectionDALFactory, "findById" | "updateById">,
|
||||
@@ -63,14 +61,9 @@ export const getAzureConnectionAccessToken = async (
|
||||
encryptedCredentials: appConnection.encryptedCredentials
|
||||
})) as TAzureClientSecretsConnectionCredentials;
|
||||
|
||||
const { expiresAt, refreshToken } = credentials;
|
||||
const { refreshToken } = credentials;
|
||||
const currentTime = Date.now();
|
||||
|
||||
// get new token if expired or less than 5 minutes until expiry
|
||||
if (currentTime < expiresAt - EXPIRATION_TIME) {
|
||||
return credentials.accessToken;
|
||||
}
|
||||
|
||||
const { data } = await request.post<ExchangeCodeAzureResponse>(
|
||||
IntegrationUrls.AZURE_TOKEN_URL.replace("common", credentials.tenantId || "common"),
|
||||
new URLSearchParams({
|
||||
|
||||
Reference in New Issue
Block a user