Commit 114b02a7 authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

11: Reorganize and refactor core

Task-Url: #11
parent 781bff81
Pipeline #17795 passed with stage
in 1 minute and 55 seconds
...@@ -5,6 +5,7 @@ import org.springframework.http.MediaType; ...@@ -5,6 +5,7 @@ import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import eu.dariah.de.dariahsp.error.NotFoundException; import eu.dariah.de.dariahsp.error.NotFoundException;
...@@ -12,10 +13,11 @@ import eu.dariah.de.dariahsp.error.SAML2MetadataNotFoundException; ...@@ -12,10 +13,11 @@ import eu.dariah.de.dariahsp.error.SAML2MetadataNotFoundException;
import eu.dariah.de.dariahsp.helpers.SAMLMetadataHelper; import eu.dariah.de.dariahsp.helpers.SAMLMetadataHelper;
@Controller @Controller
@RequestMapping("/saml/metadata")
public class SAMLMetadataController { public class SAMLMetadataController {
@Autowired private SAMLMetadataHelper metadataHelper; @Autowired private SAMLMetadataHelper metadataHelper;
@GetMapping(value = {"/saml/metadata", "/saml/metadata/{action}"}, produces = MediaType.APPLICATION_XML_VALUE) @GetMapping(value = {"", "/", "/{action}"}, produces = MediaType.APPLICATION_XML_VALUE)
public @ResponseBody String getMetadata(@PathVariable(required=false) String action) { public @ResponseBody String getMetadata(@PathVariable(required=false) String action) {
if (action!=null && !action.isEmpty() && !action.equals("generate") && !action.equals("filesystem")) { if (action!=null && !action.isEmpty() && !action.equals("generate") && !action.equals("filesystem")) {
throw new NotFoundException(); throw new NotFoundException();
......
...@@ -3,9 +3,11 @@ package eu.dariah.de.dariahsp.sample; ...@@ -3,9 +3,11 @@ package eu.dariah.de.dariahsp.sample;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan; import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication @SpringBootApplication
@ConfigurationPropertiesScan @ConfigurationPropertiesScan
@ComponentScan({"eu.dariah.de.dariahsp.sample", "eu.dariah.de.dariahsp.web.controller"})
public class SampleApplication { public class SampleApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -18,10 +18,9 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -18,10 +18,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
import eu.dariah.de.dariahsp.config.SecurityConfig; import eu.dariah.de.dariahsp.config.SecurityConfig;
import eu.dariah.de.dariahsp.error.AuthenticatorNotAvailable; import eu.dariah.de.dariahsp.error.AuthenticatorNotAvailable;
import eu.dariah.de.dariahsp.web.AuthInfoHelper; import eu.dariah.de.dariahsp.web.AuthInfoHelper;
import eu.dariah.de.dariahsp.web.controller.SAMLMetadataController;
@Controller @Controller
public class SampleController extends SAMLMetadataController { public class SampleController {
private static String INDEX_PAGE = "index"; private static String INDEX_PAGE = "index";
@Autowired private SecurityConfig securityConfig; @Autowired private SecurityConfig securityConfig;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment