Skip to content

Commit 29b09c2

Browse files
author
Moary Chen
authored
Support web app and web api in the same application (Azure#22674)
1 parent 8cdf9d8 commit 29b09c2

File tree

65 files changed

+2316
-1091
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2316
-1091
lines changed

sdk/spring/azure-spring-boot-starter-active-directory-b2c/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ This scenario is based on **Accessing a web application** scenario to allow appl
249249
1. Write your `Webapp` Java code.
250250

251251
Controller code can refer to the following:
252-
<!-- embedme ..azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/WebappAccessResourceController.java#L25-L43 -->
252+
<!-- embedme ../azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/WebappAccessResourceController.java#L25-L43 -->
253253
```java
254254
/**
255255
* Access to protected data from Webapp to WebApiA through client credential flow. The access token is obtained by webclient, or
@@ -273,7 +273,7 @@ This scenario is based on **Accessing a web application** scenario to allow appl
273273
```
274274

275275
Security configuration code is the same with **Accessing a web application** scenario, another bean `webClient`is added as follows:
276-
<!-- embedme ..azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/WebappAccessResourceConfiguration.java#33-L40 -->
276+
<!-- embedme ../azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/WebappAccessResourceConfiguration.java#33-L40 -->
277277
```java
278278
@Bean
279279
public WebClient webClient(OAuth2AuthorizedClientManager oAuth2AuthorizedClientManager) {
@@ -328,7 +328,7 @@ This scenario not support login. Just protect the server by validating the acces
328328
1. Write your Java code.
329329

330330
Controller code can refer to the following:
331-
<!-- embedme ..azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/ResourceServerController.java#L25-L34 -->
331+
<!-- embedme ../azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/ResourceServerController.java#L25-L34 -->
332332
```java
333333
/**
334334
* webApiA resource api for web app
@@ -343,7 +343,7 @@ This scenario not support login. Just protect the server by validating the acces
343343
```
344344

345345
Security configuration code can refer to the following:
346-
<!-- embedme ..azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/ResourceServerConfiguration.java#L11-L22 -->
346+
<!-- embedme ../azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/ResourceServerConfiguration.java#L11-L22 -->
347347
```java
348348
@EnableWebSecurity
349349
@EnableGlobalMethodSecurity(prePostEnabled = true)
@@ -416,7 +416,7 @@ This scenario is an upgrade of **Accessing a resource server**, supports access
416416
1. Write your Java code.
417417

418418
WebApiA controller code can refer to the following:
419-
<!-- embedme ..azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/ResourceServerController.java#L47-L66 -->
419+
<!-- embedme ../azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/ResourceServerController.java#L47-L66 -->
420420
```java
421421
/**
422422
* Access to protected data from WebApiA to WebApiB through client credential flow. The access token is obtained by webclient, or
@@ -441,7 +441,7 @@ This scenario is an upgrade of **Accessing a resource server**, supports access
441441
```
442442

443443
WebApiB controller code can refer to the following:
444-
<!-- embedme ..azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/ResourceServerController.java#L36-L45 -->
444+
<!-- embedme ../azure-spring-boot/src/samples/java/com/azure/spring/autoconfigure/b2c/ResourceServerController.java#L36-L45 -->
445445
```java
446446
/**
447447
* webApiB resource api for other web application

sdk/spring/azure-spring-boot-starter-active-directory/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
11
# Release History
22

33
## 3.7.0-beta.1 (Unreleased)
4+
### New Features
5+
- Add property `azure.activedirectory.application-type` to configure the application type.
6+
7+
Here are the 4 valid values:
8+
- *web_application*: Web Application.
9+
- *resource_server*: Resource Server.
10+
- *resource_server_with_obo*: Resource Server with authorization grant type `on_behalf_of`.
11+
- *web_application_and_resource_server*: Web Application and Resource Server in one application, it also supports `on_behalf_of`.
12+
13+
This property is optional, its value can be inferred by dependencies, only `web_application_and_resource_server` must be configured manually: `azure.activedirectory.application-type=web_application_and_resource_server`.
14+
15+
Here is the table about how the AAD starter infers application type by dependencies:
16+
17+
| Has dependency: spring-security-oauth2-client | Has dependency: spring-security-oauth2-resource-server | Valid values of application type | Default value |
18+
|-----------------------------------------------|--------------------------------------------------------|-------------------------------------------------------------------|-----------------------------|
19+
| Yes | No | `web_application` | `web_application` |
20+
| No | Yes | `resource_server` | `resource_server` |
21+
| Yes | Yes | `resource_server_with_obo`, `web_application_and_resource_server` | `resource_server_with_obo` |
22+
23+
- Support new value `on_behalf_of` for OBO authorization grant type, originally we only support `on-behalf-of`.
24+
425

526
## 3.6.1 (2021-07-02)
627
### New Features
728
- Upgrade to [spring-boot-dependencies:2.5.2](https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.5.2/spring-boot-dependencies-2.5.2.pom).
829
- Upgrade to [spring-cloud-dependencies:2020.0.3](https://repo.maven.apache.org/maven2/org/springframework/cloud/spring-cloud-dependencies/2020.0.3/spring-cloud-dependencies-2020.0.3.pom).
30+
931
### Key Bug Fixes
1032
- Fix [cve-2021-22119](https://tanzu.vmware.com/security/cve-2021-22119).
1133

0 commit comments

Comments
 (0)