jwt 10분 유효기간 끝난 상황에서 jwtAxios를 이용해서 products 를 호출하면 JWTCheckFilter를 걸쳐서 validateToken 메서드를 호출하고 거기서 Exired Exception 이 납니다. accessToken 이 유효시간(10분)이 경과하였으면 refreshToken 으로 교체되는 걸로 강의내용을 인지했었는데요. 제가 어디서 놓친건지 잘 모르겠네요 ㅠ react쪽에서 beforeReq 쪽에서 결국 expired 처리가되고 brforeRes 에서 뭔가 유효기간이 끝났으면 /api/member/refresh 를 호출해야될 것 같은데 예제 소스 잘 따라한거 filter에서 먼저 유효기간이 만료되어 exception 부터 호출되어 더이상 진행이 안되네요. 어디가 정확히 문제인지 모르겠네요. jwtUtil.js 는 제공해주신 소스는 오타가 있을까봐 동일하게 ctrl+c , v 도 했습니다. JWTUtil.java 일부분 public static Map<String, Object> validateToken(String token) { Map<String, Object> claim = null; try { SecretKey key = Keys.hmacShaKeyFor(JWTUtil.key.getBytes("UTF-8")); claim = Jwts.parserBuilder() .setSigningKey(key) .build() .parseClaimsJws(token) // 파싱 및 검증, 실패 시 에러 .getBody(); } catch (MalformedJwtException malformedJwtException) { throw new CustomJWTException("MalFormed"); } catch (ExpiredJwtException expiredJwtException) { throw new CustomJWTException("Expired"); } catch (InvalidClaimException invalidClaimException) { throw new CustomJWTException("Invalid"); } catch (JwtException jwtException) { throw new CustomJWTException("JWTError"); } catch (Exception e) { throw new CustomJWTException("Error"); } return claim; }
모달창이 안떠서 settimeout으로 처리 하니 Modal에 result 값이 true로 적용됩니다 코드는 깃으로 올리겠습니다 선생님 강의에 올라와있는 ch06 파일 코드 넣어서 해봐도 모달창이 안뜨네요 ㅜㅜ https://github.com/hyeonbin03/webstromhub
loadUserByUsername 메서드에서 username 으로 조회잘되고 조회된 MemberDto는 log 출력도 잘되는데 다음 단계에서 "Encoded password does not look like BCrypt" 라는 warn 과 함꼐 "Failed to process authentication request" 로 자격증명에 실패했다고 합니다. DB의 패스워드는 암호화 되어 잘 저장된거 확인됩니다 제가 무언가를 잘못 작성한건지 파라미터로 보낸 password 는 어디서 encode해야 하는건지 아니면 다른 문제가 있는건가요?
안녕하세요, 강의 잘 보고 있습니다. 이번에 JWT 관련 기능을 구현함에 있어 참고차 보게되었는데요. 시큐리티가 인터페이스화가 많이 되어있다보니 동일한 기능임에도 구현하는 사람마다 어느 필터에서 인증/인가를 구현하는 지가 차이가 있는 것 같습니다. 섹션 3 버전2 소스 기준으로 JwtAuthorizationFilter 의 경우 BasicAuthenticationFilter를 확장하여 사용하고 JwtAuthenticationFilter의 경우 UsernamePasswordAuthenticationFilter 를 확장하여 사용하고, 필터에 등록되어 있습니다. 위 2가지 필터는 공식 문서 참고에 의하면 BasicAuthenticationFilter 는 HTTP 헤더에서 토큰을 추출하여 간단히 인증을 하는 용도로, UsernamePasswordAuthenticationFilter는 폼 기반의 로그인을 처리한다고 나와 있습니다. 만약 그렇다면, 폼 로그인 없이 JWT 토큰 만으로는 BasicAuthenticationFilter를 확장하는 JwtAuthorizationFilter만 존재해도 인증 과정 상 크게 문제는 없어보이는데요. (권한 체크는 별도로 할거라 인증 과정에 넣지 않으려고 합니다.) 어떤 분은 토큰 체크하는 부분을 GenericFilterBean 또는 OncePerRequestFilter 로 구현하시는 분들도 존재하더라구요. 단순히 로그인 컨트롤러에서 JWT 토큰을 발급하고 이후 요청 필터에서 토큰 체크 및 리프레시 토큰 체크 등의 인증 처리를 한다면 어떤 필터를 구현하여 등록하는 걸 추천하시는지 개인적으로 궁금합니다. 감사합니다.
프로젝트를 설정하고 되다가 다시 키니까 안되서 문의드립니다. 제가 java 버전이 3개 정도 설치되어 있는 데 작업할 때 17로 수정해서 쓰고 다른 것 해야 할 때 11로 바꿔서 썼다가 오늘 17로 바꿔서 쓰는 데 자바버전이 안 먹히는 것 같아서 문의 드립니다. The supplied phased action failed with an exception. A problem occurred configuring root project 'mallapi'. Could not resolve all files for configuration ':classpath'. Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.10-SNAPSHOT. Required by: project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.10-SNAPSHOT:20240229.214127-20 No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.10-SNAPSHOT:20240229.214127-20 was found. The consumer was configured to find a library for use during runtime, compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.5' but: - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.10-SNAPSHOT declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.10-SNAPSHOT declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 11) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.10-SNAPSHOT declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.10-SNAPSHOT declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.10-SNAPSHOT declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 17 and the consumer needed a component, compatible with Java 11 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.5') - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.10-SNAPSHOT declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 11) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')
기본적으로 터미널에 Starting the development server... 이 뜨고 페이지가 나오긴 하는데 무한 로딩이 걸립니다..그 후 로딩이 멈추면 콘솔창에 이런 오류가 발생합니다 ++기다려 보니 WebSocket connection to 'ws://localhost:3000/ws' failed: WebSocketClient @ WebSocketClient.js:13 initSocket @ socket.js:27 (anonymous) @ socket.js:51 Show 3 more frames Show less 이런 오류도 뜹니다
선생님 안녕하세요! 강의내용이랑 상관없는 질문이라 정말 죄송합니다..ㅜㅜ! 다만 궁금한게있어서 염치불구하고 질문드립니다.. 다름아니라, Nextjs에 자체적으로 서버 api가 있는걸로 알고있습니다. 그래서 Nextjs를 사용할때는 DB만 선정해서 작업하는식으로 해도된다고 알고있는데요.. 정말 인가요? 정말이겠지만.. 음 .. 옳은 방식인가요? 만약 제가말한 1번경우말고,Nextjs랑 Nestjs랑 같이 사용할경우 Nestjs용 서버폴더를 따로 만들고 사용하는게 나을까요? 회원가입 로직도 그럼 서버폴더에서 따로 할테고.. 그러면 넥스트js의 auth라이브러리를 따로 사용을 못하는걸까요?
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 1.postman에서 /login경로로 로그인 시도를 하여 성공하였는데, 로그인 성공 이후에는 어떤 경로로 이동하게 되는건가요? 만약 리액트와 협업을 하여 로그인 기능을 구현한다면 로그인 화면에서 아이디와 비밀번호를 치고 로그인을 시도해야하는데 그 경우에는 경로를 @PostMapping("/login") public void login(User user) { } 이런식으로 해야하는건가요?
jwt를 공부하던 중 JwtAuthenticationFilter에 있는 successfulAuthentication메서드에서 response.addHeader( "Authorization" , "Bearer " + jwtToken) ; 이렇게 header값에 추가를 해주었는데 postman에서 send를 해도 response의 headers쪽에 authorization라는 키값이 안보입니다... 무슨 다른 설정을 해주어야 할까요?
참조 테이블 : Follow , PostHashtag 관계를 맺을때 throught 테이블에 카멜 케이스로 테이블을 작성해서 그런거 같은데 , git 소스 원본에도 해당 내용으로 작성되어 있습니다. 영상 가의 마지막 31:53에 테이블이 소문자로 작성된 내용을 보고 질문드립니다 .
강의를 모두 수강하였는데요! 한가지 추가적으로 더 배우고 싶은 부분이 있어서 질문 드립니다. 다름이 아니라, 강의에서 Oauth 인증과 Jwt 토큰 인증을 따로 배웠습니다. Oauth2 같은 경우 sns인증을 받아 session을 사용하여 권한 처리가 되었는데, session 말고 JWT를 사용해서 Oauth2 권한 처리하려면 어떻게 해야하는 지 알고 싶습니다. 강사님께서 다른 강의에서 다뤄 주시겠다고 하셨는데, 혹시 해당 강의를 들으려면 어디에서 수강할 수 있을 지 알고 싶습니다!
안녕하세요 강사님. 섹션 7까지 강의를 잘 보고 따라했는데요. 이상하게 Todo가 안나타납니다. getList에서 데이터 조회까진 다 되고 setServerData에도 값을 넣어주는데요. return에서 servaData를 뽑으려니 뽑히지가 않네요. 그래서 return ( {serverData} ) 만 해도 값이 안나옵니다.. 콘솔엔 뽑을 수 있게 오브젝트로 나오는데.. 혹시 추측되는 이유가 있으실까요? 아래 깃허브 주소도 첨부하겠습니다. https://github.com/Jack0215/react-mall-with-spring 확인 해주시면 감사하겠습니다.