Skip to content

Commit 338496a

Browse files
[Identity] Remove proactive refresh in for Managed Identity (Azure#25535)
1 parent 409573a commit 338496a

File tree

12 files changed

+7
-125
lines changed

12 files changed

+7
-125
lines changed

sdk/identity/identity/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
### Features Added
66

7-
- Enabled proactive token refresh for Managed Identity.
87
- Added configurable process timeout for dev-time credentials - `AzureCLI Credential`, `AzurePowershell Credential` and `AzureDeveloperCLI Credential`.
98

109
### Breaking Changes

sdk/identity/identity/src/client/identityClient.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { TokenCredentialOptions } from "../tokenCredentialOptions";
2121
import {
2222
TokenResponseParsedBody,
2323
parseExpirationTimestamp,
24-
parseRefreshTimestamp,
2524
} from "../credentials/managedIdentityCredential/utils";
2625

2726
const noCorrelationId = "noCorrelationId";
@@ -35,11 +34,6 @@ export interface TokenResponse {
3534
* The AccessToken to be returned from getToken.
3635
*/
3736
accessToken: AccessToken;
38-
/**
39-
* The time in which the access token should be refreshed,
40-
* specified in milliseconds, UNIX epoch time
41-
*/
42-
refreshesIn?: number;
4337
/**
4438
* The refresh token if the 'offline_access' scope was used.
4539
*/
@@ -124,7 +118,6 @@ export class IdentityClient extends ServiceClient implements INetworkModule {
124118
token: parsedBody.access_token,
125119
expiresOnTimestamp: parseExpirationTimestamp(parsedBody),
126120
},
127-
refreshesIn: parseRefreshTimestamp(parsedBody),
128121
refreshToken: parsedBody.refresh_token,
129122
};
130123

sdk/identity/identity/src/credentials/managedIdentityCredential/appServiceMsi2017.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,6 @@ export const appServiceMsi2017: MSI = {
9898
allowInsecureConnection: true,
9999
});
100100
const tokenResponse = await identityClient.sendTokenRequest(request);
101-
return (
102-
(tokenResponse && { ...tokenResponse.accessToken, refreshesOn: tokenResponse.refreshesIn }) ||
103-
null
104-
);
101+
return (tokenResponse && tokenResponse.accessToken) || null;
105102
},
106103
};

sdk/identity/identity/src/credentials/managedIdentityCredential/appServiceMsi2019.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ export const appServiceMsi2019: MSI = {
9696
allowInsecureConnection: true,
9797
});
9898
const tokenResponse = await identityClient.sendTokenRequest(request);
99-
return (
100-
(tokenResponse && { ...tokenResponse.accessToken, refreshesOn: tokenResponse.refreshesIn }) ||
101-
null
102-
);
99+
return (tokenResponse && tokenResponse.accessToken) || null;
103100
},
104101
};

sdk/identity/identity/src/credentials/managedIdentityCredential/arcMsi.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ export const arcMsi: MSI = {
164164
allowInsecureConnection: true,
165165
});
166166
const tokenResponse = await identityClient.sendTokenRequest(request);
167-
return (
168-
(tokenResponse && { ...tokenResponse.accessToken, refreshesOn: tokenResponse.refreshesIn }) ||
169-
null
170-
);
167+
return (tokenResponse && tokenResponse.accessToken) || null;
171168
},
172169
};

sdk/identity/identity/src/credentials/managedIdentityCredential/cloudShellMsi.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ export const cloudShellMsi: MSI = {
103103
allowInsecureConnection: true,
104104
});
105105
const tokenResponse = await identityClient.sendTokenRequest(request);
106-
return (
107-
(tokenResponse && { ...tokenResponse.accessToken, refreshesOn: tokenResponse.refreshesIn }) ||
108-
null
109-
);
106+
return (tokenResponse && tokenResponse.accessToken) || null;
110107
},
111108
};

sdk/identity/identity/src/credentials/managedIdentityCredential/fabricMsi.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@ export const fabricMsi: MSI = {
129129
});
130130

131131
const tokenResponse = await identityClient.sendTokenRequest(request);
132-
return (
133-
(tokenResponse && { ...tokenResponse.accessToken, refreshesOn: tokenResponse.refreshesIn }) ||
134-
null
135-
);
132+
return (tokenResponse && tokenResponse.accessToken) || null;
136133
},
137134
};

sdk/identity/identity/src/credentials/managedIdentityCredential/imdsMsi.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,7 @@ export const imdsMsi: MSI = {
175175
});
176176
const tokenResponse = await identityClient.sendTokenRequest(request);
177177

178-
return (
179-
(tokenResponse && {
180-
...tokenResponse.accessToken,
181-
refreshesOn: tokenResponse.refreshesIn,
182-
}) ||
183-
null
184-
);
178+
return (tokenResponse && tokenResponse.accessToken) || null;
185179
} catch (error: any) {
186180
if (error.statusCode === 404) {
187181
await delay(nextDelayInMs);

sdk/identity/identity/src/credentials/managedIdentityCredential/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,9 @@ export class ManagedIdentityCredential implements TokenCredential {
264264
const expiresInSeconds = resultToken?.expiresOnTimestamp
265265
? Math.floor((resultToken.expiresOnTimestamp - Date.now()) / 1000)
266266
: 0;
267-
const refreshInSeconds = resultToken?.refreshesOn
268-
? Math.floor((resultToken.refreshesOn - Date.now()) / 1000)
269-
: 0;
270267
return {
271268
accessToken: resultToken?.token,
272269
expiresInSeconds,
273-
refreshInSeconds,
274270
};
275271
} else {
276272
logger.info(
@@ -279,7 +275,6 @@ export class ManagedIdentityCredential implements TokenCredential {
279275
return {
280276
accessToken: "no_access_token_returned",
281277
expiresInSeconds: 0,
282-
refreshInSeconds: 0,
283278
};
284279
}
285280
}

sdk/identity/identity/src/credentials/managedIdentityCredential/models.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ export interface MSIConfiguration {
1919
* Represents an access token for {@link ManagedIdentity} for internal usage,
2020
* with an expiration time and the time in which token should refresh.
2121
*/
22-
export declare interface MSIToken extends AccessToken {
23-
/**
24-
* The time in which token should refresh,
25-
* specified in milliseconds, UNIX epoch time.
26-
*/
27-
refreshesOn?: number;
28-
}
22+
export declare interface MSIToken extends AccessToken {}
2923

3024
/**
3125
* @internal

0 commit comments

Comments
 (0)