apigateway의 application.yml을 보면 get요청에는 authorizationHeaderFilter를 적용시키고 있습니다. authenticFilter는 그저 로그인 요청시 attempthAuthentication메소드와 successfulAthentication메소드를 통해 인증을 처리하고 response헤더에 토큰을 추가하는 역할입니다. 따라서 로그인 요청에만 적용하면 될 것 같은데, 깃허브의 최신코드 버전을 보면 거의 모든 요청에 authenticationFilter를 적용하고 있습니다. 왜 로그인요청이 아닌 다른 요청에다가 AthenticFilter를 적용할까요? apiGateway-service에서 GET요청만 AuthoriztionFilter를 적용하면 되지않나요?? http.authorizeHttpRequests((authz) -> authz .requestMatchers(new AntPathRequestMatcher("/actuator/**")).permitAll() .requestMatchers(new AntPathRequestMatcher("/h2-console/**")).permitAll() .requestMatchers(new AntPathRequestMatcher("/users", "POST")).permitAll() .requestMatchers(new AntPathRequestMatcher("/h2-console/**")).permitAll() // .requestMatchers(new AntPathRequestMatcher("/welcome/**")).permitAll() // .requestMatchers("/**").access(this::hasIpAddress) .requestMatchers("/**").access( new WebExpressionAuthorizationManager("hasIpAddress('127.0.0.1') or hasIpAddress('172.30.1.48')")) .anyRequest().authenticated() )
안녕하세요. 깃허브에서 spring boot 3.2 브랜치통해 코드를 작성했습니다. 그런데 회원가입, 로그인까지 해서 jwt토큰까지는 잘 받아오는데, 그 이후에 /welcome으로 헤더에 토큰으로 추가해서 요청을 보내도 403 forbidden에러가 뜹니다. 코드는 spring boot 3.2 브랜치와 동일합니다.
안녕하세요 로그인시에는 인증이 필요하지가 않는데 자꾸 인증 해주는 AuthorizationHeaderFilter 클래스에서 apply 메소드에서 header 값이 없다고 걸립니다. 그래서 아래와 같이 401 오류로 로그인이 안됩니다. application.yml 파일은 문제없는거 같은데 뭘 더 확인해봐야 할까요,,,? 아래는 Users application.yml 파일입니다.
강사님 안녕하세요. 강의를 다 듣고 배운 내용을 개인 프로젝트를 통해 구현하는중입니다. 제가 CQRS에 대한 오해가 있는 것 같아 질문 드립니다. CQRS는 도메인을 도메인 답게 유지하기 위해 비지니스 로직에 query가 침투하는 것을 막는다. 즉 command, query를 역할에 따라 분리한다. 라고 이해했는데요. 그렇다면, command만 수행하는 서버, query만 수행하는 서버로 분리하는게 맞을까요? 로직상 command를 통해 데이터를 저장 혹은 업데이트하려고 하면, db에서 해당 데이터에 대한 조회가 필수적이라고 생각하는데 이러한 조회도 command의 한 종류라고 생각하면 되는걸까요?
@Configuration @EnableWebSecurity public class WebSecurity { extends WebSecurityConfigurerAdapter { private UserService userService; private BCryptPasswordEncoder bCryptPasswordEncoder; private Environment env; public WebSecurity(Environment env, UserService userService, BCryptPasswordEncoder bCryptPasswordEncoder) { this.env = env; this.userService = userService; this.bCryptPasswordEncoder = bCryptPasswordEncoder; } 강의에서 보면 @Configuration으로 WebSecurity클래스가 설정되어있기에 userService, bCryptPasswordEncoder, environment 인스턴스가 준비되어 있다고합니다. 따라서 위의 코드와 같이 생성자주입을 하지않는데, 왜 @Configuration으로 설정되어 있으면 @Autowired로 주입을 받지 않아도 되는 걸까요?
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. [내부영역:응용서비스 구현(어플리케이션 헥사곤)-InputPort구현,아우터 포트 정의]강의에서 음성이 불명확하고, 코드 포커스로 확대하신것같은데 잘린부분(클래스 명, 어노테이션 등)이 많아요
안녕하세요. "섹션 16. 애플리케이션 배포 - Docker Container"을 학습하면서 config-service를 Docker로 만들어 실행하면 컨테이너 실행 됐다가 Exit가 되고, "docker logs config-service"로 로그를 보면 아래와 에러가 발생합니다. JDK11 , springboot 2.4.5 버전에 spring-cloud-starter-bootstrap 의존성은 추가 되어 있는 상태입니다. 답변 부탁드립니다. 감사합니다. =================================================================== 2024-03-22 06:50:22.104 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [ org.springframework.boot.actuate.health .HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'configServerHealthIndicator' defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.class]: Unsatisfied dependency expressed through method 'configServerHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ' org.springframework.cloud .config.server.config.CompositeConfiguration': Unsatisfied dependency expressed through method 'setEnvironmentRepos' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultEnvironmentRepository' defined in class path resource [org/springframework/cloud/config/server/config/DefaultRepositoryConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository. 2024-03-22 06:50:22.113 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 2024-03-22 06:50:22.117 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2024-03-22 06:50:22.134 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2024-03-22 06:50:22.149 ERROR 1 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Invalid config server configuration. Action: If you are using the git profile, you need to set a Git URI in your configuration. If you are using a native profile and have spring.cloud .config.server.bootstrap=true, you need to use a composite configuration. ===================================================================
안녕하세요 강사님 좋은 강의 정말 감사드립니다. user service에서 어떤 요청이 들어오든 AuthenticationFilter 를 거치게 되는 것으로 알고 있는데 login 요청을 제외한 다른 요청들은(ex: health-check, welcome 등) AuthenticationFilter 에 존재하는 attemptAuthentication과 loadUserByUsername 메소드는 실행되지 않고 바로 필터가 통과되는 것인가요? 해당 질문은 msa 라기보다 시큐리티 관련 내용인 것 같아 여기에 질문하는 것이 좀 죄송한데 답변 주시면 정말 감사드리겠습니다. 감사합니다!
모듈형 모노리스도 컨테이너화 할 수 있다. 쿠버네티스의 꼭 마이크로서비스만 올리는게 아닌 모노리스도 그냥 올릴 수 있다. 그것만으로도 확장성,배포성,탄력성이 보장이 되기도 한다. 라고 하셨었는데 이 부분에대해서 조금 더 상세하게 알고싶어서 질문드립니다. 확장성,배포성,탄력성 부분에서 어떤 장점들이 있는지 조금 더 디테일하게 궁금합니다. 그렇다면 모노리스 서버 구조의 아키텍처 설계 대신에 항상 쿠버네티스를 쓰는게 좋지 아니한가해서 질문드립니다.
카프라 활용 1~2를 보면서 궁금한 점이 생겼는데 DB서 insert 가 발생했을 때는 @KafkaListener 를 통해 생성된 데이터를 받을 수 있는데 update나 delete 가 발생했을 때는 @KafkaListener로 받을 수 없더라고요? DB에서 update또는 delete문이 발생했을 때의 이벤트도 받으려면 어떻게 해야할까요?
안녕하세요. 다른 강의 들으시는 분들께 공유드리는 내용입니다. 저는 강의 내용에서 알려주신 config로 적용하면 기동이 되질 않더라고요 helm 차트로 하지 않고 제가 docker 로 올려서 약간의 config 형식 차이가 발생했을 것 같습니다. 수업중인 signoz와 제가 설치한 signoz의 버전 차이가 있으리라 생각합니다. 제가 참고한 open-telemetry config 예시 파일 공유드립니다. https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/spanprocessor/testdata/config.yaml spanprocessor 부분 링크이고, 다른 카테고리에서 다른 proceccor 형식도 참고할 수 있습니다. 감사합니다.
두개의 Service가 통신할 때 예외처리 시나리오 A, B 서비스가 있을 때 A 서비스에서 B 서비스로 데이터를 수정 또는 생성하는 요청을 했는데 이 때 개발자가 의도해서 예외를 발생시켰던 예상치못한 예외가 발생했던 간에 예외가 발생해서 B서비스의 데이터를 수정하지 못하는 경우라면 A서비스는 어떻게 롤백시켜주나요? 1번 시나리오에서 하나의 서비스가 추가되어 3개의 Service가 통신할 때 예외처리 시나리오 A서비스에서 B 서비스를 수정 or 생성 하고 C서비스를 수정 or 생성하는 시나리오일 경우 만약에 B서비스에 요청을 했을 때는 성공을하고 C서비스에 요청을 했을 때 실패를 했다면 A서비스로 롤백시켜줘야하고 B서비스도 롤백을 시켜주어야할텐데 이 경우에는 어떻게 롤백처리를 해주나요?? 구글해보니 그냥 추상적으로 오케스트레이션 Saga패턴? 그런걸로 처리한다는데 막연하게 글로만 설명있고 어떤 소프트웨어를 설치해서 코드를 짜면된다 이런건 없어서 어떻게 처리되어야하는건지 감을 못잡겠네요ㅠㅠ. Axon 서버 뭐 이런것도 본거 같기도 하고요.