You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DefaultAzureCredential from @azure/identity provides a simplified authentication experience that automatically tries different authentication methods based on the environment. This is especially useful for applications that need to work in different environments (local development, CI/CD, and production).
@@ -138,6 +145,42 @@ export class EntraIdCredentialsProviderFactory {
138
145
);
139
146
}
140
147
148
+
/**
149
+
* This method is used to create a credentials provider using DefaultAzureCredential.
150
+
*
151
+
* The user needs to create a configured instance of DefaultAzureCredential ( or any other class that implements TokenCredential )and pass it to this method.
152
+
*
153
+
* The default credentials mapper for this method is OID_CREDENTIALS_MAPPER which extracts the object ID from JWT
154
+
* encoded token.
155
+
*
156
+
* Depending on the actual flow that DefaultAzureCredential uses, the user may need to provide different
157
+
* credential mapper via the credentialsMapper parameter.
158
+
*
159
+
*/
160
+
staticcreateForDefaultAzureCredential(
161
+
{
162
+
credential,
163
+
scopes,
164
+
options,
165
+
tokenManagerConfig,
166
+
onReAuthenticationError,
167
+
credentialsMapper,
168
+
onRetryableError
169
+
}: DefaultAzureCredentialsParams
170
+
): EntraidCredentialsProvider{
171
+
172
+
constidp=newAzureIdentityProvider(
173
+
()=>credential.getToken(scopes,options).then(x=>x===null ? Promise.reject('Token is null') : x)
0 commit comments