rememberMe 의 흐름상 자동 로그인을 하는 것으로 보이는데 강의 들으면서 나름 커스텀하여 로그인 창이 뜰때 아이디만 저장하기 기능을 추가하고 싶은데 어떻게 해야할까요? 1. 로그인창 a. 처음에는 세션, 쿠키도 없으니 빈칸 로그인 성공이후 로그인 정보의 아이디값을 쿠키 에 넣는다. 로그아웃이후 쿠키가 남아있으면 아이디 란에 아이디를 넣는다. 를 하고 싶어용
동시 세션 제어에서, invalidSessionUrl 경로를 지정하고 expiredUrl 경로를 지정하지 않았을 때 'This session has been expired' 메시지가 나오는데, 한 번 더 새로고침을 하면 정상적으로 invalidSessionUrl 경로로 가네요. ?continue 경로로 302 응답 후 invalidSessionUrl 200 응답으로 되네요. 제 생각에는 버그가 아닐까 싶긴 합니다.
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. github에 올려주신 version2, 3 둘 다 빨간줄뜨고 6.1 이후로 deprecated 되었다고 나오는데 설정 어떻게 해야 할까요? ㅜㅜ 스프링부트 시큐리티2강 - 시큐리티 설정 듣고있습니다.
안녕하세요 강사님, 실정강의 중에 궁금한 사항이 있어 질문드립니다. FromLogin방식에서는 CustomFilter를 따로 생성하지 않고 Ajax 비동기 로그인 방식에서만 CustumFilter를 생성하여 http.addFilter 로 필터를 추가하신 내용을 수강중입니다. 궁금산사항은 FormLogin 방식에서는 왜 필터를 추가를 안하고 비동기 통신 로그인 일때만 필터를 추가하는지 그 이유가 궁금하여 질문드립니다.
안녕하세요 현재 강의 초반부 수강중인 수강생입니다. 혹시 실전프로젝트 자료에 포함된 내용중에 JWT를 사용하여 인증을 하는 예제도 제공이될까요? 아니면 JWT에 대한 예제는 없는걸까요? github에서 제가 못찾는건지 궁금하여 질문드립니다. 사내 업무에서 전통적인 세션기반인증이 아닌 JWT를 사용한 인증을 사용하려다보니 해당내용이 강의자료에는 없는것 같아 질문드립니다. 강의를 전부 수강하지 못하고 질문드리는 점 양해부탁드립니다.
안녕하세요. 강사님 강의 듣고 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 방식에서도 동적 커스텀 권한 관리가 가능할까요? 자료를 찾아봐도 딱히 방법에 대해 자료가 많이 검색이 되지 않는데 가능 여부만이라도 확인이 가능할까 해서 여쭤봅니다.
8강 15:08쯤에 구글 로그인을 하고 http://localhost:8080/test/oauth/login 경로로 get요청을 보내게 되면 아래와 같은 에러가 발생합니다. 원인은 authentiacation의 값이 null이기 때문에 getPrincipal()을 하지 못하는 것 같습니다. 어떤 부분에서 Authentication객체에 값을 넣어주는 걸까요?? 혹시 loadUser메소드에서는 값이 정확하게 노출이 되는것을 확인 할 수 있는데 혹시 loadUser에서 authentication객체에 값을 넣어주는 부분일까요??
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에서 로그인 할 경우, 로그인 영속성이 안 되는데 어떻게 해결해야 하나요 ?
SecurityConfig 클래스에서 @Bean 으로 등록한 UserDetailsService 클래스는 http.userDetailsService(userDetailsService) 이런식으로 설정하지 않는데, 그 이유를 알 수 있을까요 ?? 커스텀하게 만든 UserDetailsService 즉, FormUserDetailsService 를 사용하기 위해서는 http.userDetailsService(userDetailsService) 이런식으로 설정을 해야된다고 강의에 설명되어 있었습니다. 근데, SecurityConfig 클래스에서 @Bean 으로 등록한 UserDetailsService 클래스도 걀국 우리가 직접 커스텀하게 만든것이지 않나요..? 그러면 이클래스도 http.userDetailsService(userDetailsService) 이런식으로 설정을 해야할거 같은데 안해도 정상적으로 작동하는 이유가 궁금합니다 !!
안녕하세요. 강사님. 강의 외적인 내용이지만, 질문 좀 드리겠습니다. JWT로 로그인하는 스프링 서버를 만들었는데요. 클라우드에 올린 서버가 포스트맨의 POST 형식의 로그인 요청을 수행한 뒤, 동일한 url의 GET 요청으로 Redirect 되는 현상을 발견했습니다. 스프링 서버를 로컬에서 띄우는 경우에는 발생하지 않습니다. 강의를 전부 듣지는 않았지만, FormLogin, HttpBasic를 모두 비활성화해도 로그인 이후에 Redirect가 발생하나요? Redirect를 안하고 싶은 경우는, 어떻게 설정하면 될까요? JwtFilter의 doFilter 로직에 AuthenticationSuccessHandler 구현체를 만들어서 처리하면 되는 것까지 확인했습니다.