From 888c30065ddd601ad8651495cc3dfe551f4e50c1 Mon Sep 17 00:00:00 2001
From: Andrei Stoica <andrei.stoica@endava.com>
Date: Fri, 22 Jun 2018 18:11:06 +0300
Subject: [PATCH] [Authentication] Enable security when running tests. Add
 description on the Swagger page to specify what user to use when
 authentication is present

---
 .../util/ApplicationSwaggerConfig.java        |  2 +-
 src/test/resources/application.properties     | 37 +++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)
 create mode 100644 src/test/resources/application.properties

diff --git a/src/main/java/org/springframework/samples/petclinic/util/ApplicationSwaggerConfig.java b/src/main/java/org/springframework/samples/petclinic/util/ApplicationSwaggerConfig.java
index 8cd016a9..0cc4ba68 100644
--- a/src/main/java/org/springframework/samples/petclinic/util/ApplicationSwaggerConfig.java
+++ b/src/main/java/org/springframework/samples/petclinic/util/ApplicationSwaggerConfig.java
@@ -54,7 +54,7 @@ public class ApplicationSwaggerConfig {
    private ApiInfo getApiInfo() {
 	   return new ApiInfo(
 		"REST Petclinic backend Api Documentation",
-		"This is REST API documentation of the Spring Petclinic backend",
+		"This is REST API documentation of the Spring Petclinic backend. If authentication is enabled, when calling the APIs use admin/admin",
 		"1.0",
 		"Petclinic backend terms of service",
 		new Contact(
diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties
new file mode 100644
index 00000000..59e2ae41
--- /dev/null
+++ b/src/test/resources/application.properties
@@ -0,0 +1,37 @@
+# active profiles config
+#
+# application use two active profiles
+#
+# one for select repository layer
+# ------------------------------------------------
+# When using HSQL, use: hsqldb
+# When using MySQL, use: mysql
+# When using PostgeSQL, use: postgresql
+# ------------------------------------------------
+#
+# one - for select database
+# ------------------------------------------------
+# When using Spring jpa, use: jpa
+# When using Spring JDBC, use: jdbc
+# When using Spring Data JPA, use: spring-data-jpa
+# ------------------------------------------------
+
+spring.profiles.active=hsqldb,spring-data-jpa
+
+# ------------------------------------------------
+
+server.port=9966
+server.context-path=/petclinic/
+
+spring.messages.basename=messages/messages
+
+logging.level.org.springframework=INFO
+#logging.level.org.springframework=DEBUG
+
+#logging.level.org.hibernate.SQL=DEBUG
+#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
+
+# enable the desired authentication type
+# by default the authentication is disabled
+security.ignored=/**
+basic.authentication.enabled=true
-- 
GitLab