Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spring Boot auto-configuration of all Azure Spring supported SDK clients #23849

Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9661495
refactor the auto-configuration
saragluna Sep 2, 2021
5b87956
address comments
saragluna Sep 4, 2021
0c93f7d
refactor dependencies and add app-configuration client builder factory
saragluna Sep 4, 2021
2870a2c
fix pipeline
saragluna Sep 4, 2021
a7d8144
fix failing tests
saragluna Sep 4, 2021
142d35e
fix pipeline
saragluna Sep 4, 2021
57c4f35
refactor default token credential, configuration properties, and reso…
saragluna Sep 12, 2021
acc5d2c
Merge branch 'feature/azure-spring-cloud-4.0' into xiada/feature/auto…
saragluna Sep 12, 2021
e420837
refactor event hub resource manager
saragluna Sep 12, 2021
3277ef5
refactor tests
saragluna Sep 12, 2021
1013bba
remove @Conditional annotations on base classes and fix pipelines
saragluna Sep 13, 2021
2184f14
fix checkstyle and spotbugs
saragluna Sep 13, 2021
6c2bead
fix test errors
saragluna Sep 13, 2021
d9601aa
refactor KeyVaultEnvironmentPostProcessor and auto-configuration for …
saragluna Sep 14, 2021
c223184
fix Key Vault IT
saragluna Sep 14, 2021
d56614b
live testing
saragluna Sep 15, 2021
2651809
Merge branch 'feature/azure-spring-cloud-4.0' into xiada/feature/auto…
saragluna Sep 15, 2021
6dd2e1b
fix Cosmos IT
saragluna Sep 15, 2021
8058857
fix and refactor tests, and refine naming
saragluna Sep 15, 2021
81ca3db
fix storage ITs
saragluna Sep 16, 2021
31173aa
fix eventhubs ITs
saragluna Sep 16, 2021
847cc2d
fix servicebus ITs
saragluna Sep 16, 2021
9eb4d04
fix Key Vault ITs
saragluna Sep 16, 2021
08b99a5
fix tests and ci
saragluna Sep 16, 2021
8f6b30f
fix pipeline
saragluna Sep 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,8 @@ the main ServiceBusClientBuilder. -->
<!-- EnforceFinalFieldsCheck: The property will be filled by Spring framework -->
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.autoconfigure.aad.ServiceEndpointsProperties"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.autoconfigure.aad.UserGroups"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.autoconfigure.jms.ConnectionStringResolver"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.data.cosmos.config.AbstractCosmosConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.data.cosmos.core.query.CosmosPageRequest.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.cloud.autoconfigure.context.AzureEnvironmentAutoConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.cloud.autoconfigure.storage.AzureStorageQueueAutoConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.cloud.autoconfigure.storage.AzureStorageAutoConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.cloud.autoconfigure.servicebus.AzureServiceBusTopicAutoConfiguration.java"/>
Expand All @@ -502,14 +500,15 @@ the main ServiceBusClientBuilder. -->
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.servicebus.stream.binder.config.ServiceBusQueueBinderConfiguration.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.eventhub.stream.binder.config.EventHubBinderConfiguration.java"/>

<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.data.gremlin.conversion.source.AbstractGremlinSource.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.EnforceFinalFieldsCheck" files="com.azure.spring.keyvault.KeyVaultOperation.java"/>

<suppress checks="MethodName" files="com.azure.spring.data.gremlin.common.GremlinConfig.java"/>

<suppress checks="MethodName" files="com.azure.spring.integration.core.api.CheckpointConfig.java"/>
<suppress checks="MethodName" files="com.azure.spring.integration.servicebus.ServiceBusClientConfig.java"/>

<!-- Suppress warnings for EventProcessorSharedAuthenticationClientBuilder and EventHubSharedAuthenticationClientBuilder. They are used by Azure Spring. -->
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientBuilderCheck" files="EventHubSharedAuthenticationClientBuilder.java"/>
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientBuilderCheck" files="EventProcessorSharedAuthenticationClientBuilder.java"/>

<!-- Checkstyle suppressions for azure.spring.data.cosmos package -->
<suppress checks="MethodName|MemberName|ParameterName" files="src[/\\]test[/\\]java[/\\]com[/\\]azure[/\\]spring[/\\]data[/\\]cosmos[/\\]domain|repository.*.java"/>
<suppress checks="MethodName" files="com.azure.spring.data.cosmos.config.CosmosConfig.java"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2319,31 +2319,20 @@
<Class name="com.azure.spring.core.credential.resolver.AzureKeyCredentialResolver"/>
<Class name="com.azure.spring.core.credential.resolver.AzureNamedKeyCredentialResolver"/>
<Class name="com.azure.spring.core.credential.resolver.AzureSasCredentialResolver"/>
<Class name="com.azure.spring.cloud.autoconfigure.storage.common.credential.StorageSharedKeyCredentialResolver" />
</Or>
<Method name="resolve"/>
</And>
<Bug pattern="BC_UNCONFIRMED_CAST"/>
</Match>
<Match>
<Bug pattern="BC_UNCONFIRMED_CAST_OF_RETURN_VALUE"/>
</Match>


