Skip to content

Commit

Permalink
Cherry pick passwordless to the feature/spring-cloud-azure-passwordle…
Browse files Browse the repository at this point in the history
…ss branch (#31076)

* Support JDBC to authenticate with azure identity token credentials (#30740)
* fix pipeline error (#30806)
* Add UA for mysql and postgresql (#30772)
* add user agent for MySQL and PostgreSQL
* refactor test cases
* Update terminology from credentialfree to passwordless. (#30788)
* Change terminology from credentialfree to passwordless
Co-authored-by: Xiaolu Dai <xiada@microsoft.com>

* Update pom in spring-cloud-azure-starter-jdbc-* (#30993)
* update pom
* add prefix
* Add IT for passwordless feature with Azure MySQL (#30982)
* add some comments
* remove unnecessary changes and fix pipeline bug

Co-authored-by: zhihaoguo <zhihaoguo@microsoft.com>
  • Loading branch information
saragluna and backwind1233 committed Sep 22, 2022
1 parent f17a602 commit 1e3ae3e
Show file tree
Hide file tree
Showing 98 changed files with 5,293 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ the main ServiceBusClientBuilder. -->
<suppress checks="com.azure.tools.checkstyle.checks.ServiceClientCheck" files="com.azure.messaging.eventhubs.(EventHubConsumerClient|EventHubConsumerAsyncClient|EventHubProducerClient|EventHubProducerAsyncClient).java"/>
<suppress checks="com.azure.tools.checkstyle.checks.UseCaughtExceptionCauseCheck" files="com.azure.messaging.eventhubs.EventDataBatch.java"/>

<!-- jdbc sdk suppression -->
<suppress checks="com.azure.tools.checkstyle.checks.ExternalDependencyExposedCheck"
files="com.azure.identity.providers.(mysql|postgresql).(AzureIdentityMysqlAuthenticationPlugin|AzureIdentityPostgresqlAuthenticationPlugin).java"/>
<suppress checks="com.azure.tools.checkstyle.checks.ThrowFromClientLoggerCheck"
files="com.azure.identity.providers.postgresql.AzureIdentityPostgresqlAuthenticationPlugin"/>

<!-- ### begin: Spring related suppression -->

<!-- The constant name is public static. -->
Expand Down
14 changes: 13 additions & 1 deletion eng/code-quality-reports/src/main/resources/revapi/revapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,18 @@
"new": "interface com.azure.spring.cloud.config.AppConfigurationRefresh",
"justification": "Thi isn't an external class"
},
{
"regex": true,
"code": "java\\.class\\.externalClassExposedInAPI",
"new": "(interface|class|enum) com\\.mysql\\.cj\\..*",
"justification": "Mysql driver classes are allowed to be exposed by dependencies using them."
},
{
"regex": true,
"code": "java\\.class\\.externalClassExposedInAPI",
"new": "(interface|class|enum) org\\.postgresql\\..*",
"justification": "Postgresql driver classes are allowed to be exposed by dependencies using them."
},
{
"code": "java.method.parameterTypeParameterChanged",
"old": "parameter <T> reactor.core.publisher.Mono<T> com.azure.spring.data.cosmos.core.ReactiveCosmosOperations::insert(java.lang.String, ===java.lang.Object===, com.azure.cosmos.models.PartitionKey)",
Expand Down Expand Up @@ -525,4 +537,4 @@
]
}
}
]
]
10 changes: 10 additions & 0 deletions eng/jacoco-test-coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,16 @@
<artifactId>spring-cloud-azure-starter-keyvault</artifactId>
<version>4.4.0-beta.1</version> <!-- {x-version-update;com.azure.spring:spring-cloud-azure-starter-keyvault;current} -->
</dependency>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-jdbc-mysql</artifactId>
<version>4.4.0-beta.1</version> <!-- {x-version-update;com.azure.spring:spring-cloud-azure-starter-jdbc-mysql;current} -->
</dependency>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-jdbc-postgresql</artifactId>
<version>4.4.0-beta.1</version> <!-- {x-version-update;com.azure.spring:spring-cloud-azure-starter-jdbc-postgresql;current} -->
</dependency>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-keyvault-certificates</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions eng/versioning/external_dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ org.springframework:spring-test;5.3.22
org.springframework.retry:spring-retry;1.3.3
org.springframework.boot:spring-boot-starter-parent;2.7.3

## azure-identity dependency versions used in sdk/jdbc
jdbc_com.azure:azure-identity;1.6.0-beta.1

## Spring cloud dependency versions
org.springframework.cloud:spring-cloud-dependencies;2021.0.3
org.springframework.cloud:spring-cloud-starter-bootstrap;3.1.3
Expand Down Expand Up @@ -249,6 +252,7 @@ org.spockframework:spock-core;2.2-M3-groovy-2.5
groovy4_org.spockframework:spock-core;2.2-M3-groovy-4.0
org.testng:testng;7.3.0
uk.org.lidalia:slf4j-test;1.2.0
uk.org.webcompere:system-stubs-jupiter;2.0.1
com.google.truth:truth;1.1.3

## Maven Tools versions
Expand Down
10 changes: 10 additions & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ com.azure:azure-verticals-agrifood-farming;1.0.0-beta.2;1.0.0-beta.3
com.azure:azure-xml;1.0.0-beta.1;1.0.0-beta.1
com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-communication-email;1.0.0-beta.1;1.0.0-beta.2
com.azure:azure-identity-providers-core;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-identity-providers-jdbc-mysql;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-identity-providers-jdbc-postgresql;1.0.0-beta.1;1.0.0-beta.1
com.microsoft.azure:spring-cloud-azure-appconfiguration-config-web;1.3.0;1.4.0-beta.1
com.microsoft.azure:spring-cloud-azure-appconfiguration-config;1.3.0;1.4.0-beta.1
com.microsoft.azure:spring-cloud-azure-feature-management-web;1.3.0;1.4.0-beta.1
Expand Down Expand Up @@ -196,6 +199,8 @@ com.azure.spring:spring-cloud-azure-starter-appconfiguration;4.3.0;4.4.0-beta.1
com.azure.spring:spring-cloud-azure-starter-cosmos;4.3.0;4.4.0-beta.1
com.azure.spring:spring-cloud-azure-starter-data-cosmos;4.3.0;4.4.0-beta.1
com.azure.spring:spring-cloud-azure-starter-eventhubs;4.3.0;4.4.0-beta.1
com.azure.spring:spring-cloud-azure-starter-jdbc-mysql;4.4.0-beta.1;4.4.0-beta.1
com.azure.spring:spring-cloud-azure-starter-jdbc-postgresql;4.4.0-beta.1;4.4.0-beta.1
com.azure.spring:spring-cloud-azure-starter-keyvault;4.3.0;4.4.0-beta.1
com.azure.spring:spring-cloud-azure-starter-keyvault-certificates;4.3.0;4.4.0-beta.1
com.azure.spring:spring-cloud-azure-starter-keyvault-secrets;4.3.0;4.4.0-beta.1
Expand Down Expand Up @@ -376,6 +381,8 @@ com.azure.resourcemanager:azure-resourcemanager-agrifood;1.0.0-beta.1;1.0.0-beta
com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1
com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2

## azure-identity dependency versions used in sdk/jdbc
jdbc_com.azure:azure-identity;1.6.0-beta.1;1.6.0-beta.1

# Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current
# version. Unreleased dependencies are only valid for dependency versions.
Expand All @@ -386,6 +393,9 @@ com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2
# <!-- {x-version-update;unreleased_com.azure:azure-core;dependency} -->
unreleased_com.azure:azure-core;1.33.0-beta.1
unreleased_com.azure:azure-ai-formrecognizer;4.0.0
unreleased_com.azure:azure-identity-providers-core;1.0.0-beta.1
unreleased_com.azure:azure-identity-providers-jdbc-mysql;1.0.0-beta.1
unreleased_com.azure:azure-identity-providers-jdbc-postgresql;1.0.0-beta.1

# Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current
# version and set the version to the released beta. Released beta dependencies are only valid
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
<module>sdk/imagebuilder</module>
<module>sdk/iotcentral</module>
<module>sdk/iothub</module>
<module>sdk/jdbc</module>
<module>sdk/keyvault</module>
<module>sdk/kubernetesconfiguration</module>
<module>sdk/kusto</module>
Expand Down
16 changes: 16 additions & 0 deletions sdk/boms/spring-cloud-azure-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- TODO (zhihaoguo): Pin the version of azure-identity to 1.6.0-beta.1 for we want to use the caching ability for MI. -->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.6.0-beta.1</version> <!-- {x-version-update;jdbc_com.azure:azure-identity;external_dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos</artifactId>
Expand Down Expand Up @@ -282,6 +288,16 @@
<artifactId>spring-messaging-azure-storage-queue</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-jdbc-mysql</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-jdbc-postgresql</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
4 changes: 4 additions & 0 deletions sdk/jdbc/azure-identity-providers-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Release History

## 1.0.0-beta.1 (Unreleased)
- Azure identity JDBC plugin library for Java. This package contains a template framework to get a token as password.
39 changes: 39 additions & 0 deletions sdk/jdbc/azure-identity-providers-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Azure identity JDBC plugin library for Java

This package contains a template framework to get a token from Azure AD.
For now, it is used by `azure-identity-providers-jdbc-mysql` and `azure-identity-providers-jdbc-postgresql` as the common framework
to get a token as the password for connection.

## Getting started

### Prerequisites

- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
- [Java Development Kit (JDK)][jdk] with version 8 or above.
- [Apache Maven](https://maven.apache.org/download.cgi).

## Key concepts

Azure Identity Providers Core contains a common template framework for users to get a token from Azure AD and
use the token as a password. For example, to connect Azure hosted MySQL, get a token from Azure AD and use the
token as a password to connect with MySQL.

## Examples

## Troubleshooting
If you encounter any bugs, please file issues via [Issues](https://github.com/Azure/azure-sdk-for-java/issues).

## Next steps

## Contributing

For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).

1. Fork it
1. Create your feature branch (`git checkout -b my-new-feature`)
1. Commit your changes (`git commit -am 'Add some feature'`)
1. Push to the branch (`git push origin my-new-feature`)
1. Create new Pull Request


<!-- LINKS -->
155 changes: 155 additions & 0 deletions sdk/jdbc/azure-identity-providers-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.azure</groupId>
<artifactId>azure-client-sdk-parent</artifactId>
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
</parent>

<groupId>com.azure</groupId>
<artifactId>azure-identity-providers-core</artifactId>
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-identity-providers-core;current} -->
<packaging>jar</packaging>

<name>Azure Identity Providers Core</name>
<description>This package contains the business logic of authenticating with Azure AD and returning a token as a password.</description>
<url>https://github.com/azure/azure-sdk-for-java</url>

<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.6.0-beta.1</version> <!-- {x-version-update;jdbc_com.azure:azure-identity;external_dependency} -->
</dependency>

<!-- test -->
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-jupiter</artifactId>
<version>2.0.1</version> <!-- {x-version-update;uk.org.webcompere:system-stubs-jupiter;external_dependency} -->
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.5.1</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter;external_dependency} -->
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version> <!-- {x-version-update;com.google.code.findbugs:jsr305;external_dependency} -->
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version> <!-- {x-version-update;org.apache.maven.plugins:maven-enforcer-plugin;external_dependency} -->
<configuration>
<rules>
<bannedDependencies>
<includes>
<include>org.postgresql:postgresql:[42.3.6]</include> <!-- {x-include-update;org.postgresql:postgresql;external_dependency} -->
</includes>
</bannedDependencies>
</rules>
</configuration>
</plugin>
<!-- START: Empty Java Doc -->
<!-- The following code will generate an empty javadoc with just a README.md. This is necessary
to pass the required checks on Maven. The way this works is by setting the classesDirectory
to a directory that only contains the README.md, which we need to copy. If the classesDirectory
is set to the root, where the README.md lives, it still won't have javadocs but the jar file
will contain a bunch of files that shouldn't be there. The faux sources directory is deleted
and recreated with the README.md being copied every time to guarantee that, when building locally,
it'll have the latest copy of the README.md file.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-javadoc-plugin;external_dependency} -->
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version> <!-- {x-version-update;org.apache.maven.plugins:maven-jar-plugin;external_dependency} -->
<executions>
<execution>
<id>empty-javadoc-jar-with-readme</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>javadoc</classifier>
<classesDirectory>${project.basedir}/javadocTemp</classesDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version> <!-- {x-version-update;org.apache.maven.plugins:maven-antrun-plugin;external_dependency} -->
<executions>
<execution>
<id>copy-readme-to-javadocTemp</id>
<phase>prepare-package</phase>
<configuration>
<target>
<echo>Deleting existing ${project.basedir}/javadocTemp</echo>
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${project.basedir}/javadocTemp"/>
</delete>
<echo>Copying ${project.basedir}/README.md to
${project.basedir}/javadocTemp/README.md
</echo>
<copy file="${project.basedir}/README.md" tofile="${project.basedir}/javadocTemp/README.md"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- END: Empty Java Doc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version><!-- {x-version-update;org.apache.maven.plugins:maven-surefire-plugin;external_dependency} -->
<configuration>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>

</project>

0 comments on commit 1e3ae3e

Please sign in to comment.