Skip to content
Snippets Groups Projects
Commit 1a0b8ffb authored by Lukas Malte Monnerjahn's avatar Lukas Malte Monnerjahn
Browse files

Merge pull request 'OZG-4717 OZG-5110 Rename des /api/environment Endpoints'...

Merge pull request 'OZG-4717 OZG-5110 Rename des /api/environment Endpoints' (#25) from OZG-4717-OZG-5110-environment-controller-anpassen into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-app/administration/pulls/25
parents 93d997af 2951610b
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ import lombok.Getter; ...@@ -5,7 +5,7 @@ import lombok.Getter;
@Getter @Getter
@Builder @Builder
public class FrontendEnvironment { public class Environment {
private boolean production; private boolean production;
private String remoteHost; private String remoteHost;
private String authServer; private String authServer;
......
...@@ -9,20 +9,20 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -9,20 +9,20 @@ import org.springframework.web.bind.annotation.RestController;
import de.ozgcloud.admin.RootController; import de.ozgcloud.admin.RootController;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@RestController @RestController("ozgCloudEnvironmentController")
@RequiredArgsConstructor @RequiredArgsConstructor
@RequestMapping(FrontendEnvironmentController.PATH) @RequestMapping(EnvironmentController.PATH)
public class FrontendEnvironmentController { public class EnvironmentController {
static final String PATH = "/api/frontendEnvironment"; // NOSONAR static final String PATH = "/api/environment"; // NOSONAR
private final ProductionProperties environmentProperties; private final ProductionProperties environmentProperties;
private final OAuth2Properties oAuthProperties; private final OAuth2Properties oAuthProperties;
@GetMapping @GetMapping
public FrontendEnvironment getEnvironment() { public Environment getEnvironment() {
return FrontendEnvironment.builder() return Environment.builder()
.production(environmentProperties.isProduction()) .production(environmentProperties.isProduction())
.remoteHost(linkTo(RootController.class).toUri().toString()) .remoteHost(linkTo(RootController.class).toUri().toString())
.authServer(oAuthProperties.getAuthServerUrl()) .authServer(oAuthProperties.getAuthServerUrl())
......
...@@ -53,7 +53,7 @@ public class SecurityConfiguration { ...@@ -53,7 +53,7 @@ public class SecurityConfiguration {
http.exceptionHandling(eh -> eh.authenticationEntryPoint(authenticationEntryPoint)); http.exceptionHandling(eh -> eh.authenticationEntryPoint(authenticationEntryPoint));
http.authorizeHttpRequests(requests -> requests http.authorizeHttpRequests(requests -> requests
.requestMatchers(HttpMethod.GET, "/api/frontendEnvironment").permitAll() .requestMatchers(HttpMethod.GET, "/api/environment").permitAll()
.requestMatchers("/api").authenticated() .requestMatchers("/api").authenticated()
.requestMatchers("/api/**").authenticated() .requestMatchers("/api/**").authenticated()
.requestMatchers("/actuator").permitAll() .requestMatchers("/actuator").permitAll()
......
...@@ -22,11 +22,11 @@ import de.ozgcloud.admin.RootController; ...@@ -22,11 +22,11 @@ import de.ozgcloud.admin.RootController;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ExtendWith(MockitoExtension.class) @ExtendWith(MockitoExtension.class)
class FrontendEnvironmentControllerTest { class EnvironmentControllerTest {
@Spy @Spy
@InjectMocks @InjectMocks
private FrontendEnvironmentController controller; private EnvironmentController controller;
@Mock @Mock
private ProductionProperties environmentProperties; private ProductionProperties environmentProperties;
...@@ -120,7 +120,7 @@ class FrontendEnvironmentControllerTest { ...@@ -120,7 +120,7 @@ class FrontendEnvironmentControllerTest {
@SneakyThrows @SneakyThrows
private ResultActions doRequest() { private ResultActions doRequest() {
return mockMvc.perform(get(FrontendEnvironmentController.PATH)); return mockMvc.perform(get(EnvironmentController.PATH));
} }
} }
......
...@@ -67,7 +67,7 @@ class SecurityConfigurationITCase { ...@@ -67,7 +67,7 @@ class SecurityConfigurationITCase {
@SneakyThrows @SneakyThrows
@ParameterizedTest @ParameterizedTest
@ValueSource(strings = { @ValueSource(strings = {
"/api/frontendEnvironment", "/api/environment",
"/configserver/name/profile" "/configserver/name/profile"
}) })
void shouldAllow(String path) { void shouldAllow(String path) {
...@@ -145,7 +145,7 @@ class SecurityConfigurationITCase { ...@@ -145,7 +145,7 @@ class SecurityConfigurationITCase {
@SneakyThrows @SneakyThrows
@ParameterizedTest @ParameterizedTest
@ValueSource(strings = { @ValueSource(strings = {
"/api/frontendEnvironment", "/api/environment",
"/configserver/name/profile", "/configserver/name/profile",
"/api", "/api/configuration", "/api/configuration/param", "/api", "/api/configuration", "/api/configuration/param",
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment