diff --git a/pom.xml b/pom.xml
index 713de99a..ad01e409 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,10 +116,6 @@
jjwt-jackson
0.11.5
-
- org.springframework.boot
- spring-boot-starter-web
-
jakarta.validation
jakarta.validation-api
@@ -139,6 +135,37 @@
problem-spring-web
0.23.0
+
+
+
+ org.springframework.security
+ spring-security-saml2-service-provider
+
+
+
+
+ org.opensaml
+ opensaml-core
+ 4.0.1
+
+
+
+
+
+ org.opensaml
+ opensaml-saml-api
+ 4.0.1
+
+
+
+
+
+ org.opensaml
+ opensaml-saml-impl
+ 4.0.1
+
+
+
@@ -152,7 +179,6 @@
org.liquibase
liquibase-maven-plugin
- 4.20.0
src/main/resources/application.properties
diff --git a/src/main/java/net/gepafin/tendermanagement/web/rest/api/SamlApi.java b/src/main/java/net/gepafin/tendermanagement/web/rest/api/SamlApi.java
new file mode 100644
index 00000000..54ac52dd
--- /dev/null
+++ b/src/main/java/net/gepafin/tendermanagement/web/rest/api/SamlApi.java
@@ -0,0 +1,30 @@
+package net.gepafin.tendermanagement.web.rest.api;
+
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.ExampleObject;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
+
+public interface SamlApi {
+
+
+ @Operation(summary = "Api to get SP metadata",
+ responses = {
+ @ApiResponse(responseCode = "200", description = "OK"),
+ @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
+ @ExampleObject(value = ErrorConstants.NOTFOUND_ERROR_EXAMPLE) })),
+ @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
+ @ExampleObject(value = ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE) })),
+ @ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
+ @ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
+ @GetMapping(value = "/gw/metadata",
+ produces = { "application/json" })
+ ResponseEntity getMetadata(HttpServletRequest request);
+
+}
diff --git a/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/SamlApiController.java b/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/SamlApiController.java
new file mode 100644
index 00000000..b9a35be8
--- /dev/null
+++ b/src/main/java/net/gepafin/tendermanagement/web/rest/api/impl/SamlApiController.java
@@ -0,0 +1,33 @@
+package net.gepafin.tendermanagement.web.rest.api.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.saml2.provider.service.metadata.OpenSamlMetadataResolver;
+import org.springframework.security.saml2.provider.service.metadata.Saml2MetadataResolver;
+import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration;
+import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrationRepository;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import jakarta.servlet.http.HttpServletRequest;
+import net.gepafin.tendermanagement.web.rest.api.SamlApi;
+
+@RestController
+@RequestMapping("${openapi.gepafin.base-path:/v1/saml}")
+public class SamlApiController implements SamlApi{
+
+ @Autowired
+ private RelyingPartyRegistrationRepository relyingPartyRegistrationRepository;
+
+ @Override
+ public ResponseEntity getMetadata(HttpServletRequest request) {
+ Saml2MetadataResolver metadataResolver = new OpenSamlMetadataResolver();
+ RelyingPartyRegistration registration = relyingPartyRegistrationRepository.findByRegistrationId("loginumbria");
+ return ResponseEntity.status(HttpStatus.OK).header("Content-Type", MediaType.APPLICATION_XML_VALUE)
+ .body(metadataResolver.resolve(registration));
+
+ }
+
+}
diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties
index 72135766..c160287a 100644
--- a/src/main/resources/application-dev.properties
+++ b/src/main/resources/application-dev.properties
@@ -5,4 +5,5 @@ spring.datasource.password=vs1pAc9vu07mMcdx93j6WiBS
spring.datasource.driver-class-name=org.postgresql.Driver
# JPA Configuration
-spring.h2.console.enabled=true
\ No newline at end of file
+spring.h2.console.enabled=true
+base-url=https://api-dev-gepafin.memento.credit
\ No newline at end of file
diff --git a/src/main/resources/application-local.properties b/src/main/resources/application-local.properties
index 7ed5944b..6b925e03 100644
--- a/src/main/resources/application-local.properties
+++ b/src/main/resources/application-local.properties
@@ -5,4 +5,5 @@ spring.datasource.password=root
spring.datasource.driver-class-name=org.postgresql.Driver
# JPA Configuration
-spring.jpa.show-sql=true
\ No newline at end of file
+spring.jpa.show-sql=true
+base-url=http://localhost:8080
\ No newline at end of file
diff --git a/src/main/resources/application-testing.properties b/src/main/resources/application-testing.properties
index ea3a5732..12b95acb 100644
--- a/src/main/resources/application-testing.properties
+++ b/src/main/resources/application-testing.properties
@@ -4,4 +4,5 @@ spring.datasource.username=sa
spring.datasource.password=sa
# JPA Configuration
-spring.h2.console.enabled=true
\ No newline at end of file
+spring.h2.console.enabled=true
+base-url=http://localhost:8080
\ No newline at end of file