Add allow path in Security Config for Swagger
This commit is contained in:
@@ -5,6 +5,8 @@ import com.api.auth.dtos.SignUpReq;
|
||||
import com.api.auth.dtos.SignUpRes;
|
||||
import com.api.jwt.dtos.RegenerateTokenDto;
|
||||
import com.api.jwt.dtos.TokenDto;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -12,22 +14,26 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "Auth", description = "인증 관련 api")
|
||||
@RestController
|
||||
@RequestMapping("/auth")
|
||||
@RequiredArgsConstructor
|
||||
public class AuthController {
|
||||
private final AuthService authService;
|
||||
|
||||
@Operation(summary = "Sign Up", description = "회원가입 메서드입니다.")
|
||||
@PostMapping("/signUp")
|
||||
public SignUpRes signUp(@Validated SignUpReq signUpReq) {
|
||||
return authService.signUp(signUpReq);
|
||||
}
|
||||
|
||||
@Operation(summary = "Sign In", description = "로그인 메서드입니다.")
|
||||
@PostMapping("/signIn")
|
||||
public ResponseEntity<TokenDto> signIn(@Validated SignInReq signInReq) {
|
||||
return authService.signIn(signInReq);
|
||||
}
|
||||
|
||||
@Operation(summary = "Regenerate Token", description = "토큰을 재발행하는 메서드입니다.")
|
||||
@PostMapping("/regenerateToken")
|
||||
public ResponseEntity<TokenDto> regenerateToken(@Validated RegenerateTokenDto refreshTokenDto) {
|
||||
return authService.regenerateToken(refreshTokenDto);
|
||||
|
||||
@@ -51,6 +51,7 @@ public class SecurityConfig {
|
||||
"/user/profile/view/**",
|
||||
"/auth/regenerateToken",
|
||||
"/swagger-ui*/**",
|
||||
"/v3/api-docs/**",
|
||||
"/favicon.ico"
|
||||
).permitAll()
|
||||
.anyRequest().authenticated();
|
||||
|
||||
@@ -9,13 +9,13 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class SwaggerConfig {
|
||||
@Bean
|
||||
public GroupedOpenApi jwtApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("jwt-api-v1")
|
||||
.pathsToMatch("/**")
|
||||
.build();
|
||||
}
|
||||
// @Bean
|
||||
// public GroupedOpenApi jwtApi() {
|
||||
// return GroupedOpenApi.builder()
|
||||
// .group("jwt-api")
|
||||
// .pathsToMatch("/**")
|
||||
// .build();
|
||||
// }
|
||||
|
||||
@Bean
|
||||
public OpenAPI customOpenAPI() {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.api.user;
|
||||
import com.api.exception.UserNotFoundException;
|
||||
import com.api.user.domain.Users;
|
||||
import com.api.user.dtos.ProfileDto.ProfileRes;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
/**
|
||||
* User 관련 HTTP 요청 처리
|
||||
*/
|
||||
@Tag(name = "User", description = "유저 관련 api")
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
@RequiredArgsConstructor
|
||||
|
||||
Reference in New Issue
Block a user