Code Monkey home page Code Monkey logo

skeleton's Introduction

TODO 모듈별 인증방식 뷴리

  • 인증 방식 모듈화하여 토큰 / 세션 방식 인증을 서비스 레이어에 추상화하여 사용하도록 하기 - 해당 구현 기술 또한 모듈화하여 추상화 적용

JWT 토큰 인증을 위한 프로젝트

  • 이 프로젝트는 JWT(Json Web Token) 토큰을 사용하여 사용자를 인증하는 예시를 제공합니다.
  • 프로젝트의 구조는 컨트롤러 - 애플리케이션 서비스 - 도메인 서비스 - 리포지토리로 구분하였습니다.
  • 리포지토리는 defult 접근제한자로 선언하여 도메인 서비스에서만 접근 가능하도록 제한하였습니다.
  • 각 레이어는 인터페이스를 통해 결합도를 최소화하도록 설계되었습니다.

구조 설명

컨트롤러(Controller)

  • HTTP 요청을 처리하고 적절한 서비스로 라우팅합니다.

애플리케이션 서비스(Application Service)

  • 어플리케이션에 밀접한 비즈니스 로직을 구현하고 도메인 서비스를 호출하여 요청을 처리합니다.

도메인 서비스(Domain Service)

  • 핵심 비즈니스 로직을 포함하며 애플리케이션 서비스 및 리포지토리와 엔티티로 통신하여 데이터를 처리합니다.

리포지토리(Repository)

  • 데이터베이스와 통신하여 데이터를 읽거나 쓰는 역할을 담당합니다.

토큰 처리 방식

토큰 생성

  • 로그인 또는 인증이 성공하면, 서버는 엑세스 토큰과 리프레시 토큰을 생성하고 이를 쿠키에 담아 응답합니다.

토큰 인증

  • 사용자가 보호된 엔드포인트에 접근하려면, 엑세스 토큰을 헤더에 담아 요청해야 합니다.

토큰 갱신

  • 엑세스 토큰의 유효 기간이 만료되면, 클라이언트는 쿠키에 저장된 리프레시 토큰을 사용하여 다시 서버에 인증을 요청합니다. 서버는 새로운 엑세스 토큰을 생성하고 이를 쿠키에 담아 응답합니다.

skeleton's People

Contributors

nyoongoon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.