You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
feat(entraid): add support for azure identity (#2901)
This PR adds support for using Azure Identity's credential classes with Redis Enterprise Entra ID authentication. The main changes include: - Add a new factory method createForDefaultAzureCredential to enable using Azure Identity credentials - Add @azure/identity as a dependency to support the new authentication flow - Add support for DefaultAzureCredential, EnvironmentCredential, and any other TokenCredential implementation - Create a new AzureIdentityProvider to support DefaultAzureCredential - Update documentation and README with usage examples for DefaultAzureCredential - Add integration tests for the new authentication methods - Include a sample application demonstrating interactive browser authentication - Export constants for Redis scopes / credential mappers to simplify authentication configuration
This commit is contained in:
@@ -11,21 +11,15 @@ export class MSALIdentityProvider implements IdentityProvider<AuthenticationResu
|
||||
}
|
||||
|
||||
async requestToken(): Promise<TokenResponse<AuthenticationResult>> {
|
||||
try {
|
||||
const result = await this.getToken();
|
||||
const result = await this.getToken();
|
||||
|
||||
if (!result?.accessToken || !result?.expiresOn) {
|
||||
throw new Error('Invalid token response');
|
||||
}
|
||||
return {
|
||||
token: result,
|
||||
ttlMs: result.expiresOn.getTime() - Date.now()
|
||||
};
|
||||
} catch (error) {
|
||||
throw error;
|
||||
if (!result?.accessToken || !result?.expiresOn) {
|
||||
throw new Error('Invalid token response');
|
||||
}
|
||||
return {
|
||||
token: result,
|
||||
ttlMs: result.expiresOn.getTime() - Date.now()
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user