[docs]classAzureTokenProvider(ComponentBase[TokenProviderConfig],Component[TokenProviderConfig]):component_type="token_provider"component_config_schema=TokenProviderConfigcomponent_provider_override="autogen_ext.auth.azure.AzureTokenProvider"def__init__(self,credential:TokenProvider,*scopes:str):self.credential=credentialself.scopes=list(scopes)self.provider=get_bearer_token_provider(self.credential,*self.scopes)def__call__(self)->str:returnself.provider()def_to_config(self)->TokenProviderConfig:"""Dump the configuration that would be requite to create a new instance of a component matching the configuration of this instance. Returns: T: The configuration of the component. """ifisinstance(self.credential,DefaultAzureCredential):# NOTE: we are not currently inspecting the chained credentials, so this could result in a loss of informationreturnTokenProviderConfig(provider_kind="DefaultAzureCredential",scopes=self.scopes)else:raiseValueError("Only DefaultAzureCredential is supported")@classmethoddef_from_config(cls,config:TokenProviderConfig)->Self:"""Create a new instance of the component from a configuration object. Args: config (T): The configuration object. Returns: Self: The new instance of the component. """ifconfig.provider_kind=="DefaultAzureCredential":returncls(DefaultAzureCredential(),*config.scopes)else:raiseValueError("Only DefaultAzureCredential is supported")