Skip to content

Commit b31cf08

Browse files
feat(config): Allow Swagger UI access in Spring Security
1 parent 779ee7a commit b31cf08

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

securetimenotes/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@
8989
<version>4.5.0</version>
9090
</dependency>
9191
<!-- Swagger -->
92-
<!-- <dependency>
92+
<dependency>
9393
<groupId>org.springdoc</groupId>
9494
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
9595
<version>2.8.6</version>
96-
</dependency> -->
96+
</dependency>
9797
</dependencies>
9898

9999
<build>

securetimenotes/src/main/java/securetimenotes/andrefelipebarros/securetimenotes/controllers/AuthenticationController.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package securetimenotes.andrefelipebarros.securetimenotes.controllers;
22

3-
// import io.swagger.v3.oas.annotations.Operation;
4-
// import io.swagger.v3.oas.annotations.responses.ApiResponse;
3+
import io.swagger.v3.oas.annotations.Operation;
4+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
55

66

77
import org.springframework.web.bind.annotation.RequestMapping;
@@ -41,9 +41,9 @@ public class AuthenticationController {
4141
@Autowired
4242
private UserRepository repository;
4343

44-
// @Operation(
45-
// summary = "Cadastro de usuário",
46-
// description = "Realiza o cadastro do usuário com validação de email e senha.")
44+
@Operation(
45+
summary = "Cadastro de usuário",
46+
description = "Realiza o cadastro do usuário com validação de email e senha.")
4747
@PostMapping("/register")
4848
public ResponseEntity<String> postMethodRegister(@RequestBody @Valid RegisterDTO data){
4949

@@ -74,15 +74,15 @@ public ResponseEntity<String> postMethodRegister(@RequestBody @Valid RegisterDTO
7474
return ResponseEntity.ok("User registered successfully.");
7575
}
7676

77-
// @Operation(
78-
// summary = "Login de usuário",
79-
// description = "Realiza a autenticação do usuário e retorna um token JWT.",
80-
// responses = {
81-
// @ApiResponse(responseCode = "200", description = "Login bem-sucedido"),
82-
// @ApiResponse(responseCode = "400", description = "Dados inválidos"),
83-
// @ApiResponse(responseCode = "401", description = "Não autorizado")
84-
// }
85-
// )
77+
@Operation(
78+
summary = "Login de usuário",
79+
description = "Realiza a autenticação do usuário e retorna um token JWT.",
80+
responses = {
81+
@ApiResponse(responseCode = "200", description = "Login bem-sucedido"),
82+
@ApiResponse(responseCode = "400", description = "Dados inválidos"),
83+
@ApiResponse(responseCode = "401", description = "Não autorizado")
84+
}
85+
)
8686
@PostMapping("/login")
8787
public ResponseEntity<LoginResponseDTO> postMethodLogin(@RequestBody @Valid AuthenticationDTO data) {
8888
var usernamePassword = new UsernamePasswordAuthenticationToken(data.username(), data.password());

0 commit comments

Comments
 (0)