Skip to content

Commit 74d21c4

Browse files
committed
WIP for #143
1 parent 8fb91f8 commit 74d21c4

File tree

7 files changed

+18
-14
lines changed

7 files changed

+18
-14
lines changed

src/main/java/aa/aggregators/institution/InstitutionController.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package aa.aggregators.institution;
22

33

4+
import org.springframework.http.MediaType;
45
import org.springframework.web.bind.annotation.GetMapping;
6+
import org.springframework.web.bind.annotation.RequestMapping;
57
import org.springframework.web.bind.annotation.RestController;
68

79
import java.util.HashMap;
810
import java.util.List;
911
import java.util.Map;
1012

1113
@RestController
14+
@RequestMapping(value = {"/aa/api"})
1215
public class InstitutionController {
1316

1417
private final Map<String, List<String>> userInfo = new HashMap<>();

src/main/java/aa/control/AccountController.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
import org.slf4j.LoggerFactory;
1313
import org.springframework.beans.factory.annotation.Autowired;
1414
import org.springframework.beans.factory.annotation.Value;
15-
import org.springframework.http.HttpEntity;
16-
import org.springframework.http.HttpHeaders;
17-
import org.springframework.http.HttpMethod;
18-
import org.springframework.http.ResponseEntity;
15+
import org.springframework.http.*;
1916
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
2017
import org.springframework.util.LinkedMultiValueMap;
2118
import org.springframework.util.MultiValueMap;
@@ -32,6 +29,7 @@
3229
import java.util.Optional;
3330

3431
@RestController
32+
@RequestMapping(value = {"/aa/api"})
3533
public class AccountController {
3634

3735
private final static Logger LOG = LoggerFactory.getLogger(AccountController.class);

src/main/java/aa/control/AttributeAggregatorController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import aa.service.AttributeAggregatorService;
66
import jakarta.validation.Valid;
77
import org.springframework.beans.factory.annotation.Autowired;
8+
import org.springframework.http.MediaType;
89
import org.springframework.web.bind.annotation.PostMapping;
910
import org.springframework.web.bind.annotation.RequestBody;
1011
import org.springframework.web.bind.annotation.RequestMapping;
@@ -13,7 +14,7 @@
1314
import java.util.List;
1415

1516
@RestController
16-
@RequestMapping(headers = {"Content-Type=application/json"}, produces = {"application/json"})
17+
@RequestMapping(value = {"/aa/api"}, produces = MediaType.APPLICATION_JSON_VALUE)
1718
public class AttributeAggregatorController {
1819

1920
private final AttributeAggregatorService attributeAggregatorService;

src/main/java/aa/lifecycle/UserLifeCycleController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.slf4j.Logger;
66
import org.slf4j.LoggerFactory;
77
import org.springframework.beans.factory.annotation.Autowired;
8+
import org.springframework.http.MediaType;
89
import org.springframework.security.core.Authentication;
910
import org.springframework.transaction.annotation.Transactional;
1011
import org.springframework.util.StringUtils;
@@ -21,11 +22,12 @@
2122
import java.util.stream.Collectors;
2223

2324
@RestController
25+
@RequestMapping(value = {"/aa/api"})
2426
public class UserLifeCycleController {
2527

2628
private static final Logger LOG = LoggerFactory.getLogger(UserLifeCycleController.class);
2729

28-
private AccountRepository accountRepository;
30+
private final AccountRepository accountRepository;
2931

3032
@Autowired
3133
public UserLifeCycleController(AccountRepository accountRepository) {

src/main/java/aa/web/WebSecurityConfigurer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public SecurityFilterChain orcidFilterChain(HttpSecurity http,
6060
AuthenticationManager authenticationManager,
6161
Environment environment) throws Exception {
6262
http
63-
.securityMatcher("/redirect", "/client/**")
63+
.securityMatcher("/aa/api/redirect", "/aa/api/client/**")
6464
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED))
6565
.csrf(AbstractHttpConfigurer::disable)
6666
.addFilterBefore(new ShibbolethPreAuthenticatedProcessingFilter(authenticationManager),
@@ -80,7 +80,7 @@ public SecurityFilterChain orcidFilterChain(HttpSecurity http,
8080
@Bean
8181
public SecurityFilterChain lifeCycleFilterChain(HttpSecurity http) throws Exception {
8282
return http
83-
.securityMatcher("/deprovision/**")
83+
.securityMatcher("/aa/api/deprovision/**")
8484
.sessionManagement(session -> session
8585
.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
8686
.csrf(AbstractHttpConfigurer::disable)
@@ -100,7 +100,7 @@ public SecurityFilterChain lifeCycleFilterChain(HttpSecurity http) throws Except
100100
@Bean
101101
public SecurityFilterChain attributeAggregationFilterChain(HttpSecurity http) throws Exception {
102102
return http
103-
.securityMatcher("/internal/**")
103+
.securityMatcher("/aa/api/internal/**")
104104
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
105105
.csrf(AbstractHttpConfigurer::disable)
106106
.addFilterBefore(new BasicAuthenticationFilter(new BasicAuthenticationManager(attributeAggregationUserName, attributeAggregationPassword)),

src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
server:
22
servlet:
3-
context-path: /aa/api
3+
context-path:
44
session:
55
timeout: 28800
66
server-header:

src/test/java/aa/ApplicationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ public class ApplicationTest extends AbstractIntegrationTest {
1616

1717
@Test
1818
public void startUp() {
19-
ResponseEntity<Map> response = restTemplate.getForEntity("http://localhost:" + port + "/aa/api/internal/health", Map.class);
19+
ResponseEntity<Map> response = restTemplate.getForEntity("http://localhost:" + port + "/internal/health", Map.class);
2020
assertEquals(HttpStatus.OK, response.getStatusCode());
21-
assertEquals(response.getBody().get("status"), "UP");
21+
assertEquals("UP", response.getBody().get("status"));
2222
}
2323

2424
@Test
2525
public void testMain() {
26-
Application application = new Application();
27-
application.main(new String[]{});
26+
// Application application = new Application();
27+
Application.main(new String[]{});
2828
}
2929

3030
}

0 commit comments

Comments
 (0)