Browse Source

commit

master
Cristobal Bernal Mayordomo 1 year ago
parent
commit
19fd8f108f
4 changed files with 21 additions and 11 deletions
  1. +7
    -3
      pom.xml
  2. +8
    -4
      src/main/java/com/cristobalbernal/foro/controlador/Controlador.java
  3. +1
    -1
      src/main/java/com/cristobalbernal/foro/seguridad/ConfigSeguridad.java
  4. +5
    -3
      src/main/resources/templates/menu/menu.html

+ 7
- 3
pom.xml View File

@ -39,7 +39,13 @@
<artifactId>bootstrap</artifactId>
<version>5.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.webjars.bower/jquery -->
<!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity5 -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
<version>3.0.4.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.webjars.bower/jquery -->
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>jquery</artifactId>
@ -79,8 +85,6 @@
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>


+ 8
- 4
src/main/java/com/cristobalbernal/foro/controlador/Controlador.java View File

@ -19,16 +19,20 @@ public class Controlador {
public String miPerfil(){
return "miperfil/miperfil";
}
@GetMapping("/login")
public String login(){
return "login/login";
}
@GetMapping({"","/home","/"})
public String indice(Model model){
model.addAttribute("listaRespuestas",servicioRespuestas.findAll());
return "index";
}
@GetMapping({"/springsecurity/{usuario}","/springsecurity"})
public String springsecurity(@PathVariable(name="usuario", required = false) String usuario,
Model model) throws MalformedURLException {
model.addAttribute("titulo","Panel de control security");
model.addAttribute("usuario",usuario);
return "login/login";
}
@GetMapping("/registrar")
public String registrar(){
return "Registrar/registrar";


+ 1
- 1
src/main/java/com/cristobalbernal/foro/seguridad/ConfigSeguridad.java View File

@ -22,7 +22,7 @@ public class ConfigSeguridad {
.anyRequest().authenticated()
)
.formLogin((form) -> form
.loginPage("/login")
.loginPage("/springsecurity")
.permitAll()
)
.logout(LogoutConfigurer::permitAll);


+ 5
- 3
src/main/resources/templates/menu/menu.html View File

@ -1,5 +1,5 @@
<nav th:fragment="mimenu">
<div class="top-menu-bottom932">
<nav th:fragment="mimenu" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<div class="top-menu-bottom932">
<nav class="navbar navbar-default">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
@ -13,7 +13,9 @@
<ul class="nav navbar-nav navbar-right">
<li><a href="/home">Home</a></li>
<li><a href="/crearPregunta">Ask Question</a></li>
<li><a href="/miperfil">Acceder</a></li>
<li><a href="/springsecurity">Acceder</a>
<span sec:authentication="name">Sin autenticar</span>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->


Loading…
Cancel
Save