Microservcie간 통신 강의를 보다가 궁금하게 있어서 질문드립니다. user-service에서 order-service를 요청할때 인증은 필요가 없는건가요? order-service를 요청할때 따로 헤더에 토큰을 담지 않고 요청을 하고 있어서요. order-service를 IP로 지정하지 않고 유레카에 서비스 이름으로 지정해서 요청할때도 gateway를 통해서 요청이 들어 가는것인가요?
찾아보니 비슷한 질문이 있었던 거 같은데 현재 실습환경과 100% 일치하지 않아 도움을 구합니다. 실행환경은 다음과 같습니다 인텔리제이 : Build #IU-241.14494.240, built on March 28, 2024 JDK : 17 스프링부트 : 3.2.4 아시다 시피 최신 인텔리제이에서는 실습환경으로 제시되는 2.X 버전의 스프링부트 지원이 되지 않습니다. POM.XML로 강제로 버전을 내리거나 JDK 버전을 내리는 경우 서비스 기동이 제대로 되지 않습니다. 아마 스프링부트 3 버전에서는 JDK 특정 버전 이상을 강제하는 느낌입니다. 현재 pom.xml 설정은 다음과 같습니다. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.2.4</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.example</groupId> <artifactId>user-serivce</artifactId> <version>0.0.1-SNAPSHOT</version> <name>user-serivce</name> <description>user-serivce</description> <properties> <java.version>17</java.version> <spring-cloud.version>2023.0.1</spring-cloud.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <excludes> <exclude> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </exclude> </excludes> </configuration> </plugin> </plugins> </build> </project> 명렁어 실행 시 에러는 다음과 같이 발생합니다. [ERROR] Unknown lifecycle phase ".run.jvmArguments=-Dserver.port=9003". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-vers ion>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sou rces, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1] 동일한 명렁어를 윈도우즈 cmd에서 실행하면 다음과 같습니다. [WARNING] Error injecting: org.springframework.boot.maven.RunMojo java.lang.TypeNotPresentException: Type org.springframework.boot.maven.RunMojo not present at org.eclipse.sisu.space .URLClassSpace.loadClass ( URLClassSpace.java:147 ) (중략) Caused by: java.lang.UnsupportedClassVersionError: org/springframework/boot/maven/RunMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0 본 문제 때문에 강의 진행이 안되고 있습니다. 꼭 해결해 주셨으면 합니다.
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 파일입니다.
그룹화 강의에서 df.groupby('학교').mean() 이 문을 실행했을때 TypeError가 나타나는데 강사님께서는 결과값이 잘 나옵니다. 어떤 차이인지 그리고 어떤 부분이 틀린건지 알고싶습니다. 자료형 문제인거 같은데 정확히 모르겠어서 문의드립니다. <데이터> <오류 내용>
강사님 안녕하세요. 강의를 다 듣고 배운 내용을 개인 프로젝트를 통해 구현하는중입니다. 제가 CQRS에 대한 오해가 있는 것 같아 질문 드립니다. CQRS는 도메인을 도메인 답게 유지하기 위해 비지니스 로직에 query가 침투하는 것을 막는다. 즉 command, query를 역할에 따라 분리한다. 라고 이해했는데요. 그렇다면, command만 수행하는 서버, query만 수행하는 서버로 분리하는게 맞을까요? 로직상 command를 통해 데이터를 저장 혹은 업데이트하려고 하면, db에서 해당 데이터에 대한 조회가 필수적이라고 생각하는데 이러한 조회도 command의 한 종류라고 생각하면 되는걸까요?
runserver을 하기 위해서 manage.py 를 사용하는데 만약에 mysite를 이용하기 위해서는 mysite에 있는 manage.py 를 이용해야하고 dealershop을 이용하기 위해서는 거기있는걸 이용해야하는건가요?? 처음에 mysite의 manage.py 를 이용해서 하다가 inventory로 안넘어가길래 무슨 문제가 있나 했어요ㅠㅠ
@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로 주입을 받지 않아도 되는 걸까요?