File tree Expand file tree Collapse file tree 12 files changed +7
-125
lines changed
credentials/managedIdentityCredential Expand file tree Collapse file tree 12 files changed +7
-125
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ import { TokenCredentialOptions } from "../tokenCredentialOptions";
2121import {
2222 TokenResponseParsedBody ,
2323 parseExpirationTimestamp ,
24- parseRefreshTimestamp ,
2524} from "../credentials/managedIdentityCredential/utils" ;
2625
2726const 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
Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments