스프링 시큐리티를 적용하고 나서 modify가 계속 /member/signin으로 리다이렉트 되는 현상이 발견되었는데, 원인을 파악해보니 인터셉터 클래스 문제였습니다. (기존 인터셉터 클래스에선 session을 기반으로 로그인 상태여부를 확인하는데, Spring Security를 사용하고 나선, session이 아닌 SecurityContext에 로그인 정보를 보관하니 서로 충돌을 일으켜 계쏙 signin으로 리다이렉트 되는거 같습니다.) 혹시 이 부분이 맞는지 확인 부탁드리며, 제가 쓴 내용이 맞다면, 강의 내용중에 이부분을 짚어주셨으면 합니다.
강의 열심히 듣고 있습니다. 다름이 아니라, DTO 관련 의구심이 들어서 질문 올립니다. 선생님께선 modifyConfirm 일때 dto의 pw 값을 encode된 값으로 변경하셔서 entity로 넣으셨는데, String encodedPW = passwordEncoder.encode(memberDTO.getPw()); memberDTO.setPw(encodedPW) findedMemberEntity.setMemPw(memberDTO.getPw()); 위의 방법대로 하면, dto값이 변경이 되어 "단순 전달 객체"를 위배할 수 있으며, 간결성과 가독성이 떨어지는게 아닌가 싶어서요 아래와 같이 리펙토링 하면 조금 더 간결하게 되지 않을까요? if (optionalMember.isPresent()) { MemberEntity findedMemberEntity = optionalMember.get(); findedMemberEntity.setMemPw(passwordEncoder.encode(memberDTO.getPw())); ~~ return MODIFY_SUCCESS; }
현재 제 build.gradle은 plugins { id 'java' id 'org.springframework.boot' version '3.5.0' id 'io.spring.dependency-management' version '1.1.7' } group = ' io.security ' version = '0.0.1-SNAPSHOT' java { toolchain { languageVersion = JavaLanguageVersion.of(17) } } repositories { mavenCentral() } dependencies { implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation ' org.springframework.security :spring-security-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } tasks.named('test') { useJUnitPlatform() } 같이 설정이 되어 있습니다. AntPathRequestMatcher, MvcRequestMatcher가 사용이 되지 않는다고 자동완성때 밑줄이 쳐져 있어서 .requestMatchers("/manager/**").hasAuthority("ROLE_MANAGER") .requestMatchers("/admin/payment").hasAuthority("ROLE_ADMIN") 이렇게 수정하였는데 맞게 수정 한 것인지 문의 드립니다.
영상 52분에서 로그인이 성공되는 반면 저는 로그인이 계속 실패나와서 무엇이 문제인지 확인하는데 데이터베이스 테이블이 두 개가 생성된 것을 확인했습니다. 기존에 있던 테이블은 USER_MEMBER 인데, Entity 객체를 만들고 나서 user_member 테이블이 생성되었고 애플리케이션 실행 후 다시 가입을 하면 user_member 데이터베이스에 저장되며 기존 기능들은 에러 없이 정상 작동이 됩니다.. 궁금한 것은 데이터베이스 테이블이 저렇게 두 개 생성된건데 제가 무엇을 잘못해서 만들어졌는지 또 이대로 사용하는데 문제는 없는지 궁금합니다.. 코드는 선생님 코드랑 다른 부분이 없습니다 ㅠ
저는 그래도 최신버전으로 테스트 하면서 비교를 해가며 학습하는게 좋겠다 싶어 학습중입니다. 현재 springboot 3.5으로 학습중이며 security는 6.3인것 같습니다. 그런데 학습 중 바뀐부분이 있는것 같아 확인 부탁 드리고 자 글을 남깁니다. 아래 내용이 맞는지 알고 싶어요..ㅠㅠ 🍜 비유로 설명: "라면 공장" 🥣 Spring Boot 3.2 (옛 구조) ** HttpSecurityConfiguration **이 먼저 출근해요 "물 끓이고, 면 넣고, 스프 넣고" 직접 다 해요 마지막에 포장(= SecurityFilterChain )도 본인이 함 즉, 한 사람이 보안 설정 전체를 다 하는 구조 🍱 Spring Boot 3.5 (새 구조) ** WebSecurityConfiguration **이라는 총괄 매니저 가 먼저 출근 이 사람이 여러 명의 담당자 ( HttpSecurity 설정)에게 일을 시켜요 그리고 포장은 SecurityFilterChain 으로 조립해서 내보냄 즉, 분업된 구조 — 공장은 커졌고, 매니저가 통제함 🔍 왜 이런 변화가 있었을까? 이유설명설정이 너무 복잡해졌음 HttpSecurityConfiguration 혼자 하다 보니 커지고 유지보수가 어려움커스터마이징이 어려웠음사용자 정의 체인 추가가 어렵고 제한적이었음다중 체인 지원 부족API별 다른 보안 적용이 힘들었음 ( /api/** , /admin/** )새 구조가 더 유연 SecurityFilterChain 을 빈으로 만들면 순서, 조건, 분리 모두 명확해짐 🧠 구조 비교 요약 항목Spring Boot 3.2 (Security 6.2)Spring Boot 3.5 (Security 6.3)먼저 실행 HttpSecurityConfigurationWebSecurityConfiguration 중심 클래스 HttpSecurityConfigurationWebSecurityConfiguration 책임 방식거의 혼자 다 함분업 (매니저 + 여러 체인)구성 방식내부적으로 HttpSecurity 설정외부에서 SecurityFilterChain 등록유연성다중 체인 어려움다중 체인, 조건부 설정 매우 쉬움 ✅ 결론 Spring Boot 3.2에서는 여전히 옛 구조(약간의 WebSecurityConfigurerAdapter 잔재)를 끌어와서 → HttpSecurityConfiguration 이 보안 설정의 진입점 역할을 했고, Spring Boot 3.5에서는 완전 리팩토링된 구조라서 → WebSecurityConfiguration 이 보안 설정의 시작점(매니저) 이 되었어요.
안녕하세요 우선 좋은 강의 정말 감사합니다. 풀스텍 강의라서 더 좋은거 같은데, 메일로 알람을 받았는데 선생님 강의 25%할인은 언제까지인가요? 지금 유료 강의 25%해서 24000원대 할인 기간이 안나와 있어서 기간이 궁금합니다. 아직 들어보지 못해서 무료 강의 한번 들어보고 유료강의도 진행하고 싶어서요 그리고 프로그램은 이클립스만 사용하시는거 같은데, 저는 인텔리제이 사용중인데 프로그램이 달라서 인텔리제이 사용자도 괜찮을까요?
안녕하세요, 수업 내용을 보면 6:00 시간대의 수업자료를 보면 SecurityConfigurer에서 init(B Builder), configure(B builder)을 호출한다고 나와있습니다. 하지만, 실제 소스코드를 보면 아래와 같은데, 파라미터를 보면 Builder 타입이 아닌, 파라미터를 넘기지 않는 것을 확인할 수 있습니다. @Override protected final O doBuild() throws Exception { synchronized (this.configurers) { this.buildState = BuildState.INITIALIZING; beforeInit(); init(); this.buildState = BuildState.CONFIGURING; beforeConfigure(); configure(); this.buildState = BuildState.BUILDING; O result = performBuild(); this.buildState = BuildState.BUILT; return result; } } 확인 부탁드려도 될까요? 감사드립니다.
안녕하세요, 강의 너무 잘 수강하고 있습니다. 강의 수강 중 질문이 생겨서요 refresh Token을 사용하지 않는 이유가 있을까요? access 토큰 하나를 하루의 유효기간을 부여해서 사용하는 이유가 궁금합니다. jwt 버전이 0.11.5로 진행해주셨는데 0.12.x 버전도 있는 걸로 알고 있어요 버전의 올라감과 동시에 로직의 변화도 있는 거로 알고 있습니다. 요것도 0.11.x로 진행하신 이유가 궁금합니다.
socialLoginSpa1703 소스코드를 다운받고 인텔리제이로 프로젝트를 열었습니다. jdbc 설정대로 mysql을 생성하였고 bootRun으로 실행시키면 프로젝트는 실행됩니다. 강의와같이 localhost:8080 이 접속이 안되고 localhost 에 대한 액세스가 거부됨 이 페이지를 볼 수 있는 권한이 없습니다. HTTP ERROR 403 가 뜹니다. 확인 부탁드려요 2025-06-07T13:23:42.478+09:00 INFO 46412 --- [ restartedMain] c.e.demo.SocialLoginSpa1703Application : Starting SocialLoginSpa1703Application using Java 17.0.15 with PID 46412 (C:\Users\HP\Desktop\�Ǽ�ȣ\Project\SocialLoginSpa1703\build\classes\java\main started by HP in C:\Users\HP\Desktop\�Ǽ�ȣ\Project\SocialLoginSpa1703) 2025-06-07T13:23:42.483+09:00 INFO 46412 --- [ restartedMain] c.e.demo.SocialLoginSpa1703Application : No active profile set, falling back to 1 default profile: "default" 2025-06-07T13:23:42.566+09:00 INFO 46412 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable 2025-06-07T13:23:42.566+09:00 INFO 46412 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG' 2025-06-07T13:23:44.141+09:00 INFO 46412 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2025-06-07T13:23:44.275+09:00 INFO 46412 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 119 ms. Found 2 JPA repository interfaces. 2025-06-07T13:23:45.451+09:00 INFO 46412 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http) 2025-06-07T13:23:45.477+09:00 INFO 46412 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2025-06-07T13:23:45.478+09:00 INFO 46412 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.39] 2025-06-07T13:23:45.585+09:00 INFO 46412 --- [ restartedMain] o.a.c.c.C.[Tomcat].[ localhost ].[/] : Initializing Spring embedded WebApplicationContext 2025-06-07T13:23:45.587+09:00 INFO 46412 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3018 ms 2025-06-07T13:23:45.876+09:00 INFO 46412 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2025-06-07T13:23:46.037+09:00 INFO 46412 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.5.3.Final 2025-06-07T13:23:46.427+09:00 INFO 46412 --- [ restartedMain] o.h.c.internal.RegionFactoryInitiator : HHH000026: Second-level cache disabled 2025-06-07T13:23:47.214+09:00 INFO 46412 --- [ restartedMain] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer 2025-06-07T13:23:47.301+09:00 INFO 46412 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2025-06-07T13:23:47.595+09:00 INFO 46412 --- [ restartedMain] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@3419a5dd 2025-06-07T13:23:47.600+09:00 INFO 46412 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2025-06-07T13:23:49.656+09:00 INFO 46412 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration) 2025-06-07T13:23:49.824+09:00 INFO 46412 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2025-06-07T13:23:50.469+09:00 INFO 46412 --- [ restartedMain] o.s.d.j.r.query.QueryEnhancerFactory : Hibernate is in classpath; If applicable, HQL parser will be used. 2025-06-07T13:23:51.243+09:00 WARN 46412 --- [ restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open -in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open -in-view to disable this warning 2025-06-07T13:23:52.357+09:00 INFO 46412 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2025-06-07T13:23:52.418+09:00 INFO 46412 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/' 2025-06-07T13:23:52.428+09:00 INFO 46412 --- [ restartedMain] c.e.demo.SocialLoginSpa1703Application : Started SocialLoginSpa1703Application in 10.793 seconds (process running for 11.915) 2025-06-07T13:24:32.032+09:00 INFO 46412 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[ localhost ].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2025-06-07T13:24:32.032+09:00 INFO 46412 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2025-06-07T13:24:32.035+09:00 INFO 46412 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms 2025-06-07T13:24:32.090+09:00 INFO 46412 --- [nio-8080-exec-2] c.e.d.security .JwtAuthenticationFilter : doFilterInternal
당연히 구글링 해보셨져? 원하는 결과를 못찾으셨나요? 어떤 검색어를 입력했는지 알려주세 문제가 발생한 코드(프로젝트)를 Github에 올리시고 링크를 알려주세요. 안녕하세요 호돌맨님. 덕분에 강의 잘 듣고있습니다. 깃헙 collaboator로 초대받을 수 있을까요? 깃헙 아이디는 dudfo6425@gmail.com 입니다! 감사합니다.
안녕하세요. 먼저 강의 제작해주셔서 감사합니다! 많은 도움 되고 있습니다. 메타 주석 부분에 사실 expression이 없어서 제가 이해하기로는 타입 추론으로 값을 넣는 것 같습니다. 그럼 결국 @AuthenticationPrincipal에서도 expression이 없어도 동작하는게 맞을까요? 감사합니다.