안녕하세요 강의 잘 수강하고 있습니다. 질문이 있어 글 남기게 되었습니다. SecurityContext 는 기본적으로 SecurityContextHolder 에 의해 관리되며, 기본적으로 ThreadLocal 변수에 저장된다고 알고 있습니다. TreadLocal 은 스레드별로 독립적으로 생성되는 변수라고 알고 있는데, 그러면 invalidateHttpSession 메서드는 서버의 세션을 무효화하는 기능이고, clearAuthentication 메서드는 현재 스레드의 SecurityContext 에서 Authenitcation 을 삭제하는거라고 이해하면 될까요?
항상 퀄리티 높은 강의 감사합니다! 몇가지 궁금한게 있어서 질문드립니다. @Service어노테이션으로 인해 이미 빈으로 등록되어서 .userDetailsService(userDetailsService) 을 쓰지 않아도 자동으로 등록이 되는걸로 알고있었는데 코드를 쓰는 이유가 있나요? 왜 @Service 이름을 " userDetailsService" 로 하신건지 궁금합니다. SecurityConfig 에서 private final UserDetailsService userDetailsService; 에서 FormUserDetailsService 대신 UserDetailsService 을 쓰는 이유가 뭔지 궁금합니다. (그냥 클래스를 그대로 쓰면 안되는건가요?)
안녕하세요, 좋은 강의 제공해주셔서 감사합니다. FilterChainProxy 타입의 빈을 등록했는데 왜 CompositeFilterChainProxy 타입의 빈이 나오는 궁금합니다. 2. FilterChainProxy 도 여러 개가 존재할 수 있는 걸로 알고, SecurityFilterChain 도 여러 개 존재할 수 있는 것을 배웠습니다. 요청에 따라 FilterChainProxy 와 SecurityFilterChain 을 선택하는 부분에 대한 설명이 없는 것 같은데 맞나요? 이것까지 이해하는건 어렵긴 합니다..
rememberMe 의 흐름상 자동 로그인을 하는 것으로 보이는데 강의 들으면서 나름 커스텀하여 로그인 창이 뜰때 아이디만 저장하기 기능을 추가하고 싶은데 어떻게 해야할까요? 1. 로그인창 a. 처음에는 세션, 쿠키도 없으니 빈칸 로그인 성공이후 로그인 정보의 아이디값을 쿠키 에 넣는다. 로그아웃이후 쿠키가 남아있으면 아이디 란에 아이디를 넣는다. 를 하고 싶어용
동시 세션 제어에서, invalidSessionUrl 경로를 지정하고 expiredUrl 경로를 지정하지 않았을 때 'This session has been expired' 메시지가 나오는데, 한 번 더 새로고침을 하면 정상적으로 invalidSessionUrl 경로로 가네요. ?continue 경로로 302 응답 후 invalidSessionUrl 200 응답으로 되네요. 제 생각에는 버그가 아닐까 싶긴 합니다.
안녕하세요 강사님, 실정강의 중에 궁금한 사항이 있어 질문드립니다. FromLogin방식에서는 CustomFilter를 따로 생성하지 않고 Ajax 비동기 로그인 방식에서만 CustumFilter를 생성하여 http.addFilter 로 필터를 추가하신 내용을 수강중입니다. 궁금산사항은 FormLogin 방식에서는 왜 필터를 추가를 안하고 비동기 통신 로그인 일때만 필터를 추가하는지 그 이유가 궁금하여 질문드립니다.
안녕하세요 현재 강의 초반부 수강중인 수강생입니다. 혹시 실전프로젝트 자료에 포함된 내용중에 JWT를 사용하여 인증을 하는 예제도 제공이될까요? 아니면 JWT에 대한 예제는 없는걸까요? github에서 제가 못찾는건지 궁금하여 질문드립니다. 사내 업무에서 전통적인 세션기반인증이 아닌 JWT를 사용한 인증을 사용하려다보니 해당내용이 강의자료에는 없는것 같아 질문드립니다. 강의를 전부 수강하지 못하고 질문드리는 점 양해부탁드립니다.
안녕하세요~ 저는 실무에서 다양한 케이스의 HR 정보를 다루고 있는데요, 예로, 사업소득자 원천세 처리를 위하여 주민등록번호를 취급하며, 이 경우 관련 근거를 기재하여 이용 사실을 고지하고 있습니다만, 이처럼 < 법률에 특별한 규정이 있거나 법령상 의무를 준수하기 위하여 불가피한 경우> 에 해당하여 관련 근거를 찾아 명기해야 하는 경우가 너무 어렵습니다. 개인정보 관련 사이트나 시행령에서도 케이스에 맞는 근거가 없더라구요. 다양한 케이스가 있는 비즈니스 환경에서 < 법률에 특별한 규정이 있거나 법령상 의무를 준수하기 위하여 불가피한 경우> 근거를 명확하게 찾는 노하우가 있는지 문의드립니다.
안녕하세요. 강사님 강의 듣고 WebFlux 방식에서도 프로그래밍 방식 또는 동적방식으로 권한을 적용해 보고자 이것저것 해보고 있는데요. WebFlux 방식에서는 DelegatingReactiveAuthorizationManager 클래스에서 private final List<ServerWebExchangeMatcherEntry<ReactiveAuthorizationManager<AuthorizationContext>>> mappings; 이 형식으로 mappings를 생성자로 넘겨주거나 생성될때 build add() 메서드로 한건식 넘겨주면 List 형식에 추가되어 요청이 들어오면 아래의 check메서드에서 해당 요청을 체크하는 것 같습니다. @Override public Mono<AuthorizationDecision> check(Mono<Authentication> authentication, ServerWebExchange exchange) { return Flux.fromIterable(this.mappings) .concatMap((mapping) -> mapping.getMatcher() .matches(exchange) .filter(MatchResult::isMatch) .map(MatchResult::getVariables) .flatMap((variables) -> { logger.debug(LogMessage.of(() -> "Checking authorization on '" + exchange.getRequest().getPath().pathWithinApplication() + "' using " + mapping.getEntry())); return mapping.getEntry().check(authentication, new AuthorizationContext(exchange, variables)); })) .next() .defaultIfEmpty(new AuthorizationDecision(false)); } 문제는 mappings 정보를 어떻게 만들어서 넘겨야 할지 감이 안옵니다. .pathMatchers(HttpMethod.GET, "/routes").permitAll() .pathMatchers(HttpMethod.POST, "/auth-server/**").permitAll() .pathMatchers(HttpMethod.POST,"/auth-service/auth/token").permitAll() .pathMatchers(HttpMethod.GET,"/auth-service/api/v1/users").hasRole("ROLE_USER") 이 4개의 pathMatchers를 아래의 형식으로 해서 List로 넘겨야 할듯 한데 어떻게 할 수 있을까요? ServerWebExchangeMatcherEntry<ReactiveAuthorizationManager<AuthorizationContext>>> new ServerWebExchangeMatcherEntry<ReactiveAuthorizationManager<AuthorizationContext>>( ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, "/auth-service/api/v1/users"), AuthorityReactiveAuthorizationManager.hasRole("ROLE_USER")) 위의 방법으로 객체를 하나하나 만들어서 넘겨보기도 했는데 Role이 지정된 건 적용이 됩니다. 그러나 permitAll()을 시켜줘야 하는 것들은 어떻게 적용시켜야 할지... 하루종일 방법을 찾아봤는데 내공 부족으로 인하여 못찾고 해매고 있습니다. 도움 부탁드립니다.
수업에서 배운 세션 고정 공격은 먼저 공격자가 서버에 로그인 인증을 완료한 후 세션ID를 받은 뒤에 피해자에게 몰래 심는 거잖아요. 해당 세션ID로 피해자가 서버에 접속하는 걸텐데, 서버 입장에선 공격자의 신상으로 이미 인증이 되어 있어서 피해자의 모든 요청에 허용을 하지 않을까요? 굳이 피해자가 다시 로그인을 하는 상황이 머릿속에 그려지지 않습니다. 또 피해자가 사이트에 접속했을 때 이미 인증이 되어 있기 때문에 다른 사람으로 로그인이 되어 있을테고, 그러면 오히려 공격자의 신상이 피해자에게 노출되는 꼴 아닌가요..? ㅎㅎ 그렇다고 피해자가 다시 로그인을 하기 위해서 로그아웃하는 순간 악의적인 세션ID는 더 이상 사용하지 못하게 되구요.. 궁금합니다!
안녕하세요 선생님 현재 실전 프로젝트 20 restDsl까지 적용하여 저의 개인 프로젝트를 진행 중에 있습니다 세션 방식은 문제없이 동작을 하지만 토큰으로 변경을 하고자 하니 문제가 생겼습니다 질문 1. 기존 RestAuthenticationFilter을 그대로 사용하고 RestAuthenticationSuccessHandler에서 인증이 완료가 되면 토큰을 발급하여 헤더로 보내주는 것이 가능할가요? 1 방식이 가능하다면 정상 발급된 토큰을 확인하는 필터를 RestAuthenticationFilter 앞에 추가하도록 하여 인증을 유지하고 싶습니다 또한 실제 인증 처리는 Provider 쪽에서 진행이 된다고 강의에서 배웠는데 JwtAuthenticationProvider라는 클래스를 따로 하나 만들어 또 하나의 restFilter를 생성하여 @Order로 우선순위를 주고 새로이 인증을 처리하는 방식이 맞을까요? 이상이 제가 질문 드리고 싶은 부분들 입니다. 혹시 틀린 점이나 추가해야 하는 점이 있다면 조언 부탁 드립니다..
안녕하세요. 강의 열심히 듣고 이것저것 많이 배우고 있습니다. 강사님 강의 중 동적으로 권한 정보를 읽어다 적용하는 부분을 배웠습니다. 혹시 webflux 방식에서도 동적 커스텀 권한 관리가 가능할까요? 자료를 찾아봐도 딱히 방법에 대해 자료가 많이 검색이 되지 않는데 가능 여부만이라도 확인이 가능할까 해서 여쭤봅니다.
ubuntu@ip-172-31-86-200:~/memberCertification$ ./gradlew clean build Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD FAILED in 15s 8 actionable tasks: 8 executed ubuntu@ip-172-31-86-200:~/memberCertification$ ./gradlew clean build > Task :test MemberCertificationApplicationTests > contextLoads() FAILED java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:180 Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1773 Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:276 Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:191 1 test completed, 1 failed > Task :test FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':test'. > There were failing tests. See the report at: file:///home/ubuntu/memberCertification/build/reports/tests/test/index.html * Try: > Run with --scan to get full insights. Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD FAILED in 15s 8 actionable tasks: 8 executed ubuntu@ip-172-31-86-200:~/memberCertification$ ./gradlew clean build > Task :test MemberCertificationApplicationTests > contextLoads() FAILED java.lang.IllegalStateException at DefaultCacheAwareContextLoaderDelegate.java:180 Caused by: org.springframework.beans.factory.BeanCreationException at AbstractAutowireCapableBeanFactory.java:1773 Caused by: org.hibernate.service.spi.ServiceException at AbstractServiceRegistryImpl.java:276 Caused by: org.hibernate.HibernateException at DialectFactoryImpl.java:191 1 test completed, 1 failed > Task :test FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':test'. > There were failing tests. See the report at: file:///home/ubuntu/memberCertification/build/reports/tests/test/index.html * Try: > Run with --scan to get full insights. Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD FAILED in 14s 8 actionable tasks: 8 executed 구글에 검색해본 결과, java: error: invalid flag: --warning-mode=all을 하면 된다는 글을 보고 Preferences > Compiler > java Compiler에 --warning-mode all --stacktrace 입력을 하고 실행을 해봤습니다. java: error: invalid flag: --warning-mode=all가 발생하며 실행이 되지 않습니다. 어떻게 해야 에러를 고칠 수 있을까요 ?
Description: Parameter 0 of constructor in com.example.membercertification.security.config.SecurityConfig required a single bean, but 2 were found: - authenticationProvider: defined in file [/Users/jjeong/Desktop/study/memberCertification/out/production/classes/com/example/membercertification/security/provider/FormAuthenticationProvider.class] - restAuthenticationProvider: defined in file [/Users/jjeong/Desktop/study/memberCertification/out/production/classes/com/example/membercertification/security/provider/RestAuthenticationProvider.class] This may be due to missing parameter name information Action: Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed Ensure that your compiler is configured to use the '-parameters' flag. You may need to update both your build tool settings as well as your IDE. (See https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#parameter-name-retention) 해당 에러에서 적힌 provider 2개를 @Qualifier와 @Primary로 설정하면 /api에서 로그인 할 경우, 로그인 영속성이 안 되는데 어떻게 해결해야 하나요 ?