diff --git a/demo/src/main/java/com/example/demo/config/SecurityConfig.java b/demo/src/main/java/com/example/demo/config/SecurityConfig.java index 3d17139..ff2067d 100644 --- a/demo/src/main/java/com/example/demo/config/SecurityConfig.java +++ b/demo/src/main/java/com/example/demo/config/SecurityConfig.java @@ -2,8 +2,10 @@ package com.example.demo.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.SecurityFilterChain; @Configuration public class SecurityConfig { @@ -11,4 +13,20 @@ public class SecurityConfig { public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } + + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + http + .authorizeHttpRequests(auth -> auth + .requestMatchers("/login", "/css/**").permitAll() + .anyRequest().authenticated() + ) + .formLogin(form -> form + .loginPage("/login") +// .defaultSuccessUrl("/", true) + .permitAll() + ) + .logout(logout -> logout.permitAll()); + return http.build(); + } } \ No newline at end of file diff --git a/demo/src/main/java/com/example/demo/controller/SiteController.java b/demo/src/main/java/com/example/demo/controller/SiteController.java new file mode 100644 index 0000000..f349c45 --- /dev/null +++ b/demo/src/main/java/com/example/demo/controller/SiteController.java @@ -0,0 +1,20 @@ +package com.example.demo.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class SiteController { + @GetMapping("/") + public String viewHomePage(Model model) { + //model.addAttribute("allemplist", employeeServiceImpl.getAllEmployee()); + return "home"; + } + + @GetMapping("/login") + public String viewLoginPage(Model model) { + return "login"; + } +} \ No newline at end of file diff --git a/demo/css/create-account.css b/demo/src/main/resources/static/css/create-account.css similarity index 100% rename from demo/css/create-account.css rename to demo/src/main/resources/static/css/create-account.css diff --git a/demo/css/home.css b/demo/src/main/resources/static/css/home.css similarity index 100% rename from demo/css/home.css rename to demo/src/main/resources/static/css/home.css diff --git a/demo/css/login.css b/demo/src/main/resources/static/css/login.css similarity index 100% rename from demo/css/login.css rename to demo/src/main/resources/static/css/login.css diff --git a/demo/images/create_icon.png b/demo/src/main/resources/static/images/create_icon.png similarity index 100% rename from demo/images/create_icon.png rename to demo/src/main/resources/static/images/create_icon.png diff --git a/demo/images/create_icon_lineless.png b/demo/src/main/resources/static/images/create_icon_lineless.png similarity index 100% rename from demo/images/create_icon_lineless.png rename to demo/src/main/resources/static/images/create_icon_lineless.png diff --git a/demo/images/decor_left.png b/demo/src/main/resources/static/images/decor_left.png similarity index 100% rename from demo/images/decor_left.png rename to demo/src/main/resources/static/images/decor_left.png diff --git a/demo/images/decor_right.png b/demo/src/main/resources/static/images/decor_right.png similarity index 100% rename from demo/images/decor_right.png rename to demo/src/main/resources/static/images/decor_right.png diff --git a/demo/images/header_left.png b/demo/src/main/resources/static/images/header_left.png similarity index 100% rename from demo/images/header_left.png rename to demo/src/main/resources/static/images/header_left.png diff --git a/demo/images/header_right.png b/demo/src/main/resources/static/images/header_right.png similarity index 100% rename from demo/images/header_right.png rename to demo/src/main/resources/static/images/header_right.png diff --git a/demo/images/logout_icon.png b/demo/src/main/resources/static/images/logout_icon.png similarity index 100% rename from demo/images/logout_icon.png rename to demo/src/main/resources/static/images/logout_icon.png diff --git a/demo/create-account.html b/demo/src/main/resources/templates/create-account.html similarity index 88% rename from demo/create-account.html rename to demo/src/main/resources/templates/create-account.html index 745d256..d1ff785 100644 --- a/demo/create-account.html +++ b/demo/src/main/resources/templates/create-account.html @@ -3,14 +3,14 @@ Create Thyme Crunch Account - +
- Violin f-hole shape to the left of header. + Violin f-hole shape to the left of header.

Thyme Crunch

- Violin f-hole shape to the right of header. + Violin f-hole shape to the right of header.
diff --git a/demo/home.html b/demo/src/main/resources/templates/home.html similarity index 75% rename from demo/home.html rename to demo/src/main/resources/templates/home.html index af96134..f4d6e65 100644 --- a/demo/home.html +++ b/demo/src/main/resources/templates/home.html @@ -3,14 +3,14 @@ Thyme Crunch Home - +
- Violin f-hole shape to the left of header. + Violin f-hole shape to the left of header.

Thyme Crunch

- Violin f-hole shape to the right of header. + Violin f-hole shape to the right of header.
@@ -24,7 +24,7 @@
  • @@ -34,7 +34,7 @@ - Description of the icon + Description of the icon diff --git a/demo/login.html b/demo/src/main/resources/templates/login.html similarity index 73% rename from demo/login.html rename to demo/src/main/resources/templates/login.html index 5968092..989ce48 100644 --- a/demo/login.html +++ b/demo/src/main/resources/templates/login.html @@ -3,7 +3,7 @@ Thyme Crunch Login - + @@ -18,9 +18,13 @@

    Log In

    - +
    + Invalid username and password.
    +
    + You have been logged out.
    + - +