@@ -177,13 +177,13 @@ public async Task BearerTokenHappyPath(
177177 }
178178
179179 [ DataTestMethod ]
180- [ DataRow ( UserAssignedIdentityId . None , null ) ] // SAMI
181- [ DataRow ( UserAssignedIdentityId . ClientId , TestConstants . ClientId ) ] // UAMI
182- [ DataRow ( UserAssignedIdentityId . ResourceId , TestConstants . MiResourceId ) ] // UAMI
183- [ DataRow ( UserAssignedIdentityId . ObjectId , TestConstants . ObjectId ) ] // UAMI
184- public async Task BearerTokenTokenIsPerIdentity (
180+ [ DataRow ( UserAssignedIdentityId . ClientId , TestConstants . ClientId , $ "{ TestConstants . ClientId } -2") ]
181+ [ DataRow ( UserAssignedIdentityId . ResourceId , TestConstants . MiResourceId , $ "{ TestConstants . MiResourceId } -2") ]
182+ [ DataRow ( UserAssignedIdentityId . ObjectId , TestConstants . ObjectId , $ "{ TestConstants . ObjectId } -2") ]
183+ public async Task BearerTokenIsPerIdentity (
185184 UserAssignedIdentityId userAssignedIdentityId ,
186- string userAssignedId )
185+ string userAssignedId ,
186+ string userAssignedId2 )
187187 {
188188 using ( var httpManager = new MockHttpManager ( ) )
189189 {
@@ -210,26 +210,25 @@ public async Task BearerTokenTokenIsPerIdentity(
210210 #endregion Identity 1
211211
212212 #region Identity 2
213- UserAssignedIdentityId identity2Type = userAssignedIdentityId ; // keep the same type, that's the most common scenario
214- string identity2Id = "some_other_id" ;
215- var managedIdentityApp2 = await CreateManagedIdentityAsync ( httpManager , identity2Type , identity2Id , addProbeMock : false , addSourceCheck : false ) . ConfigureAwait ( false ) ; // source is already cached
213+ UserAssignedIdentityId userAssignedIdentityId2 = userAssignedIdentityId ; // keep the same type, that's the most common scenario
214+ var managedIdentityApp2 = await CreateManagedIdentityAsync ( httpManager , userAssignedIdentityId2 , userAssignedId2 , addProbeMock : false , addSourceCheck : false ) . ConfigureAwait ( false ) ; // source is already cached
216215
217- AddMocksToGetEntraToken ( httpManager , identity2Type , identity2Id ) ;
216+ AddMocksToGetEntraToken ( httpManager , userAssignedIdentityId2 , userAssignedId2 ) ;
218217
219218 var result2 = await managedIdentityApp2 . AcquireTokenForManagedIdentity ( ManagedIdentityTests . Resource )
220219 . ExecuteAsync ( ) . ConfigureAwait ( false ) ;
221220
222221 Assert . IsNotNull ( result2 ) ;
223222 Assert . IsNotNull ( result2 . AccessToken ) ;
224- Assert . AreEqual ( result . TokenType , Bearer ) ;
223+ Assert . AreEqual ( result2 . TokenType , Bearer ) ;
225224 Assert . AreEqual ( TokenSource . IdentityProvider , result2 . AuthenticationResultMetadata . TokenSource ) ;
226225
227226 result2 = await managedIdentityApp2 . AcquireTokenForManagedIdentity ( ManagedIdentityTests . Resource )
228227 . ExecuteAsync ( ) . ConfigureAwait ( false ) ;
229228
230229 Assert . IsNotNull ( result2 ) ;
231230 Assert . IsNotNull ( result2 . AccessToken ) ;
232- Assert . AreEqual ( result . TokenType , Bearer ) ;
231+ Assert . AreEqual ( result2 . TokenType , Bearer ) ;
233232 Assert . AreEqual ( TokenSource . Cache , result2 . AuthenticationResultMetadata . TokenSource ) ;
234233 #endregion Identity 2
235234
@@ -320,13 +319,13 @@ public async Task mTLSPopTokenHappyPath(
320319 }
321320
322321 [ DataTestMethod ]
323- [ DataRow ( UserAssignedIdentityId . None , null ) ] // SAMI
324- [ DataRow ( UserAssignedIdentityId . ClientId , TestConstants . ClientId ) ] // UAMI
325- [ DataRow ( UserAssignedIdentityId . ResourceId , TestConstants . MiResourceId ) ] // UAMI
326- [ DataRow ( UserAssignedIdentityId . ObjectId , TestConstants . ObjectId ) ] // UAMI
327- public async Task mTLSPopTokenTokenIsPerIdentity (
322+ [ DataRow ( UserAssignedIdentityId . ClientId , TestConstants . ClientId , $ "{ TestConstants . ClientId } -2") ]
323+ [ DataRow ( UserAssignedIdentityId . ResourceId , TestConstants . MiResourceId , $ "{ TestConstants . MiResourceId } -2") ]
324+ [ DataRow ( UserAssignedIdentityId . ObjectId , TestConstants . ObjectId , $ "{ TestConstants . ObjectId } -2") ]
325+ public async Task mTLSPopTokenIsPerIdentity (
328326 UserAssignedIdentityId userAssignedIdentityId ,
329- string userAssignedId )
327+ string userAssignedId ,
328+ string userAssignedId2 )
330329 {
331330 using ( var httpManager = new MockHttpManager ( ) )
332331 {
@@ -359,17 +358,16 @@ public async Task mTLSPopTokenTokenIsPerIdentity(
359358 #endregion Identity 1
360359
361360 #region Identity 2
362- UserAssignedIdentityId identity2Type = userAssignedIdentityId ; // keep the same type, that's the most common scenario
363- string identity2Id = "some_other_id" ;
361+ UserAssignedIdentityId userAssignedIdentityId2 = userAssignedIdentityId ; // keep the same type, that's the most common scenario
364362 var managedIdentityApp2 = await CreateManagedIdentityAsync (
365363 httpManager ,
366- identity2Type ,
367- identity2Id ,
364+ userAssignedIdentityId2 ,
365+ userAssignedId2 ,
368366 addProbeMock : false ,
369367 addSourceCheck : false ,
370368 managedIdentityKeyType : ManagedIdentityKeyType . KeyGuard ) . ConfigureAwait ( false ) ; // source is already cached
371369
372- AddMocksToGetEntraToken ( httpManager , identity2Type , identity2Id , mTLSPop : true ) ;
370+ AddMocksToGetEntraToken ( httpManager , userAssignedIdentityId2 , userAssignedId2 , mTLSPop : true ) ;
373371
374372 var result2 = await managedIdentityApp2 . AcquireTokenForManagedIdentity ( ManagedIdentityTests . Resource )
375373 . WithMtlsProofOfPossession ( )
@@ -378,8 +376,8 @@ public async Task mTLSPopTokenTokenIsPerIdentity(
378376
379377 Assert . IsNotNull ( result2 ) ;
380378 Assert . IsNotNull ( result2 . AccessToken ) ;
381- Assert . AreEqual ( result . TokenType , MTLSPoP ) ;
382- // Assert.IsNotNull(result .BindingCertificate); // TODO: implement mTLS Pop BindingCertificate
379+ Assert . AreEqual ( result2 . TokenType , MTLSPoP ) ;
380+ // Assert.IsNotNull(result2 .BindingCertificate); // TODO: implement mTLS Pop BindingCertificate
383381 Assert . AreEqual ( TokenSource . IdentityProvider , result2 . AuthenticationResultMetadata . TokenSource ) ;
384382
385383 // TODO: broken until Gladwin's PR is merged in
@@ -390,8 +388,8 @@ public async Task mTLSPopTokenTokenIsPerIdentity(
390388
391389 Assert.IsNotNull(result2);
392390 Assert.IsNotNull(result2.AccessToken);
393- Assert.AreEqual(result .TokenType, MTLSPoP);
394- // Assert.IsNotNull(result .BindingCertificate); // TODO: implement mTLS Pop BindingCertificate
391+ Assert.AreEqual(result2 .TokenType, MTLSPoP);
392+ // Assert.IsNotNull(result2 .BindingCertificate); // TODO: implement mTLS Pop BindingCertificate
395393 Assert.AreEqual(TokenSource.Cache, result2.AuthenticationResultMetadata.TokenSource);*/
396394 #endregion Identity 2
397395
0 commit comments