<Match>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE,
NP_LOAD_OF_KNOWN_NULL_VALUE,
RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE,
RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"/>
</Match>

<Match>
<Or>
<Class name="com.azure.spring.integration.servicebus.queue.ServiceBusQueueTemplate$QueueMessageHandler"/> <!-- false positive -->
<Class name="com.azure.spring.integration.servicebus.topic.ServiceBusTopicTemplate$TopicMessageHandler"/> <!-- false positive -->
</Or>
<Method name="OnCloseSessionAsync"/>
<Bug pattern="NM_METHOD_NAMING_CONVENTION"/>
</Match>

<Match>
<Bug pattern="UWF_NULL_FIELD"/>
<Class name="com.azure.spring.integration.core.AbstractInboundChannelAdapter"/>
Expand All @@ -2363,12 +2352,6 @@
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
</Match>

<Match>
<Class name="com.azure.spring.identity.SpringCredentialBuilderBase"/>
<Field name="environment"/>
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
</Match>

<Match>
<Class name="com.azure.spring.autoconfigure.jms.AzureServiceBusJMSProperties"/>
<Field name="pricingTier"/>
Expand All @@ -2381,12 +2364,6 @@
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
</Match>

<Match>
<Class name="com.azure.spring.autoconfigure.cosmos.CosmosAutoConfiguration"/>
<Field name="azureProperties"/>
<Bug pattern="URF_UNREAD_FIELD"/>
</Match>

<!-- Field is initialized in postProcessEnvironment function -->
<Match>
<Class name="com.azure.spring.autoconfigure.unity.AbstractLegacyPropertyEnvironmentPostProcessor"/>
Expand Down
2 changes: 2 additions & 0 deletions eng/versioning/external_dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ io.netty:netty-transport-native-kqueue;4.1.67.Final
io.projectreactor.netty:reactor-netty;1.0.10
io.projectreactor:reactor-core;3.4.9
io.reactivex:rxjava;1.3.8
jakarta.validation:jakarta.validation-api;2.0.2
javax.annotation:javax.annotation-api;1.3.2
javax.json:javax.json-api;1.1.4
javax.servlet:javax.servlet-api;4.0.1
Expand Down Expand Up @@ -186,6 +187,7 @@ org.eclipse.jetty:jetty-http;9.4.43.v20210629
org.eclipse.jetty:jetty-server;9.4.43.v20210629
org.eclipse.jgit:org.eclipse.jgit;4.5.7.201904151645-r
org.glassfish:javax.json;1.1.4
org.glassfish:jakarta.el;3.0.3
org.hamcrest:hamcrest-all;1.3
org.hamcrest:hamcrest-library;2.2
org.junit.jupiter:junit-jupiter;5.7.2
Expand Down

This file was deleted.

This file was deleted.

117 changes: 82 additions & 35 deletions sdk/spring/azure-spring-cloud-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<optional>true</optional>
</dependency>

<!-- Azure Spring Integration -->
<!-- Event Hub -->
<dependency>
<groupId>com.azure.spring</groupId>
Expand All @@ -52,31 +53,46 @@
<optional>true</optional>
</dependency>

<!-- Redis -->
<!-- Storage Queue -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.5.4</version> <!-- {x-version-update;org.springframework.data:spring-data-redis;external_dependency} -->
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-integration-storage-queue</artifactId>
<version>4.0.0-beta.1</version> <!-- {x-version-update;com.azure.spring:azure-spring-integration-storage-queue;current} -->
<optional>true</optional>
</dependency>

<!-- Kafka -->
<!-- Kafka -->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
<version>2.7.6</version> <!-- {x-version-update;org.springframework.kafka:spring-kafka;external_dependency} -->
<optional>true</optional>
</dependency>

<!-- Spring Data -->
<!-- Redis -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.5.4</version> <!-- {x-version-update;org.springframework.data:spring-data-redis;external_dependency} -->
<optional>true</optional>
</dependency>
<!-- MongoDB -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>3.2.4</version> <!-- {x-version-update;org.springframework.data:spring-data-mongodb;external_dependency} -->
<optional>true</optional>
</dependency>
<!-- Cosmos -->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos</artifactId>
<version>3.10.0</version> <!-- {x-version-update;com.azure:azure-spring-data-cosmos;dependency} -->
<optional>true</optional>
</dependency>

<!--Azure active directory-->
<!--Spring Security-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
Expand Down Expand Up @@ -126,16 +142,7 @@
<optional>true</optional>
</dependency>

<!--Cosmos-->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos</artifactId>
<version>3.10.0</version> <!-- {x-version-update;com.azure:azure-spring-data-cosmos;dependency} -->
<optional>true</optional>
</dependency>

