개발일지/항해 99
-
[항해 99 주특기] 토큰 && JWT개발일지/항해 99 2023. 7. 12. 23:55
토큰 Tocken이란 클라이언트에서 보관하는 암호화된 인증 정보로써 서버에서 발급 보관하는 정보인 session과의 가장 큰 차이점은 보관하는 방식이다. 이러한 토큰은 세션처럼 서버에서 보관할 필요가 없어서 서버의 부담을 줄여주고 최근에 가장 많이 사용되는 기술이다 이러한 토큰 중 하나인 JWT(Json Web Tocken) 는 헤더와 페이로드, 시그니쳐로 구성 되어있으며 JWT 공식 문서를 가서 확인하면 인코딩 된 상태와 디코딩 된 상태를 볼 수 있다 (왼쪽 인코딩코드 오른쪽 디코딩코드) 서버에서 발급받은 jwt에는 시크릿코드가 있는데 이 시크릿코드는 보안을 강화해서 보관해야한다 왜냐하면 시크릿코드를 이용해서 서버에서 jwt를 브라우저에게 발급 해주고 그걸 브라우저가 관리하기 때문이며 이 시크릿코드를 ..
-
[항해 99 주특기] 인증 / 인가 (쿠키 && 세션)개발일지/항해 99 2023. 7. 12. 21:40
인증 / 인가 인증이란 서비스를 이용하려는 유저가 등록된 회원인지를 확인하는 절차 인가란 특정 리소스에 접근할 권한이 유저에게 있는지 확인하는 절차 클라이언트가 서버에게 인증을 요청을 하고 서버는 클라이언트에게 인가를 해주는 것이 기본개념 http프로토콜 통신의 특징 무상태 서버와 클라이언트 사이에 상태가 없다는 뜻 클라이언트가 서버에 요청을 하고 응답을 받는 사이클이 한번 지나고 나면 서버는 클라이언트에 상태에 대해서 어떠한 정보도 가지고 있지 않는다 (기억하지 않는다.) 이후 클라이언트가 새로운 요청을 보내면 서버는 항상 새롭게 생각하며 응답한다. 서버는 클라이언트의 상태를 별도로 기억할 필요가 없이 요청대로 항상 응답한다. 이러한 특성은 동일한 서버를 여러개로 확장시킬 수 있다(scale-out) ..
-
[level4 1일차] 뭔가 엄청 이상한데개발일지/항해 99 2023. 7. 10. 00:36
오늘 이제 level 4 를 혼자서 시작을 해보았다. 아직 Css도 제대로 꾸미지 못했는데 막히는 부분이 너무 많이 생겨서 문제다 4시간 좀 넘게 진행을 했는데도 한게 전혀 없는것만 같은 느낌이다 그래도 뭔가 남겨야겠다고 생각이 들었다 오늘 한 내용 fontawsome을 이용해서 icon을 추가하려했지만 이상한 에러가 떠서 이건 나중에 물어보려고한다 style-reset을 이용해서 css 리셋을 시킬 수있다는 사실을 알아냈다 조금씩 Css를 스스로 적용해보고 있다 doc의 구조를 짜면서 현재는 Router와 components 그리고 layout 부분까지 하고 있다 vite를 사용해서 하고있는데 yarn을 써서 하니깐 package에 API가 잘 안깔리는 것 같다 그래서 vite를 쓸때는 걍 npm을 사..
-
[항해 99 주특기] Throttiling && Debouncing && Lodash개발일지/항해 99 2023. 7. 10. 00:31
스로틀링 스로틀링이란 어떠한 이벤트를 연속적으로 눌렀을 때 그 이벤트의 결과로 인해 리랜더링이 모두 일어나게 된다면 부하가 굉장히 높아지게 되는데 이러한 과부화를 막기 위해서 사용할 수 있는 기법으로써 가장 쉬운 예로 좋아요 버튼을 엄청나게 누르는 케이스가 있을텐데 그때마다 서버에 데이터를 갱신해달라는 요청을 보낸다면 많은 부하가 생길 것 이러한 상황에서 쓸 수 있는 기법이다. 즉 과도한 이벤트 핸들러 호출을 방지하는 기법이다. 실제로 사용해보면서 이해하는 것이 가장 쉽기 때문에 실습을 병행하면서 이해를 해보았다. setTimeout을 통해서 원리를 이해해보자 (JS문법에서만 쓰이는 것이 아니기 때문에 잘 알아두면 좋다) 아래 3가지는 스로틀링의 예시이다. 개념적으로는 3가지 기법이 있다 시작할 때, 끝..