From 52d2a89d88f3932cdb87f60a6eba77e296a44953 Mon Sep 17 00:00:00 2001 From: Rujun Chen Date: Mon, 22 Nov 2021 10:23:34 +0800 Subject: [PATCH] Use version 4.0 for aad related sample (#72) --- README.md | 22 +++---- .../aad-b2c-resource-server/pom.xml | 39 ----------- .../src/main/resources/application.yml | 11 ---- .../src/main/resources/application.yml | 13 ---- .../src/main/resources/application.properties | 7 -- .../src/main/resources/application.yml | 17 ----- .../src/main/resources/application.yml | 21 ------ .../src/main/resources/application.yml | 13 ---- .../src/main/resources/application.yml | 36 ---------- .../src/main/resources/application.yml | 27 -------- .../aad-b2c-resource-server/README.md | 21 +++--- .../docs/image-add-application-roles.png | Bin .../docs/image-add-delegated-permissions.png | Bin .../docs/image-add-user-flow.png | Bin .../image-configuration-application-roles.png | Bin ...-application-and-delegated-permissions.png | Bin .../docs/image-expose-an-api.png | Bin .../docs/image-final-configuration.png | Bin .../docs/image-select-a-user-flow-type.png | Bin .../docs/image-selected-application.png | Bin .../docs/image-setting-relevant-content.png | Bin .../docs/image-user-flow-finally.png | Bin .../aad-b2c-resource-server/pom.xml | 27 ++++++++ ...eADB2CResourceServerSampleApplication.java | 0 .../aad/b2c/controller/WebController.java | 0 .../security/WebSecurityConfiguration.java | 2 +- .../src/main/resources/application.yml | 14 ++++ .../aad-b2c-web-application/README.md | 31 +++++---- .../aad-b2c-web-application/pom.xml | 22 ++----- .../b2c/AzureADB2COIDCSampleApplication.java | 0 .../aad/b2c/controller/WebController.java | 0 .../security/WebSecurityConfiguration.java | 2 +- .../src/main/resources/application.yml | 16 +++++ .../src/main/resources/templates/home.html | 0 .../README.md | 7 +- .../docs/demo.webp | Bin .../pom.xml | 22 ++----- ...reADStatelessBackendSampleApplication.java | 0 .../sample/aad/controller/MainController.java | 0 .../aad/security/AADWebSecurityConfig.java | 2 +- .../src/main/resources/application.properties | 8 +++ .../src/main/resources/static/index.html | 0 .../aad-resource-server-by-filter/README.md | 27 ++++---- .../docs/add-permissions.png | Bin .../docs/application-registration-1.png | Bin .../docs/application-registration-2.png | Bin .../docs/create-secret.png | Bin .../docs/grant-admin-consent.png | Bin .../docs/secret-value.png | Bin .../docs/tokens-to-accept.png | Bin .../aad-resource-server-by-filter/pom.xml | 22 ++----- ...ingBootAutoconfigureSampleApplication.java | 0 .../aad/controller/TodoListController.java | 6 +- .../spring/sample/aad/model/TodoItem.java | 0 .../aad/security/WebSecurityConfig.java | 2 +- .../src/main/resources/application.yml | 20 ++++++ .../main/resources/static/App/Scripts/app.js | 0 .../resources/static/App/Scripts/homeCtrl.js | 0 .../resources/static/App/Scripts/indexCtrl.js | 0 .../main/resources/static/App/Scripts/msal.js | 0 .../static/App/Scripts/msalModule.js | 0 .../static/App/Scripts/todoListCtrl.js | 0 .../static/App/Scripts/todoListSvc.js | 0 .../static/App/Scripts/userDataCtrl.js | 0 .../main/resources/static/App/Views/Home.html | 0 .../resources/static/App/Views/TodoList.html | 0 .../resources/static/App/Views/UserData.html | 0 .../src/main/resources/templates/index.html | 0 .../aad-resource-server-obo/README.md | 39 ++++++----- ...ad-obo-flow-and-client-credential-flow.png | Bin .../docs/image-add-grant-admin-consent.png | Bin .../docs/image-add-permissions.png | Bin .../image-resource-server-obo-add-scope.png | Bin .../image-select-application-permission.png | Bin .../docs/image-select-myapis.png | Bin .../aad-resource-server-obo/pom.xml | 24 ++----- ...th2ResourceServerOboSampleApplication.java | 0 .../configuration/AADSampleConfiguration.java | 0 .../aad/controller/SampleController.java | 0 .../src/main/resources/application.yml | 24 +++++++ .../aad-resource-server/README.md | 13 ++-- .../docs/image-add-a-scope.png | Bin .../docs/image-add-custom-apis-to-webapp.png | Bin .../docs/image-add-resource-server.png | Bin .../docs/image-creat-secrets-api.png | Bin .../docs/image-expose-api.png | Bin .../aad-resource-server/docs/image-final.png | Bin .../docs/image-granted-permission.png | Bin .../docs/image-protal-manage.png | Bin .../docs/image-register-a-web-api.png | Bin .../docs/image-set-application-id-url.png | Bin .../aad-resource-server/pom.xml | 22 ++----- ...OAuth2ResourceServerSampleApplication.java | 0 .../sample/aad/controller/HomeController.java | 0 .../src/main/resources/application.yml | 16 +++++ .../README.md | 0 .../pom.xml | 22 ++----- ...AppAndResourceServerSampleApplication.java | 0 .../sample/aad/config/WebClientConfig.java | 0 .../controller/webapi/WebApiController.java | 0 .../webapp/AuthorityController.java | 0 .../webapp/CallWebApiController.java | 0 .../controller/webapp/ClientController.java | 0 .../webapp/OnDemandClientController.java | 0 .../aad/controller/webapp/RoleController.java | 0 ...WebApplicationAndResourceServerConfig.java | 4 +- .../spring/sample/aad/utils/JsonMapper.java | 0 .../src/main/resources/application.yml | 39 +++++++++++ .../src/main/resources/templates/index.html | 0 .../aad-web-application/README.md | 62 ++++++++++-------- .../docs/image-add-a-platform.png | Bin .../docs/image-add-grant-admin-consent.png | Bin .../docs/image-add-permissions.png | Bin .../docs/image-create-app-secrets.png | Bin .../docs/image-permissions.png | Bin .../docs/image-portal-manage.png | Bin .../docs/image-register-a-web-app.png | Bin .../docs/image-request-api-permissions.png | Bin .../docs/image-secret-value.png | Bin .../docs/image-select-myapis.png | Bin .../aad-web-application/pom.xml | 22 ++----- .../AzureADOAuth2WebAppSampleApplication.java | 0 .../sample/aad/config/WebClientConfig.java | 0 .../aad/controller/AuthorityController.java | 0 .../aad/controller/ClientController.java | 0 .../controller/OnDemandClientController.java | 0 .../sample/aad/controller/RoleController.java | 0 .../aad/controller/WebApiController.java | 0 .../spring/sample/aad/utils/JsonMapper.java | 0 .../src/main/resources/application.yml | 30 +++++++++ .../src/main/resources/templates/index.html | 0 pom.xml | 17 +++-- 132 files changed, 369 insertions(+), 422 deletions(-) delete mode 100644 aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/pom.xml delete mode 100644 aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/resources/application.yml delete mode 100644 aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/application.yml delete mode 100644 aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/application.properties delete mode 100644 aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/application.yml delete mode 100644 aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/resources/application.yml delete mode 100644 aad/azure-spring-boot-starter-active-directory/aad-resource-server/src/main/resources/application.yml delete mode 100644 aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/application.yml delete mode 100644 aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/resources/application.yml rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/README.md (88%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-add-application-roles.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-add-delegated-permissions.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-add-user-flow.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-configuration-application-roles.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-consent-application-and-delegated-permissions.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-expose-an-api.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-final-configuration.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-select-a-user-flow-type.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-selected-application.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-setting-relevant-content.png (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/docs/image-user-flow-finally.png (100%) create mode 100644 aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/pom.xml rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2CResourceServerSampleApplication.java (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java (91%) create mode 100644 aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/resources/application.yml rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-web-application/README.md (83%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-web-application/pom.xml (63%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2COIDCSampleApplication.java (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java (100%) rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java (92%) create mode 100644 aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/application.yml rename aad/{azure-spring-boot-starter-active-directory-b2c => spring-cloud-azure-starter-active-directory-b2c}/aad-b2c-web-application/src/main/resources/templates/home.html (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter-stateless/README.md (93%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter-stateless/docs/demo.webp (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter-stateless/pom.xml (63%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/AzureADStatelessBackendSampleApplication.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/controller/MainController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java (93%) create mode 100644 aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/application.properties rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter-stateless/src/main/resources/static/index.html (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/README.md (94%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/docs/add-permissions.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/docs/application-registration-1.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/docs/application-registration-2.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/docs/create-secret.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/docs/grant-admin-consent.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/docs/secret-value.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/docs/tokens-to-accept.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/pom.xml (60%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/AzureAdIntegrationSpringBootAutoconfigureSampleApplication.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java (95%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/model/TodoItem.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java (95%) create mode 100644 aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/application.yml rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/app.js (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/homeCtrl.js (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/indexCtrl.js (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msal.js (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msalModule.js (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListCtrl.js (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListSvc.js (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/userDataCtrl.js (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Views/Home.html (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Views/TodoList.html (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/static/App/Views/UserData.html (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-by-filter/src/main/resources/templates/index.html (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/README.md (88%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/docs/image-aad-obo-flow-and-client-credential-flow.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/docs/image-add-grant-admin-consent.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/docs/image-add-permissions.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/docs/image-resource-server-obo-add-scope.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/docs/image-select-application-permission.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/docs/image-select-myapis.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/pom.xml (61%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/AADOAuth2ResourceServerOboSampleApplication.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java (100%) create mode 100644 aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/resources/application.yml rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/README.md (94%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-add-a-scope.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-add-custom-apis-to-webapp.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-add-resource-server.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-creat-secrets-api.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-expose-api.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-final.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-granted-permission.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-protal-manage.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-register-a-web-api.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/docs/image-set-application-id-url.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/pom.xml (52%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2ResourceServerSampleApplication.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-resource-server/src/main/java/com/azure/spring/sample/aad/controller/HomeController.java (100%) create mode 100644 aad/spring-cloud-azure-starter-active-directory/aad-resource-server/src/main/resources/application.yml rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/README.md (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/pom.xml (65%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppAndResourceServerSampleApplication.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapi/WebApiController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/AuthorityController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/CallWebApiController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/ClientController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/OnDemandClientController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/RoleController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/security/AADWebApplicationAndResourceServerConfig.java (88%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java (100%) create mode 100644 aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/application.yml rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application-and-resource-server/src/main/resources/templates/index.html (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/README.md (86%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-add-a-platform.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-add-grant-admin-consent.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-add-permissions.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-create-app-secrets.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-permissions.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-portal-manage.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-register-a-web-app.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-request-api-permissions.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-secret-value.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/docs/image-select-myapis.png (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/pom.xml (67%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppSampleApplication.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/AuthorityController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/ClientController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/OnDemandClientController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/RoleController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/WebApiController.java (100%) rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java (100%) create mode 100644 aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/resources/application.yml rename aad/{azure-spring-boot-starter-active-directory => spring-cloud-azure-starter-active-directory}/aad-web-application/src/main/resources/templates/index.html (100%) diff --git a/README.md b/README.md index 4bc9b5ccf..091a39bfe 100644 --- a/README.md +++ b/README.md @@ -13,14 +13,14 @@ | Azure Service | Azure Spring Starter Dependency | Sample Project | |------------------|------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------| -| AAD | [azure-spring-boot-starter-active-directory-b2c:3.9.0] | [aad-b2c-resource-server](aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server) | -| AAD | [azure-spring-boot-starter-active-directory-b2c:3.9.0] | [aad-b2c-web-application](aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application) | -| AAD | [azure-spring-boot-starter-active-directory:3.9.0] | [aad-resource-server-by-filter-stateless](aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless) | -| AAD | [azure-spring-boot-starter-active-directory:3.9.0] | [aad-resource-server-by-filter](aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter) | -| AAD | [azure-spring-boot-starter-active-directory:3.9.0] | [aad-resource-server-obo](aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo) | -| AAD | [azure-spring-boot-starter-active-directory:3.9.0] | [aad-resource-server](aad/azure-spring-boot-starter-active-directory/aad-resource-server) | -| AAD | [azure-spring-boot-starter-active-directory:3.9.0] | [aad-web-application](aad/azure-spring-boot-starter-active-directory/aad-web-application) | -| AAD | [azure-spring-boot-starter-active-directory:3.9.0] | [aad-webapp-resource-server](aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server) | +| AAD | [spring-cloud-azure-starter-active-directory-b2c:4.0.0.beta-1] | [aad-b2c-resource-server](aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server) | +| AAD | [spring-cloud-azure-starter-active-directory-b2c:4.0.0.beta-1] | [aad-b2c-web-application](aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application) | +| AAD | [spring-cloud-azure-starter-active-directory:4.0.0.beta-1] | [aad-resource-server-by-filter-stateless](aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless) | +| AAD | [spring-cloud-azure-starter-active-directory:4.0.0.beta-1] | [aad-resource-server-by-filter](aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter) | +| AAD | [spring-cloud-azure-starter-active-directory:4.0.0.beta-1] | [aad-resource-server-obo](aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo) | +| AAD | [spring-cloud-azure-starter-active-directory:4.0.0.beta-1] | [aad-resource-server](aad/spring-cloud-azure-starter-active-directory/aad-resource-server) | +| AAD | [spring-cloud-azure-starter-active-directory:4.0.0.beta-1] | [aad-web-application](aad/spring-cloud-azure-starter-active-directory/aad-web-application) | +| AAD | [spring-cloud-azure-starter-active-directory:4.0.0.beta-1] | [aad-webapp-resource-server](aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server) | | appconfiguration | [azure-spring-boot-starter-cosmos:3.9.0] | [azure-appconfiguration-conversion-sample-initial](appconfiguration/azure-appconfiguration-conversion-sample-initial) | | appconfiguration | [spring-cloud-azure-appconfiguration-config:1.3.0] | [azure-appconfiguration-sample](appconfiguration/azure-appconfiguration-sample) | | appconfiguration | [spring-cloud-azure-feature-management:1.3.0] | [feature-management-sample](appconfiguration/feature-management-sample) | @@ -75,9 +75,9 @@ [azure-spring-boot-starter-cosmos:3.9.0]: https://search.maven.org/artifact/com.azure.spring/azure-spring-boot-starter-cosmos/3.9.0/jar [spring-cloud-azure-stream-binder-servicebus:4.0.0-beta.1]: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-stream-binder-servicebus/4.0.0-beta.1/jar [azure-spring-boot-starter-storage:3.9.0]: https://search.maven.org/artifact/com.azure.spring/azure-spring-boot-starter-storage/3.9.0/jar -[azure-spring-boot-starter-active-directory:3.9.0]: https://search.maven.org/artifact/com.azure.spring/azure-spring-boot-starter-active-directory/3.9.0/jar -[azure-spring-boot-starter-active-directory-b2c:3.9.0]: https://search.maven.org/artifact/com.azure.spring/azure-spring-boot-starter-active-directory-b2c/3.9.0/jar -[spring-cloud-azure-starter-servicebus-jms:4.0.0-beta.1]: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-servicebus-jms/4.0.0-beta.1/jar +[spring-cloud-azure-starter-active-directory:4.0.0.beta-1]: https://search.maven.org/artifact/com.azure.spring/azure-spring-boot-starter-active-directory/3.9.0/jar +[spring-cloud-azure-starter-active-directory-b2c:4.0.0.beta-1]: https://search.maven.org/artifact/com.azure.spring/azure-spring-boot-starter-active-directory-b2c/3.9.0/jar +[azure-spring-boot-starter-servicebus-jms:3.9.0]: https://search.maven.org/artifact/com.azure.spring/azure-spring-boot-starter-servicebus-jms/3.9.0/jar [spring-cloud-azure-starter-integration-servicebus:4.0.0-beta.1]: https://search.maven.org/artifact/com.azure.spring/spring-cloud-azure-starter-integration-servicebus/4.0.0-beta.1/jar [azure-spring-cloud-starter-storage-queue:2.9.0]: https://search.maven.org/artifact/com.azure.spring/azure-spring-cloud-starter-storage-queue/2.9.0/jar [azure-security-keyvault-jca:2.1.0]: https://mvnrepository.com/artifact/com.azure/azure-security-keyvault-jca \ No newline at end of file diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/pom.xml b/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/pom.xml deleted file mode 100644 index 521d82a78..000000000 --- a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - - org.springframework.boot - spring-boot-starter-parent - 2.5.4 - - - com.azure.spring - azure-spring-boot-sample-active-directory-b2c-resource-server - 1.0.0 - jar - - - - - com.azure.spring - azure-spring-boot-bom - 3.10.0 - pom - import - - - - - - - com.azure.spring - azure-spring-boot-starter-active-directory-b2c - - - org.springframework.boot - spring-boot-starter-web - - - diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/resources/application.yml b/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/resources/application.yml deleted file mode 100644 index 9ffe8a6e4..000000000 --- a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/resources/application.yml +++ /dev/null @@ -1,11 +0,0 @@ -# In v2.0 tokens, `aud` is always the client ID of the API, while in v1.0 tokens it can be the resource URI used in the request. - -azure: - activedirectory: - b2c: - tenant-id: ${your-tenant-id} - app-id-uri: ${your-app-id-uri} # If you are using v1.0 token, please configure app-id-uri for `aud` verification - client-id: ${your-client-id} # If you are using v2.0 token, please configure client-id for `aud` verification - base-uri: ${your-base-uri} # Such as: https://xxxxb2c.b2clogin.com - user-flows: - sign-up-or-sign-in: ${sign-up-or-sign-in-user-flow-name} diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/application.yml b/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/application.yml deleted file mode 100644 index 968a36948..000000000 --- a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/application.yml +++ /dev/null @@ -1,13 +0,0 @@ -azure: - activedirectory: - b2c: - base-uri: ${your-tenant-authorization-server-base-uri} - client-id: ${your-client-id} - client-secret: ${your-client-secret} - login-flow: ${your-login-user-flow-key} # default to sign-up-or-sign-in, will look up the user-flows map with provided key. - logout-success-url: ${your-logout-success-url} - user-flows: - password-reset: ${your-profile-edit-user-flow} - profile-edit: ${your-password-reset-user-flow} - sign-up-or-sign-in: ${your-sign-up-or-in-user-flow} - user-name-attribute-name: ${your-user-name-claim} diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/application.properties b/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/application.properties deleted file mode 100644 index 8b3b50604..000000000 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/application.properties +++ /dev/null @@ -1,7 +0,0 @@ -# By default, azure.activedirectory.environment property has value `global`, -# supported value is global, cn. Please refer to the README for details. -# azure.activedirectory.environment=global -azure.activedirectory.session-stateless=true -azure.activedirectory.client-id=xxxxxx-your-client-id-xxxxxx -azure.activedirectory.appIdUri=xxxxxx-your-appIDUri-xxxxxx - diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/application.yml b/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/application.yml deleted file mode 100644 index 4d7895463..000000000 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/application.yml +++ /dev/null @@ -1,17 +0,0 @@ -# By default, azure.activedirectory.environment property has value `global`, -# supported value is global, cn. Please refer to the README for details. -# azure.activedirectory.environment=global -azure: - activedirectory: - tenant-id: - client-id: - client-secret: - # Optional, default value is http://localhost:8080/ - # redirect-uri-template: - # groups that you created in your Azure AD tenant - user-group: - allowed-groups: group1,group2 - # Optional, the default value is - # environment: global - - diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/resources/application.yml b/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/resources/application.yml deleted file mode 100644 index 54eb300f2..000000000 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/resources/application.yml +++ /dev/null @@ -1,21 +0,0 @@ -server: - port: 8081 - -azure: - activedirectory: - client-id: - client-secret: - tenant-id: - app-id-uri: - authorization-clients: - graph: - scopes: - - https://graph.microsoft.com/User.Read - webapiB: # When authorization-grant-type is null, on behalf of flow is used by default - authorization-grant-type: on_behalf_of - scopes: - - /WebApiB.ExampleScope - webapiC: - authorization-grant-type: client_credentials - scopes: - - /.default \ No newline at end of file diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/src/main/resources/application.yml b/aad/azure-spring-boot-starter-active-directory/aad-resource-server/src/main/resources/application.yml deleted file mode 100644 index 89619edfc..000000000 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/src/main/resources/application.yml +++ /dev/null @@ -1,13 +0,0 @@ -# If we configure the azure.activedirectory.client-id or azure.activedirectory.app-id-uri will be to check the audience. -# In v2.0 tokens, this is always the client ID of the API, while in v1.0 tokens it can be the client ID or the resource URI used in the request. -# If you are using v1.0 tokens, configure both to properly complete the audience validation. - -server: - port: 8082 - -azure: - activedirectory: - tenant-id: ${your-tenant-id} -# client-id: ${your-client-id} -# app-id-uri: ${your-app-id-uri} - diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/application.yml b/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/application.yml deleted file mode 100644 index 5d4ec9168..000000000 --- a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/application.yml +++ /dev/null @@ -1,36 +0,0 @@ -server: - port: 8084 - -azure: - activedirectory: - client-id: - client-secret: - tenant-id: - user-group: - allowed-group-names: , - allowed-group-ids: , - post-logout-redirect-uri: http://localhost:8080 - application-type: web_application_and_resource_server # This is required. - app-id-uri: api:// - authorization-clients: - arm: - authorizationGrantType: authorization_code # This is required. - on-demand: true - scopes: https://management.core.windows.net/user_impersonation - graph: - authorizationGrantType: authorization_code # This is required. - scopes: - - https://graph.microsoft.com/User.Read - - https://graph.microsoft.com/Directory.Read.All -# webapiA: # Web Application uses webapiA client to access restricted resources. -# authorizationGrantType: authorization_code -# scopes: -# - api:///Obo.WebApiA.ExampleScope -# webapiBWithObo: # Resource server uses webapiBObo client to access restricted resources. -# authorization-grant-type: on_behalf_of -# scopes: -# - api://WebApiB.ExampleScope -# webapiBWithClientCredentials: # Both Web Application or Resource Server can use webapiBWithClientCredentials client to access restricted resources. -# authorization-grant-type: client_credentials -# scopes: -# - api:///.default diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/resources/application.yml b/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/resources/application.yml deleted file mode 100644 index 47803f00f..000000000 --- a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/resources/application.yml +++ /dev/null @@ -1,27 +0,0 @@ -# WebapiA is an optional client, we can access obo resource servers. -# We can also access a custom server according to the webapiA client. - -azure: - activedirectory: - client-id: - client-secret: - tenant-id: - user-group: - allowed-group-names: , - allowed-group-ids: , # When 'all' is used, all group id can be obtained. - post-logout-redirect-uri: http://localhost:8080 - authorization-clients: - arm: - on-demand: true - scopes: https://management.core.windows.net/user_impersonation - graph: - scopes: - - https://graph.microsoft.com/User.Read - - https://graph.microsoft.com/Directory.Read.All -# webapiA: # This is used to demonstrate on-behalf-of function. Refs: https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow -# scopes: -# - /Obo.WebApiA.ExampleScope -# webapiB: # This is used to demonstrate client_credentials type. Refs: https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow -# scopes: -# - api:///.default -# authorization-grant-type: client_credentials \ No newline at end of file diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/README.md b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/README.md similarity index 88% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/README.md rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/README.md index 77239d5f5..316106e9e 100644 --- a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/README.md +++ b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/README.md @@ -90,15 +90,18 @@ This sample illustrates how to use `azure-spring-boot-starter-active-directory-b ```yaml # In v2.0 tokens, `aud` is always the client ID of the API, while in v1.0 tokens it can be the app id uri. -azure: - activedirectory: - b2c: - tenant-id: ${your-tenant-id} - app-id-uri: ${your-app-id-uri} # If you are using v1.0 token, please configure app-id-uri for `aud` verification - client-id: ${your-client-id} # If you are using v2.0 token, please configure client-id for `aud` verification - base-uri: ${your-base-uri} # Such as: https://xxxxb2c.b2clogin.com - user-flows: - sign-up-or-sign-in: ${sign-up-or-sign-in-user-flow-name} +spring: + cloud: + azure: + active-directory: + b2c: + enabled: true + tenant-id: ${your-tenant-id} + app-id-uri: ${your-app-id-uri} # If you are using v1.0 token, please configure app-id-uri for `aud` verification + client-id: ${your-client-id} # If you are using v2.0 token, please configure client-id for `aud` verification + base-uri: ${your-base-uri} # Such as: https://xxxxb2c.b2clogin.com + user-flows: + sign-up-or-sign-in: ${sign-up-or-sign-in-user-flow-name} ``` ### Run with Maven diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-application-roles.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-application-roles.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-application-roles.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-application-roles.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-delegated-permissions.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-delegated-permissions.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-delegated-permissions.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-delegated-permissions.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-user-flow.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-user-flow.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-user-flow.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-add-user-flow.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-configuration-application-roles.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-configuration-application-roles.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-configuration-application-roles.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-configuration-application-roles.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-consent-application-and-delegated-permissions.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-consent-application-and-delegated-permissions.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-consent-application-and-delegated-permissions.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-consent-application-and-delegated-permissions.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-expose-an-api.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-expose-an-api.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-expose-an-api.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-expose-an-api.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-final-configuration.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-final-configuration.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-final-configuration.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-final-configuration.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-select-a-user-flow-type.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-select-a-user-flow-type.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-select-a-user-flow-type.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-select-a-user-flow-type.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-selected-application.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-selected-application.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-selected-application.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-selected-application.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-setting-relevant-content.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-setting-relevant-content.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-setting-relevant-content.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-setting-relevant-content.png diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-user-flow-finally.png b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-user-flow-finally.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-user-flow-finally.png rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/docs/image-user-flow-finally.png diff --git a/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/pom.xml b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/pom.xml new file mode 100644 index 000000000..8ee6f245c --- /dev/null +++ b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + + com.azure.spring + azure-spring-boot-samples + 1.0.0 + + + com.azure.spring + spring-cloud-azure-starter-active-directory-b2c-resource-server + 1.0.0 + jar + + + + com.azure.spring + spring-cloud-azure-starter-active-directory-b2c + + + org.springframework.boot + spring-boot-starter-web + + + diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2CResourceServerSampleApplication.java b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2CResourceServerSampleApplication.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2CResourceServerSampleApplication.java rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2CResourceServerSampleApplication.java diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java similarity index 91% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java index d3fe80bb0..8124b1f51 100644 --- a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java +++ b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java @@ -3,7 +3,7 @@ package com.azure.spring.sample.aad.b2c.security; -import com.azure.spring.autoconfigure.b2c.AADB2CJwtBearerTokenAuthenticationConverter; +import com.azure.spring.cloud.autoconfigure.aad.b2c.AADB2CJwtBearerTokenAuthenticationConverter; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; diff --git a/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/resources/application.yml b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/resources/application.yml new file mode 100644 index 000000000..bdd929a2b --- /dev/null +++ b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server/src/main/resources/application.yml @@ -0,0 +1,14 @@ +# In v2.0 tokens, `aud` is always the client ID of the API, while in v1.0 tokens it can be the resource URI used in the request. + +spring: + cloud: + azure: + active-directory: + b2c: + enabled: true + tenant-id: ${your-tenant-id} + app-id-uri: ${your-app-id-uri} # If you are using v1.0 token, please configure app-id-uri for `aud` verification + client-id: ${your-client-id} # If you are using v2.0 token, please configure client-id for `aud` verification + base-uri: ${your-base-uri} # Such as: https://xxxxb2c.b2clogin.com + user-flows: + sign-up-or-sign-in: ${sign-up-or-sign-in-user-flow-name} diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/README.md b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/README.md similarity index 83% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/README.md rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/README.md index 06d65f356..6d5992efa 100644 --- a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/README.md +++ b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/README.md @@ -38,7 +38,7 @@ Follow the guide of [AAD B2C user flows creation](https://docs.microsoft.com/azu 1. Fill in `${your-tenant-authorization-server-base-uri}` from **Azure AD B2C** portal `App registrations` blade, select **Endpoints**, copy the base endpoint uri(Global cloud format may looks like `https://{your-tenant-name}.b2clogin.com/{your-tenant-name}.onmicrosoft.com`, China Cloud looks like `https://{your-tenant-name}.b2clogin.cn/{your-tenant-name}.partner.onmschina.cn`). - **NOTE**: The `azure.activedirectory.b2c.tenant` has been deprecated. Please use `azure.activedirectory.b2c.base-uri` instead. + **NOTE**: The `spring.cloud.azure.active-directory.b2c.tenant` has been deprecated. Please use `spring.cloud.azure.active-directory.b2c.base-uri` instead. 2. Select one registered instance under `Applications` from portal, and then: 1. Fill in `${your-client-id}` from `Application ID`. @@ -49,19 +49,22 @@ Follow the guide of [AAD B2C user flows creation](https://docs.microsoft.com/azu 5. Replace `${your-logout-success-url}` to `http://localhost:8080/login`. ```yaml -azure: - activedirectory: - b2c: - base-uri: ${your-tenant-authorization-server-base-uri} - client-id: ${your-client-id} - client-secret: ${your-client-secret} - login-flow: ${your-login-user-flow-key} # default to sign-up-or-sign-in, will look up the user-flows map with provided key. - logout-success-url: ${your-logout-success-url} - user-flows: - password-reset: ${your-profile-edit-user-flow} - profile-edit: ${your-password-reset-user-flow} - sign-up-or-sign-in: ${your-sign-up-or-in-user-flow} - user-name-attribute-name: ${your-user-name-claim} +spring: + cloud: + azure: + active-directory: + b2c: + enabled: true + base-uri: ${your-tenant-authorization-server-base-uri} + client-id: ${your-client-id} + client-secret: ${your-client-secret} + login-flow: ${your-login-user-flow-key} # default to sign-up-or-sign-in, will look up the user-flows map with provided key. + logout-success-url: ${your-logout-success-url} + user-flows: + password-reset: ${your-profile-edit-user-flow} + profile-edit: ${your-password-reset-user-flow} + sign-up-or-sign-in: ${your-sign-up-or-in-user-flow} + user-name-attribute-name: ${your-user-name-claim} ``` **NOTE**: If both `tenant` and `baseUri` are configured at the same time, only `baseUri` takes effect. diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/pom.xml b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/pom.xml similarity index 63% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/pom.xml rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/pom.xml index cfba6eee8..89efa3e81 100644 --- a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/pom.xml +++ b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/pom.xml @@ -4,13 +4,13 @@ 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.5.4 + com.azure.spring + azure-spring-boot-samples + 1.0.0 com.azure.spring - azure-spring-boot-sample-active-directory-b2c-oidc + spring-cloud-azure-starter-active-directory-b2c-oidc 1.0.0 jar @@ -18,22 +18,10 @@ Azure AD B2C Spring Security 5 OAuth2 Integration Spring Boot Sample https://github.com/Azure/azure-sdk-for-java - - - - com.azure.spring - azure-spring-boot-bom - 3.10.0 - pom - import - - - - com.azure.spring - azure-spring-boot-starter-active-directory-b2c + spring-cloud-azure-starter-active-directory-b2c diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2COIDCSampleApplication.java b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2COIDCSampleApplication.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2COIDCSampleApplication.java rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/AzureADB2COIDCSampleApplication.java diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/controller/WebController.java diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java similarity index 92% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java index d41960767..8debbff6f 100644 --- a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java +++ b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/java/com/azure/spring/sample/aad/b2c/security/WebSecurityConfiguration.java @@ -3,7 +3,7 @@ package com.azure.spring.sample.aad.b2c.security; -import com.azure.spring.autoconfigure.b2c.AADB2COidcLoginConfigurer; +import com.azure.spring.cloud.autoconfigure.aad.b2c.AADB2COidcLoginConfigurer; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; diff --git a/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/application.yml b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/application.yml new file mode 100644 index 000000000..e1bc6566d --- /dev/null +++ b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/application.yml @@ -0,0 +1,16 @@ +spring: + cloud: + azure: + active-directory: + b2c: + enabled: true + base-uri: ${your-tenant-authorization-server-base-uri} + client-id: ${your-client-id} + client-secret: ${your-client-secret} + login-flow: ${your-login-user-flow-key} # default to sign-up-or-sign-in, will look up the user-flows map with provided key. + logout-success-url: ${your-logout-success-url} + user-flows: + password-reset: ${your-profile-edit-user-flow} + profile-edit: ${your-password-reset-user-flow} + sign-up-or-sign-in: ${your-sign-up-or-in-user-flow} + user-name-attribute-name: ${your-user-name-claim} diff --git a/aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/templates/home.html b/aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/templates/home.html similarity index 100% rename from aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/templates/home.html rename to aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application/src/main/resources/templates/home.html diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/README.md b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/README.md similarity index 93% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/README.md rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/README.md index d144e88b1..d50e0295d 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/README.md +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/README.md @@ -79,9 +79,10 @@ Furthermore enable the implicit flow in the manifest for the demo application You have to activate the stateless app-role auth filter and configure the `client-id`of your application registration: ```properties -azure.activedirectory.session-stateless=true -azure.activedirectory.client-id=xxxxxx-your-client-id-xxxxxx -azure.activedirectory.appIdUri=xxxxxx-your-appIDUri-xxxxxx +spring.cloud.azure.active-directory.enabled=true +spring.cloud.azure.active-directory.session-stateless=true +spring.cloud.azure.active-directory.client-id=xxxxxx-your-client-id-xxxxxx +spring.cloud.azure.active-directory.appIdUri=xxxxxx-your-appIDUri-xxxxxx ``` #### Configure Webapp diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/docs/demo.webp b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/docs/demo.webp similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/docs/demo.webp rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/docs/demo.webp diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/pom.xml b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/pom.xml similarity index 63% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/pom.xml rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/pom.xml index 56255d7c9..c9d1ba9e7 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/pom.xml +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/pom.xml @@ -5,35 +5,23 @@ 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.5.4 + com.azure.spring + azure-spring-boot-samples + 1.0.0 com.azure.spring - azure-spring-boot-sample-active-directory-resource-server-by-filter-stateless + spring-cloud-azure-starter-active-directory-resource-server-by-filter-stateless 1.0.0 Azure Spring Boot Starter Sample - Azure AD Stateless Spring Security Integration Sample project using the AAD stateless app-role filter for AAD integration in Spring Security https://github.com/Azure/azure-sdk-for-java - - - - com.azure.spring - azure-spring-boot-bom - 3.10.0 - pom - import - - - - com.azure.spring - azure-spring-boot-starter-active-directory + spring-cloud-azure-starter-active-directory diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/AzureADStatelessBackendSampleApplication.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/AzureADStatelessBackendSampleApplication.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/AzureADStatelessBackendSampleApplication.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/AzureADStatelessBackendSampleApplication.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/controller/MainController.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/controller/MainController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/controller/MainController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/controller/MainController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java similarity index 93% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java index d48320614..9f4c5072d 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/java/com/azure/spring/sample/aad/security/AADWebSecurityConfig.java @@ -3,7 +3,7 @@ package com.azure.spring.sample.aad.security; -import com.azure.spring.autoconfigure.aad.AADAppRoleStatelessAuthenticationFilter; +import com.azure.spring.cloud.autoconfigure.aad.filter.AADAppRoleStatelessAuthenticationFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/application.properties b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/application.properties new file mode 100644 index 000000000..800a2b25e --- /dev/null +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/application.properties @@ -0,0 +1,8 @@ +# By default, spring.cloud.azure.active-directory.environment property has value `global`, +# supported value is global, cn. Please refer to the README for details. +# spring.cloud.azure.active-directory.environment=global +spring.cloud.azure.active-directory.enabled=true +spring.cloud.azure.active-directory.session-stateless=true +spring.cloud.azure.active-directory.client-id=xxxxxx-your-client-id-xxxxxx +spring.cloud.azure.active-directory.appIdUri=xxxxxx-your-appIDUri-xxxxxx + diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/static/index.html b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/static/index.html similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/static/index.html rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless/src/main/resources/static/index.html diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/README.md b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/README.md similarity index 94% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/README.md rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/README.md index 941dc889c..f9b4d3131 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/README.md +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/README.md @@ -90,18 +90,21 @@ In the steps below, "client-id" is the same as "Application ID" or "AppId". Open application.yml in your project to configure: ```yml -azure: - activedirectory: - tenant-id: - client-id: - client-secret: - # Optional, default value is http://localhost:8080/ - redirect-uri-template: - # groups that you created in your Azure AD tenant - user-group: - allowed-groups: group1,group2 - # Optional, the default value is - # environment: global +spring: + cloud: + azure: + active-directory: + enabled: true + tenant-id: + client-id: + client-secret: + # Optional, default value is http://localhost:8080/ + redirect-uri-template: + # groups that you created in your Azure AD tenant + user-group: + allowed-groups: group1,group2 + # Optional, the default value is + # environment: global ``` diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/add-permissions.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/add-permissions.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/add-permissions.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/add-permissions.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/application-registration-1.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/application-registration-1.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/application-registration-1.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/application-registration-1.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/application-registration-2.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/application-registration-2.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/application-registration-2.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/application-registration-2.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/create-secret.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/create-secret.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/create-secret.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/create-secret.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/grant-admin-consent.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/grant-admin-consent.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/grant-admin-consent.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/grant-admin-consent.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/secret-value.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/secret-value.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/secret-value.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/secret-value.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/tokens-to-accept.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/tokens-to-accept.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/docs/tokens-to-accept.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/docs/tokens-to-accept.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/pom.xml b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/pom.xml similarity index 60% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/pom.xml rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/pom.xml index 464b3243b..00a4d5ec4 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/pom.xml +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/pom.xml @@ -4,13 +4,13 @@ 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.5.4 + com.azure.spring + azure-spring-boot-samples + 1.0.0 com.azure.spring - azure-spring-boot-sample-active-directory-resource-server-by-filter + spring-cloud-azure-starter-active-directory-resource-server-by-filter 1.0.0 jar @@ -18,22 +18,10 @@ Azure AD Spring Security Integration Spring Boot Sample https://github.com/Azure/azure-sdk-for-java - - - - com.azure.spring - azure-spring-boot-bom - 3.10.0 - pom - import - - - - com.azure.spring - azure-spring-boot-starter-active-directory + spring-cloud-azure-starter-active-directory diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/AzureAdIntegrationSpringBootAutoconfigureSampleApplication.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/AzureAdIntegrationSpringBootAutoconfigureSampleApplication.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/AzureAdIntegrationSpringBootAutoconfigureSampleApplication.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/AzureAdIntegrationSpringBootAutoconfigureSampleApplication.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java similarity index 95% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java index 72b31ea21..e4c1f13fe 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/controller/TodoListController.java @@ -3,10 +3,10 @@ package com.azure.spring.sample.aad.controller; +import com.azure.spring.cloud.autoconfigure.aad.filter.UserPrincipal; +import com.azure.spring.cloud.autoconfigure.aad.graph.Membership; +import com.azure.spring.cloud.autoconfigure.aad.properties.AADAuthenticationProperties; import com.azure.spring.sample.aad.model.TodoItem; -import com.azure.spring.autoconfigure.aad.AADAuthenticationProperties; -import com.azure.spring.autoconfigure.aad.Membership; -import com.azure.spring.autoconfigure.aad.UserPrincipal; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/model/TodoItem.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/model/TodoItem.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/model/TodoItem.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/model/TodoItem.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java similarity index 95% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java index fb2beb5e1..ca44936fc 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/java/com/azure/spring/sample/aad/security/WebSecurityConfig.java @@ -3,7 +3,7 @@ package com.azure.spring.sample.aad.security; -import com.azure.spring.autoconfigure.aad.AADAuthenticationFilter; +import com.azure.spring.cloud.autoconfigure.aad.filter.AADAuthenticationFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/application.yml b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/application.yml new file mode 100644 index 000000000..7f75c9bcd --- /dev/null +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/application.yml @@ -0,0 +1,20 @@ +# By default, spring.cloud.azure.active-directory.environment property has value `global`, +# supported value is global, cn. Please refer to the README for details. +# spring.cloud.azure.active-directory.environment=global +spring: + cloud: + azure: + active-directory: + enabled: true + tenant-id: + client-id: + client-secret: + # Optional, default value is http://localhost:8080/ + # redirect-uri-template: + # groups that you created in your Azure AD tenant + user-group: + allowed-groups: group1,group2 + # Optional, the default value is + # environment: global + + diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/app.js b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/app.js similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/app.js rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/app.js diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/homeCtrl.js b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/homeCtrl.js similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/homeCtrl.js rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/homeCtrl.js diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/indexCtrl.js b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/indexCtrl.js similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/indexCtrl.js rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/indexCtrl.js diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msal.js b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msal.js similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msal.js rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msal.js diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msalModule.js b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msalModule.js similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msalModule.js rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/msalModule.js diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListCtrl.js b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListCtrl.js similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListCtrl.js rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListCtrl.js diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListSvc.js b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListSvc.js similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListSvc.js rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/todoListSvc.js diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/userDataCtrl.js b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/userDataCtrl.js similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/userDataCtrl.js rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Scripts/userDataCtrl.js diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/Home.html b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/Home.html similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/Home.html rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/Home.html diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/TodoList.html b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/TodoList.html similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/TodoList.html rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/TodoList.html diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/UserData.html b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/UserData.html similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/UserData.html rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/static/App/Views/UserData.html diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/templates/index.html b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/templates/index.html similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter/src/main/resources/templates/index.html rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter/src/main/resources/templates/index.html diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/README.md b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/README.md similarity index 88% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/README.md rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/README.md index 87d71d2a8..051441791 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/README.md +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/README.md @@ -49,24 +49,27 @@ See [OAuth 2.0 On-Behalf-Of flow] for more information about OBO. ## Examples ### Configure application.yml ```yaml -azure: - activedirectory: - client-id: - client-secret: - tenant-id: - app-id-uri: - authorization-clients: - graph: - scopes: - - https://graph.microsoft.com/User.Read - webapiB: # When authorization-grant-type is null, on behalf of flow is used by default - authorization-grant-type: on_behalf_of - scopes: - - /WebApiB.ExampleScope - webapiC: - authorization-grant-type: client_credentials - scopes: - - /.default +spring: + cloud: + azure: + active-directory: + enabled: true + client-id: + client-secret: + tenant-id: + app-id-uri: + authorization-clients: + graph: + scopes: + - https://graph.microsoft.com/User.Read + webapiB: # When authorization-grant-type is null, on behalf of flow is used by default + authorization-grant-type: on_behalf_of + scopes: + - /WebApiB.ExampleScope + webapiC: + authorization-grant-type: client_credentials + scopes: + - /.default ``` ### Run with Maven diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-aad-obo-flow-and-client-credential-flow.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-aad-obo-flow-and-client-credential-flow.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-aad-obo-flow-and-client-credential-flow.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-aad-obo-flow-and-client-credential-flow.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-add-grant-admin-consent.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-add-grant-admin-consent.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-add-grant-admin-consent.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-add-grant-admin-consent.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-add-permissions.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-add-permissions.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-add-permissions.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-add-permissions.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-resource-server-obo-add-scope.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-resource-server-obo-add-scope.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-resource-server-obo-add-scope.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-resource-server-obo-add-scope.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-select-application-permission.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-select-application-permission.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-select-application-permission.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-select-application-permission.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-select-myapis.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-select-myapis.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/docs/image-select-myapis.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/docs/image-select-myapis.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/pom.xml b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/pom.xml similarity index 61% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/pom.xml rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/pom.xml index 0d3db50f5..cecc066a0 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/pom.xml +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/pom.xml @@ -3,33 +3,21 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.5.4 - + com.azure.spring + azure-spring-boot-samples + 1.0.0 + com.azure.spring - azure-spring-boot-sample-active-directory-resource-server-obo + spring-cloud-azure-starter-active-directory-resource-server-obo 1.0.0 Azure Spring Boot Azure AD Starter Sample - Resource Server OBO Azure AD Spring Security Integration Spring Boot Resource Server OBO - - - - com.azure.spring - azure-spring-boot-bom - 3.10.0 - pom - import - - - - com.azure.spring - azure-spring-boot-starter-active-directory + spring-cloud-azure-starter-active-directory diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/AADOAuth2ResourceServerOboSampleApplication.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/AADOAuth2ResourceServerOboSampleApplication.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/AADOAuth2ResourceServerOboSampleApplication.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/AADOAuth2ResourceServerOboSampleApplication.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java diff --git a/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/resources/application.yml b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/resources/application.yml new file mode 100644 index 000000000..ef1e5baa7 --- /dev/null +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo/src/main/resources/application.yml @@ -0,0 +1,24 @@ +server: + port: 8081 + +spring: + cloud: + azure: + active-directory: + enabled: true + client-id: + client-secret: + tenant-id: + app-id-uri: + authorization-clients: + graph: + scopes: + - https://graph.microsoft.com/User.Read + webapiB: # When authorization-grant-type is null, on behalf of flow is used by default + authorization-grant-type: on_behalf_of + scopes: + - /WebApiB.ExampleScope + webapiC: + authorization-grant-type: client_credentials + scopes: + - /.default \ No newline at end of file diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/README.md b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/README.md similarity index 94% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/README.md rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/README.md index 8a2dd6dc9..bfadbf42b 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/README.md +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/README.md @@ -53,14 +53,17 @@ See [Expose scoped permission to web api] for more information about web api. ## Examples ### Configure application.yml ```yaml -#If we configure the azure.activedirectory.client-id or azure.activedirectory.app-id-uri will be to check the audience. +#If we configure the spring.cloud.azure.active-directory.client-id or spring.cloud.azure.active-directory.app-id-uri will be to check the audience. #In v2.0 tokens, this is always client id of the app, while in v1.0 tokens it can be the client id or the application id url used in the request. #If you are using v1.0 tokens, configure both to properly complete the audience validation. -azure: - activedirectory: - client-id: - app-id-uri: +spring: + cloud: + azure: + active-directory: + enabled: true + client-id: + app-id-uri: ``` ### Run with Maven diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-add-a-scope.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-add-a-scope.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-add-a-scope.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-add-a-scope.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-add-custom-apis-to-webapp.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-add-custom-apis-to-webapp.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-add-custom-apis-to-webapp.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-add-custom-apis-to-webapp.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-add-resource-server.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-add-resource-server.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-add-resource-server.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-add-resource-server.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-creat-secrets-api.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-creat-secrets-api.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-creat-secrets-api.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-creat-secrets-api.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-expose-api.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-expose-api.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-expose-api.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-expose-api.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-final.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-final.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-final.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-final.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-granted-permission.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-granted-permission.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-granted-permission.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-granted-permission.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-protal-manage.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-protal-manage.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-protal-manage.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-protal-manage.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-register-a-web-api.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-register-a-web-api.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-register-a-web-api.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-register-a-web-api.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-set-application-id-url.png b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-set-application-id-url.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/docs/image-set-application-id-url.png rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/docs/image-set-application-id-url.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/pom.xml b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/pom.xml similarity index 52% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/pom.xml rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/pom.xml index ec1e2b6c4..10e338440 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/pom.xml +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/pom.xml @@ -4,32 +4,20 @@ 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.5.4 + com.azure.spring + azure-spring-boot-samples + 1.0.0 com.azure.spring - azure-spring-boot-sample-active-directory-resource-server + spring-cloud-azure-starter-active-directory-resource-server 1.0.0 jar - - - - com.azure.spring - azure-spring-boot-bom - 3.10.0 - pom - import - - - - com.azure.spring - azure-spring-boot-starter-active-directory + spring-cloud-azure-starter-active-directory diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2ResourceServerSampleApplication.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2ResourceServerSampleApplication.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2ResourceServerSampleApplication.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2ResourceServerSampleApplication.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-resource-server/src/main/java/com/azure/spring/sample/aad/controller/HomeController.java b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/src/main/java/com/azure/spring/sample/aad/controller/HomeController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-resource-server/src/main/java/com/azure/spring/sample/aad/controller/HomeController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-resource-server/src/main/java/com/azure/spring/sample/aad/controller/HomeController.java diff --git a/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/src/main/resources/application.yml b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/src/main/resources/application.yml new file mode 100644 index 000000000..c05833f88 --- /dev/null +++ b/aad/spring-cloud-azure-starter-active-directory/aad-resource-server/src/main/resources/application.yml @@ -0,0 +1,16 @@ +# If we configure the spring.cloud.azure.active-directory.client-id or spring.cloud.azure.active-directory.app-id-uri will be to check the audience. +# In v2.0 tokens, this is always the client ID of the API, while in v1.0 tokens it can be the client ID or the resource URI used in the request. +# If you are using v1.0 tokens, configure both to properly complete the audience validation. + +server: + port: 8082 + +spring: + cloud: + azure: + active-directory: + enabled: true + tenant-id: ${your-tenant-id} +# client-id: ${your-client-id} +# app-id-uri: ${your-app-id-uri} + diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/README.md b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/README.md similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/README.md rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/README.md diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/pom.xml b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/pom.xml similarity index 65% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/pom.xml rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/pom.xml index e52e39e1a..259ba0ba7 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/pom.xml +++ b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/pom.xml @@ -4,13 +4,13 @@ 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.5.4 + com.azure.spring + azure-spring-boot-samples + 1.0.0 com.azure.spring - azure-spring-boot-sample-active-directory-webapp-resource-server + spring-cloud-azure-starter-active-directory-webapp-resource-server 1.0.0 jar @@ -18,22 +18,10 @@ Azure AD Spring Security 5 OAuth2 Integration Spring Boot Sample https://github.com/Azure/azure-sdk-for-java - - - - com.azure.spring - azure-spring-boot-bom - 3.10.0 - pom - import - - - - com.azure.spring - azure-spring-boot-starter-active-directory + spring-cloud-azure-starter-active-directory org.springframework.boot diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppAndResourceServerSampleApplication.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppAndResourceServerSampleApplication.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppAndResourceServerSampleApplication.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppAndResourceServerSampleApplication.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapi/WebApiController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapi/WebApiController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapi/WebApiController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapi/WebApiController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/AuthorityController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/AuthorityController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/AuthorityController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/AuthorityController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/CallWebApiController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/CallWebApiController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/CallWebApiController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/CallWebApiController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/ClientController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/ClientController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/ClientController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/ClientController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/OnDemandClientController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/OnDemandClientController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/OnDemandClientController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/OnDemandClientController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/RoleController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/RoleController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/RoleController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/controller/webapp/RoleController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/security/AADWebApplicationAndResourceServerConfig.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/security/AADWebApplicationAndResourceServerConfig.java similarity index 88% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/security/AADWebApplicationAndResourceServerConfig.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/security/AADWebApplicationAndResourceServerConfig.java index b9dc7328f..e6c3841a6 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/security/AADWebApplicationAndResourceServerConfig.java +++ b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/security/AADWebApplicationAndResourceServerConfig.java @@ -3,8 +3,8 @@ package com.azure.spring.sample.aad.security; -import com.azure.spring.aad.webapi.AADResourceServerWebSecurityConfigurerAdapter; -import com.azure.spring.aad.webapp.AADWebSecurityConfigurerAdapter; +import com.azure.spring.cloud.autoconfigure.aad.webapi.AADResourceServerWebSecurityConfigurerAdapter; +import com.azure.spring.cloud.autoconfigure.aad.webapp.AADWebSecurityConfigurerAdapter; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java diff --git a/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/application.yml b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/application.yml new file mode 100644 index 000000000..80e24f89f --- /dev/null +++ b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/application.yml @@ -0,0 +1,39 @@ +server: + port: 8084 + +spring: + cloud: + azure: + active-directory: + enabled: true + client-id: + client-secret: + tenant-id: + user-group: + allowed-group-names: , + allowed-group-ids: , + post-logout-redirect-uri: http://localhost:8080 + application-type: web_application_and_resource_server # This is required. + app-id-uri: api:// + authorization-clients: + arm: + authorizationGrantType: authorization_code # This is required. + on-demand: true + scopes: https://management.core.windows.net/user_impersonation + graph: + authorizationGrantType: authorization_code # This is required. + scopes: + - https://graph.microsoft.com/User.Read + - https://graph.microsoft.com/Directory.Read.All + # webapiA: # Web Application uses webapiA client to access restricted resources. + # authorizationGrantType: authorization_code + # scopes: + # - api:///Obo.WebApiA.ExampleScope + # webapiBWithObo: # Resource server uses webapiBObo client to access restricted resources. + # authorization-grant-type: on_behalf_of + # scopes: + # - api://WebApiB.ExampleScope + # webapiBWithClientCredentials: # Both Web Application or Resource Server can use webapiBWithClientCredentials client to access restricted resources. + # authorization-grant-type: client_credentials + # scopes: + # - api:///.default diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/templates/index.html b/aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/templates/index.html similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/templates/index.html rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server/src/main/resources/templates/index.html diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/README.md b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/README.md similarity index 86% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/README.md rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/README.md index 83c690709..938be42f3 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-web-application/README.md +++ b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/README.md @@ -82,31 +82,34 @@ If you want to use **webapp** to access other resource server (for example, acce ```yaml # WebapiA is an optional client, we can access obo resource servers or the other custom server. -azure: - activedirectory: - client-id: - client-secret: - tenant-id: - user-group: - allowed-group-names: , - allowed-group-ids: , # When 'all' is used, all group id can be obtained. - post-logout-redirect-uri: http://localhost:8080 - authorization-clients: - arm: - on-demand: true - scopes: https://management.core.windows.net/user_impersonation - graph: - scopes: - - https://graph.microsoft.com/User.Read - - https://graph.microsoft.com/Directory.Read.All -# webapiA: -# scopes: -# - /Obo.WebApiA.ExampleScope - -# enable-full-list is used to control whether to list all group ids, default is false - -# It's suggested the logged in user should at least belong to one of the above groups -# If not, the logged in user will not be able to access any authorization controller rest APIs +spring: + cloud: + azure: + active-directory: + enabled: true + client-id: + client-secret: + tenant-id: + user-group: + allowed-group-names: , + allowed-group-ids: , # When 'all' is used, all group id can be obtained. + post-logout-redirect-uri: http://localhost:8080 + authorization-clients: + arm: + on-demand: true + scopes: https://management.core.windows.net/user_impersonation + graph: + scopes: + - https://graph.microsoft.com/User.Read + - https://graph.microsoft.com/Directory.Read.All +# webapiA: +# scopes: +# - /Obo.WebApiA.ExampleScope + +# enable-full-list is used to control whether to list all group ids, default is false + +# It's suggested the logged in user should at least belong to one of the above groups +# If not, the logged in user will not be able to access any authorization controller rest APIs ``` ### Run with Maven @@ -129,9 +132,12 @@ mvn spring-boot:run ### If registered application is multi-tenanted, how to run this sample? In your application.yml file: ```yaml -azure: - activedirectory: - tenant-id: common +spring: + cloud: + azure: + active-directory: + enabled: true + tenant-id: common ``` --- ### Meet with `AADSTS240002: Input id_token cannot be used as 'urn:ietf:params:oauth:grant-type:jwt-bearer' grant` error. diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-add-a-platform.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-add-a-platform.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-add-a-platform.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-add-a-platform.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-add-grant-admin-consent.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-add-grant-admin-consent.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-add-grant-admin-consent.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-add-grant-admin-consent.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-add-permissions.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-add-permissions.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-add-permissions.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-add-permissions.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-create-app-secrets.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-create-app-secrets.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-create-app-secrets.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-create-app-secrets.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-permissions.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-permissions.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-permissions.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-permissions.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-portal-manage.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-portal-manage.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-portal-manage.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-portal-manage.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-register-a-web-app.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-register-a-web-app.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-register-a-web-app.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-register-a-web-app.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-request-api-permissions.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-request-api-permissions.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-request-api-permissions.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-request-api-permissions.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-secret-value.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-secret-value.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-secret-value.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-secret-value.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-select-myapis.png b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-select-myapis.png similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/docs/image-select-myapis.png rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/docs/image-select-myapis.png diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/pom.xml b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/pom.xml similarity index 67% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/pom.xml rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/pom.xml index ed6a589b6..397e2213d 100644 --- a/aad/azure-spring-boot-starter-active-directory/aad-web-application/pom.xml +++ b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/pom.xml @@ -4,13 +4,13 @@ 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.5.4 + com.azure.spring + azure-spring-boot-samples + 1.0.0 com.azure.spring - azure-spring-boot-sample-active-directory-webapp + spring-cloud-azure-starter-active-directory-webapp 1.0.0 jar @@ -18,22 +18,10 @@ Azure AD Spring Security 5 OAuth2 Integration Spring Boot Sample https://github.com/Azure/azure-sdk-for-java - - - - com.azure.spring - azure-spring-boot-bom - 3.10.0 - pom - import - - - - com.azure.spring - azure-spring-boot-starter-active-directory + spring-cloud-azure-starter-active-directory diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppSampleApplication.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppSampleApplication.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppSampleApplication.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/AzureADOAuth2WebAppSampleApplication.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/AuthorityController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/AuthorityController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/AuthorityController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/AuthorityController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/ClientController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/ClientController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/ClientController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/ClientController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/OnDemandClientController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/OnDemandClientController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/OnDemandClientController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/OnDemandClientController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/RoleController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/RoleController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/RoleController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/RoleController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/WebApiController.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/WebApiController.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/WebApiController.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/controller/WebApiController.java diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/java/com/azure/spring/sample/aad/utils/JsonMapper.java diff --git a/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/resources/application.yml b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/resources/application.yml new file mode 100644 index 000000000..45b823cb5 --- /dev/null +++ b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/resources/application.yml @@ -0,0 +1,30 @@ +# WebapiA is an optional client, we can access obo resource servers. +# We can also access a custom server according to the webapiA client. + +spring: + cloud: + azure: + active-directory: + enabled: true + client-id: + client-secret: + tenant-id: + user-group: + allowed-group-names: , + allowed-group-ids: , # When 'all' is used, all group id can be obtained. + post-logout-redirect-uri: http://localhost:8080 + authorization-clients: + arm: + on-demand: true + scopes: https://management.core.windows.net/user_impersonation + graph: + scopes: + - https://graph.microsoft.com/User.Read + - https://graph.microsoft.com/Directory.Read.All + # webapiA: # This is used to demonstrate on-behalf-of function. Refs: https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow + # scopes: + # - /Obo.WebApiA.ExampleScope + # webapiB: # This is used to demonstrate client_credentials type. Refs: https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow + # scopes: + # - api:///.default + # authorization-grant-type: client_credentials \ No newline at end of file diff --git a/aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/resources/templates/index.html b/aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/resources/templates/index.html similarity index 100% rename from aad/azure-spring-boot-starter-active-directory/aad-web-application/src/main/resources/templates/index.html rename to aad/spring-cloud-azure-starter-active-directory/aad-web-application/src/main/resources/templates/index.html diff --git a/pom.xml b/pom.xml index ddbc27c6f..f7f92884f 100644 --- a/pom.xml +++ b/pom.xml @@ -42,15 +42,14 @@ - cache/spring-cloud-azure-starter/spring-cloud-azure-sample-cache - aad/azure-spring-boot-starter-active-directory/aad-resource-server - aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter - aad/azure-spring-boot-starter-active-directory/aad-resource-server-by-filter-stateless - aad/azure-spring-boot-starter-active-directory/aad-resource-server-obo - aad/azure-spring-boot-starter-active-directory/aad-web-application - aad/azure-spring-boot-starter-active-directory/aad-web-application-and-resource-server - aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-web-application - aad/azure-spring-boot-starter-active-directory-b2c/aad-b2c-resource-server + aad/spring-cloud-azure-starter-active-directory/aad-resource-server + aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter + aad/spring-cloud-azure-starter-active-directory/aad-resource-server-by-filter-stateless + aad/spring-cloud-azure-starter-active-directory/aad-resource-server-obo + aad/spring-cloud-azure-starter-active-directory/aad-web-application + aad/spring-cloud-azure-starter-active-directory/aad-web-application-and-resource-server + aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-web-application + aad/spring-cloud-azure-starter-active-directory-b2c/aad-b2c-resource-server appconfiguration/azure-appconfiguration-conversion-sample-complete appconfiguration/azure-appconfiguration-conversion-sample-initial appconfiguration/azure-appconfiguration-sample