diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt
index 5b180d642ed04..2d52e3acfbe52 100644
--- a/eng/versioning/version_client.txt
+++ b/eng/versioning/version_client.txt
@@ -142,6 +142,8 @@ com.azure.spring:azure-spring-data-gremlin;2.3.1-beta.1;2.3.1-beta.1
com.azure.spring:azure-spring-boot-starter-data-gremlin;3.0.0-beta.1;3.0.0-beta.1
com.azure.spring:azure-spring-boot-test-aad;1.0.0;1.0.0
com.azure.spring:azure-spring-boot-test-aad-obo;1.0.0;1.0.0
+com.azure.spring:azure-spring-boot-test-aad-resource-server;1.0.0;1.0.0
+com.azure.spring:azure-spring-boot-test-aad-resource-server-by-filter;1.0.0;1.0.0
com.azure.spring:azure-spring-boot-test-core;1.0.0;1.0.0
com.azure.spring:azure-spring-boot-test-cosmosdb;1.0.0;1.0.0
com.azure.spring:azure-spring-boot-test-keyvault;1.0.0;1.0.0
diff --git a/sdk/spring/azure-spring-boot-test-aad/HOW_TO_RUN_AAD_INTEGRATION_TEST_IN_LOCALHOST.md b/sdk/spring/HOW_TO_RUN_AAD_INTEGRATION_TEST_IN_LOCALHOST.md
similarity index 86%
rename from sdk/spring/azure-spring-boot-test-aad/HOW_TO_RUN_AAD_INTEGRATION_TEST_IN_LOCALHOST.md
rename to sdk/spring/HOW_TO_RUN_AAD_INTEGRATION_TEST_IN_LOCALHOST.md
index 254a45264f197..a568f9250a413 100644
--- a/sdk/spring/azure-spring-boot-test-aad/HOW_TO_RUN_AAD_INTEGRATION_TEST_IN_LOCALHOST.md
+++ b/sdk/spring/HOW_TO_RUN_AAD_INTEGRATION_TEST_IN_LOCALHOST.md
@@ -60,8 +60,11 @@ Get `AAD_TENANT_ID_2`, `AAD_USER_NAME_2`, `AAD_USER_PASSWORD_2` with the same me
4. Add API permissions. Grant admin consent.
![add-api-permission](images/add-api-permission.png)
+
+5. Expose API: `ResourceAccessGraph.Read`, `TestScope1`, `TestScope2`.
+![expose-api](images/expose-api.png)
-5. Now we get value of `AAD_MULTI_TENANT_CLIENT_ID`, `AAD_MULTI_TENANT_CLIENT_SECRET`.
+6. Now we get value of `AAD_MULTI_TENANT_CLIENT_ID`, `AAD_MULTI_TENANT_CLIENT_SECRET`.
### `AAD_SINGLE_TENANT_CLIENT_ID`, `AAD_SINGLE_TENANT_CLIENT_SECRET`
Get `AAD_SINGLE_TENANT_CLIENT_ID`, `AAD_SINGLE_TENANT_CLIENT_SECRET` with the same method.
@@ -102,10 +105,22 @@ $env:AAD_SINGLE_TENANT_CLIENT_SECRET_WITH_ROLE='xxxxxxxx'
```
## Run AAD integration test by maven.
-Command:
+azure-spring-boot-test-aad:
```
mvn -f .\sdk\spring\azure-spring-boot-test-aad\pom.xml --fail-at-end "-Dmaven.javadoc.skip=true" "-Drevapi.skip=true" "-DskipSpringITs=false" verify
```
+azure-spring-boot-test-aad-obo:
+```
+mvn -f .\sdk\spring\azure-spring-boot-test-aad-obo\pom.xml --fail-at-end "-Dmaven.javadoc.skip=true" "-Drevapi.skip=true" "-DskipSpringITs=false" verify
+```
+azure-spring-boot-test-aad-resource-server:
+```
+mvn -f .\sdk\spring\azure-spring-boot-test-aad-resource-server\pom.xml --fail-at-end "-Dmaven.javadoc.skip=true" "-Drevapi.skip=true" "-DskipSpringITs=false" verify
+```
+azure-spring-boot-test-aad-resource-server-by-filter:
+```
+mvn -f .\sdk\spring\azure-spring-boot-test-aad-resource-server-by-filter\pom.xml --fail-at-end "-Dmaven.javadoc.skip=true" "-Drevapi.skip=true" "-DskipSpringITs=false" verify
+```
[Create a new tenant in Azure Active Directory]: https://docs.microsoft.com/azure/active-directory/fundamentals/active-directory-access-create-new-tenant
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/README.md b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/README.md
similarity index 98%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/README.md
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/README.md
index 08d21c5bf65d7..332332db72b68 100644
--- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/README.md
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/README.md
@@ -91,7 +91,7 @@ data: {
### Run with Maven
```shell
-cd azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless
+cd azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless
mvn spring-boot:run
```
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/docs/demo.webp b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/docs/demo.webp
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/docs/demo.webp
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/docs/demo.webp
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/pom.xml
similarity index 97%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/pom.xml
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/pom.xml
index 040dce199fece..bb3fcfeb02450 100644
--- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/pom.xml
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/pom.xml
@@ -11,7 +11,7 @@
com.azure.spring
- azure-spring-boot-sample-active-directory-resource-server-stateless
+ azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless1.0.0Azure Spring Boot Starter Sample - Azure AD Stateless Spring Security Integration
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/java/com/azure/spring/sample/aad/AzureADStatelessBackendSampleApplication.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/AzureADStatelessBackendSampleApplication.java
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/java/com/azure/spring/sample/aad/AzureADStatelessBackendSampleApplication.java
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/AzureADStatelessBackendSampleApplication.java
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/java/com/azure/spring/sample/aad/controller/MainController.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/controller/MainController.java
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/java/com/azure/spring/sample/aad/controller/MainController.java
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/controller/MainController.java
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/resources/application.properties b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/resources/application.properties
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/resources/application.properties
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/resources/application.properties
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/resources/static/index.html b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/resources/static/index.html
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-stateless/src/main/resources/static/index.html
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless/src/main/resources/static/index.html
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/README.md b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/README.md
similarity index 98%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/README.md
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/README.md
index 8ec91c5cc8384..f8a5734ef58e7 100644
--- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/README.md
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/README.md
@@ -37,7 +37,7 @@ From your command line:
```command line
git clone https://github.com/Azure/azure-sdk-for-java.git
```
-or download and extract the repository .zip file, and navigate to `azure-spring-boot-sample-active-directory-resource-server-with-filter` from the list of samples.
+or download and extract the repository .zip file, and navigate to `azure-spring-boot-sample-active-directory-resource-server-by-filter` from the list of samples.
---
### Step 2: Register the sample with your Azure Active Directory tenant
@@ -140,7 +140,7 @@ msalProvider.init(
* Run with Maven
```
- cd azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter
+ cd azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter
mvn spring-boot:run
```
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/pom.xml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/pom.xml
similarity index 97%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/pom.xml
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/pom.xml
index 19991f2e3ab28..b92d09c76d922 100644
--- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/pom.xml
+++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/pom.xml
@@ -10,7 +10,7 @@
com.azure.spring
- azure-spring-boot-sample-active-directory-resource-server-with-filter
+ azure-spring-boot-sample-active-directory-resource-server-by-filter1.0.0jar
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/java/com/azure/spring/sample/aad/AzureAdIntegrationSpringBootAutoconfigureSampleApplication.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/AzureAdIntegrationSpringBootAutoconfigureSampleApplication.java
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/java/com/azure/spring/sample/aad/AzureAdIntegrationSpringBootAutoconfigureSampleApplication.java
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/AzureAdIntegrationSpringBootAutoconfigureSampleApplication.java
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/java/com/azure/spring/sample/aad/model/TodoItem.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/model/TodoItem.java
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/java/com/azure/spring/sample/aad/model/TodoItem.java
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/model/TodoItem.java
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/application.properties b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/application.properties
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/application.properties
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/application.properties
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/app.js b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/app.js
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/app.js
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/app.js
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/homeCtrl.js b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/homeCtrl.js
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/homeCtrl.js
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/homeCtrl.js
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/indexCtrl.js b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/indexCtrl.js
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/indexCtrl.js
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/indexCtrl.js
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/msal.js b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/msal.js
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/msal.js
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/msal.js
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/msalModule.js b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/msalModule.js
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/msalModule.js
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/msalModule.js
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/todoListCtrl.js b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListCtrl.js
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/todoListCtrl.js
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListCtrl.js
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/todoListSvc.js b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListSvc.js
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/todoListSvc.js
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListSvc.js
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/userDataCtrl.js b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/userDataCtrl.js
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Scripts/userDataCtrl.js
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Scripts/userDataCtrl.js
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Views/Home.html b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Views/Home.html
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Views/Home.html
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Views/Home.html
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Views/TodoList.html b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Views/TodoList.html
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Views/TodoList.html
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Views/TodoList.html
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Views/UserData.html b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Views/UserData.html
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/App/Views/UserData.html
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/App/Views/UserData.html
diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/index.html b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/index.html
similarity index 100%
rename from sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter/src/main/resources/static/index.html
rename to sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter/src/main/resources/static/index.html
diff --git a/sdk/spring/azure-spring-boot-starter-active-directory/README.md b/sdk/spring/azure-spring-boot-starter-active-directory/README.md
index 2ab516a86737a..cd555eea1f6b8 100644
--- a/sdk/spring/azure-spring-boot-starter-active-directory/README.md
+++ b/sdk/spring/azure-spring-boot-starter-active-directory/README.md
@@ -16,7 +16,7 @@ With Spring Starter for Azure Active Directory, now you can get started quickly
* **Create a client secret key for the application**: Go to API ACCESS - Keys to create a secret key (`client-secret`).
### Include the package
-To use this starter in an web application, please add following packages:
+To use this starter in a web application, please add following packages:
[//]: # "{x-version-update-start;com.azure.spring:azure-spring-boot-starter-active-directory;current}"
```xml
@@ -26,13 +26,13 @@ To use this starter in an web application, please add following packages:
3.2.0-beta.1
- org.springframework.security
- spring-security-oauth2-client
+ org.springframework.boot
+ spring-boot-starter-oauth2-client
```
[//]: # "{x-version-update-end}"
-To use this starter in a resource server, please add following packages:
+To use this starter in a resource server without OBO function, please add following packages:
[//]: # "{x-version-update-start;com.azure.spring:azure-spring-boot-starter-active-directory;current}"
```xml
@@ -42,12 +42,28 @@ To use this starter in a resource server, please add following packages:
3.2.0-beta.1
- org.springframework.security
- spring-security-oauth2-client
+ org.springframework.boot
+ spring-boot-starter-oauth2-resource-server
+
+```
+[//]: # "{x-version-update-end}"
+
+To use this starter in a resource server with OBO function, please add following packages:
+
+[//]: # "{x-version-update-start;com.azure.spring:azure-spring-boot-starter-active-directory;current}"
+```xml
+
+ com.azure.spring
+ azure-spring-boot-starter-active-directory
+ 3.0.0-beta.1
+
+
+ org.springframework.boot
+ spring-boot-starter-oauth2-resource-server
- org.springframework.security
- spring-security-oauth2-resource-server
+ org.springframework.boot
+ spring-boot-starter-oauth2-client
```
[//]: # "{x-version-update-end}"
@@ -299,7 +315,7 @@ azure:
```
### Authenticate in web APIs [Web APIs]
-Please refer to [azure-spring-boot-sample-active-directory-resource-server-with-filter] for how to integrate Spring Security and Azure AD for authentication and authorization in a Single Page Application (SPA) scenario.
+Please refer to [azure-spring-boot-sample-active-directory-resource-server-by-filter] for how to integrate Spring Security and Azure AD for authentication and authorization in a Single Page Application (SPA) scenario.
#### Configure application.yml:
```yaml
@@ -402,7 +418,7 @@ The following section provides sample projects illustrating how to use the start
- [Azure Active Directory for Web apps][azure-spring-boot-sample-active-directory-webapp]
- [Azure Active Directory for Web APIs][azure-spring-boot-sample-active-directory-resource-server]
- [Azure Active Directory for On-Behalf-Of flow][azure-spring-boot-sample-active-directory-resource-server-obo]
-- [Azure Active Directory for Resource Server with Filter(Deprecated)][azure-spring-boot-sample-active-directory-resource-server-with-filter]
+- [Azure Active Directory for Resource Server by Filter(Deprecated)][azure-spring-boot-sample-active-directory-resource-server-by-filter]
## Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
@@ -414,7 +430,7 @@ Please follow [instructions here] to build from source or contribute.
[azure-spring-boot-sample-active-directory-webapp]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp
[azure-spring-boot-sample-active-directory-resource-server]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server/README.md
[azure-spring-boot-sample-active-directory-resource-server-obo]: https://github.com/ZhuXiaoBing-cn/azure-sdk-for-java/tree/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo
-[azure-spring-boot-sample-active-directory-resource-server-with-filter]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter
+[azure-spring-boot-sample-active-directory-resource-server-by-filter]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter
[AAD App Roles feature]: https://docs.microsoft.com/azure/architecture/multitenant-identity/app-roles#roles-using-azure-ad-app-roles
[client credentials grant flow]: https://docs.microsoft.com/azure/active-directory/develop/v1-oauth2-client-creds-grant-flow
[configured in your manifest]: https://docs.microsoft.com/azure/active-directory/develop/howto-add-app-roles-in-azure-ad-apps#examples
diff --git a/sdk/spring/azure-spring-boot-starter/README.md b/sdk/spring/azure-spring-boot-starter/README.md
index f2e2f864f6275..ba683d385646e 100644
--- a/sdk/spring/azure-spring-boot-starter/README.md
+++ b/sdk/spring/azure-spring-boot-starter/README.md
@@ -27,7 +27,7 @@ This starter brings auto configuration code for all Azure Spring modules, but to
## Examples
The following section provides sample projects illustrating how to use the Azure Spring Boot starters.
### More sample code
-- [Azure Active Directory for Resource Server with Filter(Deprecated)](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter)
+- [Azure Active Directory for Resource Server by Filter(Deprecated)](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter)
- [Azure Active Directory for Web Application](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp)
- [Azure Active Directory B2C](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-b2c-oidc)
- [Cosmos DB SQL API](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-cosmos)
@@ -57,7 +57,7 @@ For more information about setting logging in spring, please refer to the [offic
## Next steps
The following section provides sample projects illustrating how to use the Azure Spring Boot starters.
### More sample code
-- [Azure Active Directory for Resource Server with Filter(Deprecated)](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-with-filter)
+- [Azure Active Directory for Resource Server by Filter(Deprecated)](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-by-filter)
- [Azure Active Directory for Web Application](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp)
- [Azure Active Directory B2C](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-b2c-oidc)
- [Cosmos DB SQL API](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-cosmos)
diff --git a/sdk/spring/azure-spring-boot-test-aad-obo/pom.xml b/sdk/spring/azure-spring-boot-test-aad-obo/pom.xml
index 6e1b42bfe23f5..2d10e275df57d 100644
--- a/sdk/spring/azure-spring-boot-test-aad-obo/pom.xml
+++ b/sdk/spring/azure-spring-boot-test-aad-obo/pom.xml
@@ -15,32 +15,37 @@
1.0.0
-
- com.azure.spring
- azure-spring-boot-test-core
- 1.0.0
- com.azure.springazure-spring-boot-starter-active-directory3.2.0-beta.1
+
+
- org.springframework.security
- spring-security-oauth2-resource-server
+ org.springframework.boot
+ spring-boot-starter-oauth2-clientorg.springframework.boot
- spring-boot-starter-test
- test
+ spring-boot-starter-oauth2-resource-serverorg.springframework.bootspring-boot-starter-web
+
+
+
+ com.azure.spring
+ azure-spring-boot-test-core
+ 1.0.0
+ test
+ org.springframework.boot
- spring-boot-starter-oauth2-client
+ spring-boot-starter-test
+ test
diff --git a/sdk/spring/azure-spring-boot-test-aad-obo/src/test/java/com/azure/test/aad/webapi/AADWebApiOboIT.java b/sdk/spring/azure-spring-boot-test-aad-obo/src/test/java/com/azure/test/aad/webapi/AADWebApiOboIT.java
index 205e757d069b1..346cb152eda7a 100644
--- a/sdk/spring/azure-spring-boot-test-aad-obo/src/test/java/com/azure/test/aad/webapi/AADWebApiOboIT.java
+++ b/sdk/spring/azure-spring-boot-test-aad-obo/src/test/java/com/azure/test/aad/webapi/AADWebApiOboIT.java
@@ -3,20 +3,15 @@
package com.azure.test.aad.webapi;
-import com.azure.test.oauth.OAuthResponse;
-import com.azure.test.oauth.OAuthUtils;
-import com.azure.test.utils.AppRunner;
+import com.azure.spring.test.aad.AADWebApiITHelper;
+import com.azure.spring.test.AppRunner;
+import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
@@ -34,56 +29,49 @@
import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.client.RestTemplate;
import org.springframework.web.reactive.function.client.WebClient;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.Map;
import java.util.function.Consumer;
-import static com.azure.test.oauth.OAuthUtils.AAD_MULTI_TENANT_CLIENT_ID;
-import static com.azure.test.oauth.OAuthUtils.AAD_MULTI_TENANT_CLIENT_SECRET;
+import static com.azure.spring.test.aad.EnvironmentVariables.AAD_MULTI_TENANT_CLIENT_ID;
+import static com.azure.spring.test.aad.EnvironmentVariables.AAD_MULTI_TENANT_CLIENT_SECRET;
+import static com.azure.spring.test.aad.EnvironmentVariables.MULTI_TENANT_SCOPE_GRAPH_READ;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
import static org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient;
public class AADWebApiOboIT {
private static final Logger LOGGER = LoggerFactory.getLogger(AADWebApiOboIT.class);
-
private static final String GRAPH_ME_ENDPOINT = "https://graph.microsoft.com/v1.0/me";
- private final RestTemplate restTemplate = new RestTemplate();
+ private AADWebApiITHelper aadWebApiITHelper;
+
+ @Before
+ public void init() {
+ Map properties = new HashMap<>();
+ properties.put("azure.activedirectory.client-id", AAD_MULTI_TENANT_CLIENT_ID);
+ properties.put("azure.activedirectory.client-secret", AAD_MULTI_TENANT_CLIENT_SECRET);
+ properties.put("azure.activedirectory.app-id-uri", "api://" + AAD_MULTI_TENANT_CLIENT_ID);
+ properties.put("azure.activedirectory.authorization-clients.graph.scopes",
+ "https://graph.microsoft.com/User.Read");
+ aadWebApiITHelper = new AADWebApiITHelper(
+ DumbApp.class,
+ properties,
+ AAD_MULTI_TENANT_CLIENT_ID,
+ AAD_MULTI_TENANT_CLIENT_SECRET,
+ Collections.singletonList(MULTI_TENANT_SCOPE_GRAPH_READ));
+ }
@Test
public void testCallGraph() {
- this.runApp(app -> {
- final OAuthResponse authResponse = OAuthUtils.executeOAuth2ROPCFlow(
- System.getenv(AAD_MULTI_TENANT_CLIENT_ID), System.getenv(AAD_MULTI_TENANT_CLIENT_SECRET));
- assertNotNull(authResponse);
-
- final HttpHeaders headers = new HttpHeaders();
- headers.set("Authorization", String.format("Bearer %s", authResponse.getAccessToken()));
- HttpEntity