#24 simple sns: 시큐리티 설정 변경

This commit is contained in:
haerong22
2022-11-22 01:29:33 +09:00
parent f0c3ab0417
commit a8efd26a78
2 changed files with 7 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
@@ -16,12 +17,16 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
@EnableWebSecurity
@RequiredArgsConstructor
public class AuthenticationConfig extends WebSecurityConfigurerAdapter {
private final UserService userService;
@Value("${jwt.secret-key}")
private String key;
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().regexMatchers("^(?!/api/).*");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()

View File

@@ -30,7 +30,7 @@ public class JwtTokenFilter extends OncePerRequestFilter {
final String header = request.getHeader(HttpHeaders.AUTHORIZATION);
if (header == null || !header.startsWith("Bearer ")) {
log.error("Error occurs while getting header. header is null or invalid");
log.error("Error occurs while getting header. header is null or invalid ==> {}", request.getRequestURL());
filterChain.doFilter(request, response);
return;
}