Skip to content

Commit

Permalink
비회원 전용 api들은 Spring security에 포함 되지 않도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ss7622 committed Jun 28, 2024
1 parent 6230ef9 commit 4d08e00
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.example.fiurinee.domain.flower.entity.Flower;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
Expand All @@ -12,7 +13,7 @@
public interface FlowerRepository extends JpaRepository<Flower, Long> {

@Query("SELECT f FROM Flower f WHERE f.period BETWEEN :startPeriod AND :endPeriod")
List<Flower> findByPeriodMonth(Long startPeriod, Long endPeriod);
List<Flower> findByPeriodMonth(@Param("startPeriod") Long startPeriod, @Param("endPeriod") Long endPeriod);

Optional<Flower> findByNameAndFlowerLanguage(String name,String flowerLanguage);
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@ public ResponseEntity<List<ResponseMentDto>> inputMent(@Parameter(description =
description = "비회원의 멘트 입력",
security = @SecurityRequirement(name = "bearerAuth")
)
@Parameter(
in = ParameterIn.HEADER,
name = "Authorization", required = true,
schema = @Schema(type = "string"),
description = "Bearer [Access 토큰]"
)
@ApiResponse(responseCode = "200", description = "꽃 추천 성공")
@ApiResponse(responseCode = "401", description = "인증 실패")
@PostMapping("/ment")
public ResponseEntity<List<ResponseMentDto>> inputMentNotMember(@Parameter(description = "입력한 멘트") @RequestBody String ment);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
authorizationManagerRequestMatcherRegistry
.requestMatchers("/oauth2/login", "/login/oauth2/code/**", "/oauth2/authorization/**","/login/oauth2/code/google","/member/*/refresh","/model/test",
"/swagger-ui/index.html", "/swagger-ui/**", "/v3/api-docs/**","/swagger-resources/**", "/v3/api-docs").permitAll()
//비회원 전용 api
.requestMatchers("/main/today","/main/season","model/ment").permitAll()
.anyRequest().authenticated());

http.addFilterBefore(jwtVerifyFilter(), UsernamePasswordAuthenticationFilter.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
public class JwtVerifyFilter extends OncePerRequestFilter {
// 소셜 로그인 관련 URI 추가
private static final String[] whitelist = {"/signUp", "/login", "/refresh", "/", "/index.html", "/oauth2/login", "/login/oauth2/code/*", "/oauth2/authorization/kakao","/member/*/refresh","/model/test",
"/swagger-ui/index.html", "/swagger-ui/**", "/v3/api-docs/**", "/swagger-resources/**", "/v3/api-docs"};
//Swagger
"/swagger-ui/index.html", "/swagger-ui/**", "/v3/api-docs/**", "/swagger-resources/**", "/v3/api-docs",
//비회원 전용 api
"/main/today","/main/season","model/ment"};
private final RedisUtil redisUtil;


Expand Down

0 comments on commit 4d08e00

Please sign in to comment.