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
Branches
Tags
No related merge requests found
......@@ -5,7 +5,7 @@ import lombok.Getter;
@Getter
@Builder
public class FrontendEnvironment {
public class Environment {
private boolean production;
private String remoteHost;
private String authServer;
......
......@@ -9,20 +9,20 @@ import org.springframework.web.bind.annotation.RestController;
import de.ozgcloud.admin.RootController;
import lombok.RequiredArgsConstructor;
@RestController
@RestController("ozgCloudEnvironmentController")
@RequiredArgsConstructor
@RequestMapping(FrontendEnvironmentController.PATH)
public class FrontendEnvironmentController {
@RequestMapping(EnvironmentController.PATH)
public class EnvironmentController {
static final String PATH = "/api/frontendEnvironment"; // NOSONAR
static final String PATH = "/api/environment"; // NOSONAR
private final ProductionProperties environmentProperties;
private final OAuth2Properties oAuthProperties;
@GetMapping
public FrontendEnvironment getEnvironment() {
return FrontendEnvironment.builder()
public Environment getEnvironment() {
return Environment.builder()
.production(environmentProperties.isProduction())
.remoteHost(linkTo(RootController.class).toUri().toString())
.authServer(oAuthProperties.getAuthServerUrl())
......
......@@ -53,7 +53,7 @@ public class SecurityConfiguration {
http.exceptionHandling(eh -> eh.authenticationEntryPoint(authenticationEntryPoint));
http.authorizeHttpRequests(requests -> requests
.requestMatchers(HttpMethod.GET, "/api/frontendEnvironment").permitAll()
.requestMatchers(HttpMethod.GET, "/api/environment").permitAll()
.requestMatchers("/api").authenticated()
.requestMatchers("/api/**").authenticated()
.requestMatchers("/actuator").permitAll()
......
......@@ -22,11 +22,11 @@ import de.ozgcloud.admin.RootController;
import lombok.SneakyThrows;
@ExtendWith(MockitoExtension.class)
class FrontendEnvironmentControllerTest {
class EnvironmentControllerTest {
@Spy
@InjectMocks
private FrontendEnvironmentController controller;
private EnvironmentController controller;
@Mock
private ProductionProperties environmentProperties;
......@@ -120,7 +120,7 @@ class FrontendEnvironmentControllerTest {
@SneakyThrows
private ResultActions doRequest() {
return mockMvc.perform(get(FrontendEnvironmentController.PATH));
return mockMvc.perform(get(EnvironmentController.PATH));
}
}
......
......@@ -67,7 +67,7 @@ class SecurityConfigurationITCase {
@SneakyThrows
@ParameterizedTest
@ValueSource(strings = {
"/api/frontendEnvironment",
"/api/environment",
"/configserver/name/profile"
})
void shouldAllow(String path) {
......@@ -145,7 +145,7 @@ class SecurityConfigurationITCase {
@SneakyThrows
@ParameterizedTest
@ValueSource(strings = {
"/api/frontendEnvironment",
"/api/environment",
"/configserver/name/profile",
"/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