This is an automated email from the ASF dual-hosted git repository.
mmoayyed pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 3489800 SYNCOPE-1545: Enable Swagger support for WA (#204)
3489800 is described below
commit 34898008ed897ee54cce87cd01303109cf8c209c
Author: Misagh Moayyed <[email protected]>
AuthorDate: Wed Jul 15 15:20:36 2020 +0430
SYNCOPE-1545: Enable Swagger support for WA (#204)
---
docker/wa/src/main/resources/wa.properties | 5 +++++
fit/wa-reference/src/main/resources/wa.properties | 5 +++++
pom.xml | 5 +++++
wa/starter/pom.xml | 6 +++++-
.../wa/starter/config/SyncopeWAConfiguration.java | 21 +++++++++++++++++++++
.../src/main/resources/application.properties | 2 ++
wa/starter/src/test/resources/dev/wa.properties | 5 +++++
7 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/docker/wa/src/main/resources/wa.properties
b/docker/wa/src/main/resources/wa.properties
index 051d549..1267324 100644
--- a/docker/wa/src/main/resources/wa.properties
+++ b/docker/wa/src/main/resources/wa.properties
@@ -49,3 +49,8 @@ cas.monitor.endpoints.endpoint.defaults.access=AUTHENTICATED
spring.security.user.name=${anonymousUser}
spring.security.user.password=${anonymousKey}
+
+springdoc.show-actuator=true
+springdoc.model-and-view-allowed=true
+springdoc.writer-with-default-pretty-printer=true
+springdoc.swagger-ui.displayRequestDuration=true
diff --git a/fit/wa-reference/src/main/resources/wa.properties
b/fit/wa-reference/src/main/resources/wa.properties
index 6db93ed..c00cea1 100644
--- a/fit/wa-reference/src/main/resources/wa.properties
+++ b/fit/wa-reference/src/main/resources/wa.properties
@@ -54,3 +54,8 @@ cas.monitor.endpoints.endpoint.defaults.access=AUTHENTICATED
spring.security.user.name=${anonymousUser}
spring.security.user.password=${anonymousKey}
+
+springdoc.show-actuator=true
+springdoc.model-and-view-allowed=true
+springdoc.writer-with-default-pretty-printer=true
+springdoc.swagger-ui.displayRequestDuration=true
diff --git a/pom.xml b/pom.xml
index ca5b495..59c4d21 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1664,6 +1664,11 @@ under the License.
</dependency>
<dependency>
<groupId>org.apereo.cas</groupId>
+ <artifactId>cas-server-support-swagger</artifactId>
+ <version>${cas.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apereo.cas</groupId>
<artifactId>cas-server-core-authentication-attributes</artifactId>
<version>${cas.version}</version>
</dependency>
diff --git a/wa/starter/pom.xml b/wa/starter/pom.xml
index 5f57937..bb361aa 100644
--- a/wa/starter/pom.xml
+++ b/wa/starter/pom.xml
@@ -250,7 +250,11 @@ under the License.
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-core-services-authentication</artifactId>
</dependency>
-
+ <dependency>
+ <groupId>org.apereo.cas</groupId>
+ <artifactId>cas-server-support-swagger</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
diff --git
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWAConfiguration.java
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWAConfiguration.java
index 343497b..9f09c50 100644
---
a/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWAConfiguration.java
+++
b/wa/starter/src/main/java/org/apache/syncope/wa/starter/config/SyncopeWAConfiguration.java
@@ -38,6 +38,9 @@ import org.apereo.cas.util.crypto.CipherExecutor;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.benmanes.caffeine.cache.LoadingCache;
import com.warrenstrange.googleauth.IGoogleAuthenticator;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.info.Contact;
+import io.swagger.v3.oas.models.info.Info;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.keymaster.client.api.model.NetworkService;
import org.apache.syncope.common.keymaster.client.api.startstop.KeymasterStart;
@@ -200,6 +203,19 @@ public class SyncopeWAConfiguration {
}
@Bean
+ public OpenAPI casSwaggerOpenApi() {
+ return new OpenAPI()
+ .info(new Info()
+ .title("Apache Syncope")
+ .description("Apache Syncope " + version())
+ .contact(new Contact()
+ .name("The Apache Syncope community")
+ .email("[email protected]")
+ .url("http://syncope.apache.org"))
+ .version(version()));
+ }
+
+ @Bean
@Autowired
@RefreshScope
public U2FDeviceRepository u2fDeviceRepository(final WARestClient
restClient) {
@@ -221,4 +237,9 @@ public class SyncopeWAConfiguration {
public KeymasterStop keymasterStop() {
return new KeymasterStop(NetworkService.Type.WA);
}
+
+ @Bean
+ public String version() {
+ return applicationContext.getEnvironment().getProperty("version");
+ }
}
diff --git a/wa/starter/src/main/resources/application.properties
b/wa/starter/src/main/resources/application.properties
index 99ad693..861cec2 100644
--- a/wa/starter/src/main/resources/application.properties
+++ b/wa/starter/src/main/resources/application.properties
@@ -45,3 +45,5 @@ spring.main.allow-bean-definition-overriding=true
spring.main.lazy-initialization=false
service.discovery.address=http://localhost:8080/syncope-wa/
+
+version=${syncope.version}
diff --git a/wa/starter/src/test/resources/dev/wa.properties
b/wa/starter/src/test/resources/dev/wa.properties
index e61422d..dac755a 100644
--- a/wa/starter/src/test/resources/dev/wa.properties
+++ b/wa/starter/src/test/resources/dev/wa.properties
@@ -54,3 +54,8 @@ cas.monitor.endpoints.endpoint.defaults.access=AUTHENTICATED
spring.security.user.name=${anonymousUser}
spring.security.user.password=${anonymousKey}
+
+springdoc.show-actuator=true
+springdoc.model-and-view-allowed=true
+springdoc.writer-with-default-pretty-printer=true
+springdoc.swagger-ui.displayRequestDuration=true