<!--Spring JMS-->

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
Expand All @@ -155,36 +162,61 @@
<optional>true</optional>
</dependency>

<!-- Azure libraries-->
<!-- Azure SDKs-->
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.11.0</version> <!-- {x-version-update;com.microsoft.azure:msal4j;external_dependency} -->
<groupId>com.azure</groupId>
<artifactId>azure-cosmos</artifactId>
<version>4.18.0</version> <!-- {x-version-update;com.azure:azure-cosmos;dependency} -->
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.3.6</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<artifactId>azure-data-appconfiguration</artifactId>
<version>1.2.1</version> <!-- {x-version-update;com.azure:azure-data-appconfiguration;dependency} -->
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-servicebus</artifactId>
<version>7.4.0</version> <!-- {x-version-update;com.azure:azure-messaging-servicebus;dependency} -->
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-messaging-eventhubs</artifactId>
<version>5.10.0</version> <!-- {x-version-update;com.azure:azure-messaging-eventhubs;dependency} -->
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-certificates</artifactId>
<version>4.2.2</version> <!-- {x-version-update;com.azure:azure-security-keyvault-certificates;dependency} -->
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-security-keyvault-secrets</artifactId>
<version>4.3.2</version> <!-- {x-version-update;com.azure:azure-security-keyvault-secrets;dependency} -->
<optional>true</optional>
</dependency>

<!-- Storage Queue -->
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>azure-spring-integration-storage-queue</artifactId>
<version>4.0.0-beta.1</version> <!-- {x-version-update;com.azure.spring:azure-spring-integration-storage-queue;current} -->
<groupId>com.azure</groupId>
<artifactId>azure-storage-blob</artifactId>
<version>12.13.0</version> <!-- {x-version-update;com.azure:azure-storage-blob;dependency} -->
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-file-share</artifactId>
<version>12.10.0</version> <!-- {x-version-update;com.azure:azure-storage-file-share;dependency} -->
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-queue</artifactId>
<version>12.10.0</version> <!-- {x-version-update;com.azure:azure-storage-queue;dependency} -->
<optional>true</optional>
</dependency>


<!-- Spring -->
<dependency>
Expand Down Expand Up @@ -227,12 +259,6 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.2.0.Final</version> <!-- {x-version-update;org.hibernate.validator:hibernate-validator;external_dependency} -->
</dependency>

<!-- Added this dependency to include necessary annotations used by reactor core.
Without this dependency, javadoc throws a warning as it cannot find enum When.MAYBE
which is used in @Nullable annotation in reactor core classes -->
Expand All @@ -243,6 +269,12 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>2.0.2</version> <!-- {x-version-update;jakarta.validation:jakarta.validation-api;external_dependency} -->
</dependency>

<!-- TEST-->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -274,6 +306,20 @@
</exclusion>
</exclusions>
</dependency>
<!-- For Validator -->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.2.0.Final</version> <!-- {x-version-update;org.hibernate.validator:hibernate-validator;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.el</artifactId>
<version>3.0.3</version> <!-- {x-version-update;org.glassfish:jakarta.el;external_dependency} -->
<scope>test</scope>
</dependency>

<!-- for the samples -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand All @@ -297,6 +343,7 @@
<include>com.microsoft.azure:azure-servicebus-jms:[0.0.7]</include> <!-- {x-include-update;com.microsoft.azure:azure-servicebus-jms;external_dependency} -->
<include>com.microsoft.azure:msal4j:[1.11.0]</include> <!-- {x-include-update;com.microsoft.azure:msal4j;external_dependency} -->
<include>com.nimbusds:nimbus-jose-jwt:[9.10.1]</include> <!-- {x-include-update;com.nimbusds:nimbus-jose-jwt;external_dependency} -->
<include>jakarta.validation:jakarta.validation-api:[2.0.2]</include> <!-- {x-include-update;jakarta.validation:jakarta.validation-api;external_dependency} -->
<include>javax.servlet:javax.servlet-api:[4.0.1]</include> <!-- {x-include-update;javax.servlet:javax.servlet-api;external_dependency} -->
<include>org.apache.qpid:qpid-jms-client:[0.53.0]</include> <!-- {x-include-update;org.apache.qpid:qpid-jms-client;external_dependency} -->
<include>org.hibernate.validator:hibernate-validator:[6.2.0.Final]</include> <!-- {x-include-update;org.hibernate.validator:hibernate-validator;external_dependency} -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
package com.azure.spring.aad.webapi.validator;

import com.azure.spring.aad.implementation.constants.AADTokenClaim;
import java.util.List;
import org.springframework.security.oauth2.core.OAuth2TokenValidator;
import org.springframework.security.oauth2.core.OAuth2TokenValidatorResult;
import org.springframework.security.oauth2.jwt.Jwt;
import org.springframework.util.Assert;

import java.util.List;

/**
* Validates the "aud" claim in a {@link Jwt}, that is matches a configured value
*/
Expand Down
Loading