summaryrefslogtreecommitdiff
path: root/spring-boot/08-spring-security-simple/src/main/resources
diff options
context:
space:
mode:
Diffstat (limited to 'spring-boot/08-spring-security-simple/src/main/resources')
-rw-r--r--spring-boot/08-spring-security-simple/src/main/resources/application.properties0
-rw-r--r--spring-boot/08-spring-security-simple/src/main/resources/config/application-dev.properties10
-rw-r--r--spring-boot/08-spring-security-simple/src/main/resources/static/css/main.css92
-rw-r--r--spring-boot/08-spring-security-simple/src/main/resources/templates/contact/form.html30
-rw-r--r--spring-boot/08-spring-security-simple/src/main/resources/templates/contact/result.html14
-rw-r--r--spring-boot/08-spring-security-simple/src/main/resources/templates/index.html11
-rw-r--r--spring-boot/08-spring-security-simple/src/main/resources/templates/layout/main.html34
7 files changed, 191 insertions, 0 deletions
diff --git a/spring-boot/08-spring-security-simple/src/main/resources/application.properties b/spring-boot/08-spring-security-simple/src/main/resources/application.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/spring-boot/08-spring-security-simple/src/main/resources/application.properties
diff --git a/spring-boot/08-spring-security-simple/src/main/resources/config/application-dev.properties b/spring-boot/08-spring-security-simple/src/main/resources/config/application-dev.properties
new file mode 100644
index 0000000..f0f380b
--- /dev/null
+++ b/spring-boot/08-spring-security-simple/src/main/resources/config/application-dev.properties
@@ -0,0 +1,10 @@
+# This file contains settings used during development.
+# If using Maven to run, try the following command:
+# mvn spring-boot:run -Dspring-boot.run.profiles=dev
+
+# Disable caching for static resources
+spring.web.resources.cache.period=0
+spring.thymeleaf.cache=false
+
+# Optional: Tell DevTools to watch changes but never restart the backend server for CSS
+spring.devtools.restart.exclude=static/**,public/**,templates/**
diff --git a/spring-boot/08-spring-security-simple/src/main/resources/static/css/main.css b/spring-boot/08-spring-security-simple/src/main/resources/static/css/main.css
new file mode 100644
index 0000000..edd53ea
--- /dev/null
+++ b/spring-boot/08-spring-security-simple/src/main/resources/static/css/main.css
@@ -0,0 +1,92 @@
+body {
+ font-size: 1.125em;
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ line-height: 1.6em;
+ color: rgb(32, 34, 36);;
+ background-color: #FFF;
+ padding: 10px 5px;
+}
+
+a {
+ color: #1475AC;
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+ul li {
+ padding-bottom: 0.5em;
+}
+
+header {
+ text-align: left;
+ font-size: 1.2em;
+}
+
+header h1 {
+ margin-top: 0;
+ margin-bottom: 20px;
+}
+
+header a {
+ color: #000000;
+ text-decoration: none;
+}
+
+.main-nav {
+ margin-top: 0;
+ padding: 0;
+}
+
+.main-nav ul {
+ margin: 0;
+ padding : 0;
+ list-style-type: none;
+ background-color: #F6F8F8;
+ border: 1px solid #eee;
+}
+
+.main-nav ul li {
+ margin-left: 0;
+ display: inline;
+ padding: 0 8px;
+ border-left: 1px solid #F9F9FF;
+ border-right: 1px solid #F9F9FF;
+}
+
+.main-nav ul li:hover {
+ background-color: white;
+ border-left: 1px solid #addfff;
+ border-right: 1px solid #addfff;
+}
+
+.main-nav ul li a {
+ color: #555;
+ font-weight: bold;
+}
+
+.main-nav ul li ai:hover {
+ color: #000;
+}
+
+footer {
+ margin-top: 20px;
+ font-size: 85%;
+ border-top: 1px solid #CCC;
+}
+
+.form-field-container {
+ margin-top: 8px;
+ margin-bottom: 8px;
+}
+
+.form-field-container label {
+ display: inline-block;
+ width: 5em;
+}
+
+.form-field-container .validation-error {
+ color: red;
+} \ No newline at end of file
diff --git a/spring-boot/08-spring-security-simple/src/main/resources/templates/contact/form.html b/spring-boot/08-spring-security-simple/src/main/resources/templates/contact/form.html
new file mode 100644
index 0000000..7debe1f
--- /dev/null
+++ b/spring-boot/08-spring-security-simple/src/main/resources/templates/contact/form.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" th:replace="~{layout/main :: layout(title='Contact Us', content=~{::main})}">
+
+<body>
+ <main>
+ <form th:action="@{/contact}" th:object="${contactForm}" method="post">
+ <div class="form-field-container">
+ <label>Name</label>
+ <input type="text" th:field="*{name}" placeholder="Your name" />
+ <div class="validation-error" th:if="${#fields.hasErrors('name')}" th:errors="*{name}"></div>
+ </div>
+
+ <div class="form-field-container">
+ <label>Email</label>
+ <input type="email" th:field="*{email}" placeholder="Your email" />
+ <div class="validation-error" th:if="${#fields.hasErrors('email')}" th:errors="*{email}"></div>
+ </div>
+
+ <div class="form-field-container">
+ <label>Message</label>
+ <textarea th:field="*{message}" placeholder="Your message"></textarea>
+ <div class="validation-error" th:if="${#fields.hasErrors('message')}" th:errors="*{message}"></div>
+ </div>
+
+ <button type="submit">Send</button>
+ </form>
+ </main>
+</body>
+
+</html> \ No newline at end of file
diff --git a/spring-boot/08-spring-security-simple/src/main/resources/templates/contact/result.html b/spring-boot/08-spring-security-simple/src/main/resources/templates/contact/result.html
new file mode 100644
index 0000000..d1bda9a
--- /dev/null
+++ b/spring-boot/08-spring-security-simple/src/main/resources/templates/contact/result.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" th:replace="~{layout/main :: layout(title='Contact Us', content=~{::main})}">
+
+<body>
+ <main>
+ <p>We received your message.</p>
+
+ <p th:text="'Thank you ' + ${contactForm.name} + '.'" />
+
+ <a th:href="@{/contact}">Try again</a>
+ </main>
+</body>
+
+</html> \ No newline at end of file
diff --git a/spring-boot/08-spring-security-simple/src/main/resources/templates/index.html b/spring-boot/08-spring-security-simple/src/main/resources/templates/index.html
new file mode 100644
index 0000000..b2f59f2
--- /dev/null
+++ b/spring-boot/08-spring-security-simple/src/main/resources/templates/index.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" th:replace="~{layout/main :: layout(title='Welcome', content=~{::main})}">
+
+<body>
+ <main>
+ <p>Hello! This is the home page content.</p>
+ <p>Use the navigation links to explore other pages.</p>
+ </main>
+</body>
+
+</html> \ No newline at end of file
diff --git a/spring-boot/08-spring-security-simple/src/main/resources/templates/layout/main.html b/spring-boot/08-spring-security-simple/src/main/resources/templates/layout/main.html
new file mode 100644
index 0000000..815ff3d
--- /dev/null
+++ b/spring-boot/08-spring-security-simple/src/main/resources/templates/layout/main.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org"
+ xmlns:sec="http://thymeleaf.org/extras/spring-security"
+ th:fragment="layout(title, content)">
+
+<head>
+ <title th:text="|${title} - ABC App|">Base title not shown</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <link rel="stylesheet" th:href="@{/css/main.css}" />
+</head>
+
+<body>
+ <header>
+ <h1>ABC App</h1>
+ </header>
+
+ <nav class="main-nav">
+ <ul>
+ <li><a th:href="@{/}">Home</a></li>
+ <li><a th:href="@{/contact}">Contact Us</a></li>
+ <li><a th:href="@{/logout}" sec:authorize="isAuthenticated()">Logout</a></li>
+ </ul>
+ </nav>
+
+ <h3 th:text="|${title}|">Page content area title</h3>
+
+ <th:block th:replace="${content}" />
+
+ <footer>
+ Copyright &copy; 2026 Example Company. All rights reserved.
+ </footer>
+</body>
+
+</html> \ No newline at end of file