1515using Azure . Identity ;
1616using Azure . Core ;
1717using System . Threading ;
18+ using Microsoft . FeatureFlighting . Common ;
1819
1920[ assembly: InternalsVisibleTo ( "Microsoft.FeatureFlighting.Infrastructure.Tests" ) ]
2021
@@ -75,14 +76,14 @@ public bool IsAuthorized(string appName)
7576 return false ;
7677 }
7778
78- public async Task < string > GetAuthenticationToken ( string authority , string clientId , string resourceId , string userAssignedClientId )
79+ public async Task < string > GetAuthenticationToken ( string authority , string clientId , string resourceId )
7980 {
8081 AuthenticationResult authenticationResult ;
8182 const string MsalScopeSuffix = "/.default" ;
8283 string bearerToken = null ;
8384 try
8485 {
85- IConfidentialClientApplication app = GetOrCreateConfidentialApp ( authority , clientId , userAssignedClientId ) ;
86+ IConfidentialClientApplication app = GetOrCreateConfidentialApp ( authority , clientId ) ;
8687 if ( app != null )
8788 {
8889 var scopes = new [ ] { resourceId + MsalScopeSuffix } ;
@@ -97,7 +98,7 @@ public async Task<string> GetAuthenticationToken(string authority, string client
9798 return bearerToken ;
9899 }
99100
100- private IConfidentialClientApplication GetOrCreateConfidentialApp ( string authority , string clientId , string userAssignedClientId )
101+ private IConfidentialClientApplication GetOrCreateConfidentialApp ( string authority , string clientId )
101102 {
102103 string confidentialAppCacheKey = $ "{ authority } -{ clientId } ";
103104 if ( _confidentialApps . ContainsKey ( confidentialAppCacheKey ) )
@@ -115,7 +116,7 @@ private IConfidentialClientApplication GetOrCreateConfidentialApp(string authori
115116 _confidentialApps . TryAdd ( confidentialAppCacheKey , app ) ;
116117 return app ;
117118#else
118- var credential = new ManagedIdentityCredential ( userAssignedClientId ) ;
119+ var credential = ManagedIdentityHelper . GetTokenCredential ( ) ;
119120 IConfidentialClientApplication app =
120121 ConfidentialClientApplicationBuilder
121122 . Create ( clientId )
0 commit comments