[FEATURE REQ] Authentication in Spring enhancement #32443
Labels
azure-spring
All azure-spring related issues
Client
This issue points to a problem in the data-plane of the library.
feature-request
This issue requires a new behavior in the product in order be resolved.
Milestone
How TokenCredential is supported in Spring Cloud Azure
This doc discusses how
TokenCredential
is managed within Spring Cloud Azure and expected behaviors for each scenariosScenario 1
This is the most common scenario I think.
Expectation:
TokenCredntial
bean in Spring ContextBlobClient
andEventHubClient
ChainedTokenCredential
and has the same elements asDAC
Current Behavior:
TokenCredential
bean in Spring ContextBlobClient
andEventHubClient
ChainedTokenCredential
and has the same elements asDAC
.ChainedTokenCredential
instance created at the JVM start-up.Scenario 2
in this case, it should be
Expectation:
ServicePrincipalCredential
bean in Spring Context fromspring.cloud.azure.credential
BlobClient
andEventHubClient
Current Behavior:
ServicePrincipalCredential
bean in Spring Context fromspring.cloud.azure.credential
TokenCredenital
instances created by Spring Cloud Azure:ChainedTokenCredential
instance created at the JVM start-up.ServicePrincipalCredential
instances created fromspring.cloud.azure.storage-blob.credential
andspring.cloud.azure.eventhub.credential
.ServicePrincipalCredential
instance created fromspring.cloud.azure.storage-blob.credential
is used byBlobClient
ServicePrincipalCredential
instance created fromspring.cloud.azure.eventhub.credential
is used byEventHubClient
Scenario 3
In this case, it should be
Expectation:
TokenCredential
bean in Spring Context, which is the user-provided oneBlobClient
andEventHubClient
TokenCredential
instances nor beanCurrent Behavior:
TokeCredential
bean in Spring Context, the user provided one.BlobClient
andEventHubClient
.ChainedTokenCredential
instance created at the JVM start-up.TokenCredential
beanScenario 4
Unlike scenario 3, the User in this scenario provides a
TokenCredential
bean and has credential configuration provided in application properties for the Storage Blob service.Expectation:
TokenCredential
beanEventHubClient
TokenCredential
instancespring.cloud.azure.storage-blob.credential
config, which is aServicePrincipalTokenCredential
Current Behavior:
TokenCredential
beanEventHubClient
TokenCredential
instancesChainedTokenCredential
instance created at the JVM start-up.spring.cloud.azure.storage-blob.credential
config, which is aServicePrincipalTokenCredential
StorageBlobClient
Scenario 5
In this case, it should be
Expectation:
Current Behavior:
TokeCredential
beans in Spring Context,TokeCredential
bean as scenario#1 created by Spring Cloud Azure. It is used by bothBlobClient
andEventHubClient
.ChainedTokenCredential
instance created at the JVM start-up.Scenario 6
Expectation:
TokenCredential
beanChainedTokenCredential
as same as scenario 1, that will be used to authenticateEventHubClient
TokenCredential
instancespring.cloud.azure.storage-blob.credential
config, which is aServicePrincipalTokenCredential
Current Behavior:
TokenCredential
beanEventHubClient
ChainedTokenCredential
and has the same elements asDAC
.TokenCredential
instances created at the JVM start-up.ChainedTokenCredential
instance created at the JVM start-up.spring.cloud.azure.storage-blob.credential
config, which is aServicePrincipalTokenCredential
StorageBlobClient
Scenario 7
This scenario consists of:
SecretClient
must be ready (authenticated) in Bootstrap stage.Expectation:
about
TokenCredential
:TokenCredential
beanChainedTokenCredential
bean, as described in scenario 1, is created atBootstrapContext
stage, so it is used bySecretClient
inEnvironmentPostProcessor
andEventHubClient
TokenCredential
instanceServicePrincipalTokenCredential
is created by Spring Cloud Azure fromspring.cloud.azure.storage-blob.credential
propertiesServicePrincipalTokenCredential
is used to authenticateStorageBlobClient
and created at building Application Context Stage.Current Behavior:
TokenCredential
beanChainedTokenCredential
bean is created at theapplication context
stage, and it is used byEventHubClient.
TokenCredential
instancesChainedTokenCredential
instance created at the JVM start-upServicePrincipalTokenCredential
is created by Spring Cloud Azure fromspring.cloud.azure.storage-blob.credential
propertiesServicePrincipalTokenCredential
is used to authenticateStorageBlobClient
and created at the building Application Context Stage.Scenario 8
Like scenario 7, the only difference is that user is trying to provide its own
TokenCredential
bean to be used by bothSecretClient
andEventHubClient
.Expectation:
Since this application has property source feature, it can not use the normal
Configuration
to define the bean, but has to do it in the bootstrap stage, see more detials at [here](https://docs.spring.io/spring-cloud-vault/docs/current/reference/html/#vault.configdata.customization)TokenCredential
beanSecretClient
inEnvironmentPostProcessor
andEventHubClient
TokenCredential
instanceServicePrincipalTokenCredential
is created by Spring Cloud Azure fromspring.cloud.azure.storage-blob.credential
propertiesServicePrincipalTokenCredential
is used to authenticateStorageBlobClient
and created at building Application Context Stage.Current Behavior:
TokenCredential
defined inBootstrapContext
TokenCredential
beanChainedTokenCredential
bean is created at theapplication context
stage, and it is used byEventHubClient.
TokenCredential
instancesChainedTokenCredential
instance created at the JVM start-upServicePrincipalTokenCredential
is created by Spring Cloud Azure fromspring.cloud.azure.storage-blob.credential
propertiesServicePrincipalTokenCredential
is used to authenticateStorageBlobClient
and created at the building Application Context Stage.Scenario 9
If users create a
DAC
and set the client id:This credential can be used in the Azure Hosting environment and on local machines.
So this scenario is, what if storage blob wants to use a different
DAC
as we provide in scenario 1?Expectation
TokenCredential
beanChainedTokenCredential
bean, as described in scenario 1, and it is used by theEventHubClient
ChainedTokenCredential
instanceChainedTokenCredential
instance, created fromspring.cloud.azure.storage-blob.credential
StorageBlobClient
Current Behavior
TokenCredential
beanChainedTokenCredential
bean, as described in scenario 1, and it is used by theEventHubClient
ChainedTokenCredential
instanceChainedTokenCredential
instance created fromspring.cloud.azure.storage-blob.credential
ChainedTokenCredential
instance created at the JVM start-upStorageBlobClient
The text was updated successfully, but these errors were encountered: