#24 simple sns: 시큐리티 설정 변경
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user