백로그
0할 일
0진행 중
0리뷰
0완료 (30일)
3doorkeeper 설치 + DB 마이그레이션 + 설정 + 인증 통합
## 작업 내용 1. Gemfile에 `gem 'doorkeeper'` 추가 및 bundle install 2. `rails generate doorkeeper:install` 실행 3. doorkeeper 마이그레이션 생성 — **UUID PK 필수** (기존 DB 패턴: pgcrypto, gen_random_uuid) 4. `rails db:migrate` 실행 5. `config/initializers/doorkeeper.rb` 설정: - `resource_owner_authenticator`: 기존 authentication.rb의 세션 기반 인증 활용 - `admin_authenticator`: 기존 admin 권한 체크 활용 - `grant_flows`: ['authorization_code', 'client_credentials'] - `access_token_expires_in`: 2.hours - `use_refresh_token`: true 6. `config/routes.rb`에 `use_doorkeeper` 추가 (기존 라우트와 충돌 없도록) 7. User 모델에 doorkeeper 관계 추가 8. 기존 인증(Cookie Session, OmniAuth, Magic Link)이 정상 동작하는지 확인 ## 참고 파일 - `app/controllers/concerns/authentication.rb` — 기존 인증 로직 - `app/controllers/concerns/authorization.rb` — 어드민 권한 - `app/models/user.rb` — User 모델 - `app/models/session.rb` — Session 모델 - `config/initializers/omniauth.rb` — OmniAuth 설정 - `config/routes.rb` — 라우트 ## 완료 기준 - doorkeeper 테이블 생성 완료 (UUID PK) - /oauth/authorize, /oauth/token 엔드포인트 접근 가능 - 기존 웹 로그인 정상 동작 - doorkeeper initializer 설정 완료
OAuth Application 어드민 관리 UI
## 작업 내용 1. 어드민 영역에 OAuth Application 관리 컨트롤러 생성 - `Admin::OauthApplicationsController` (CRUD) 2. 어드민 라우트 추가 (`admin/oauth_applications`) 3. 뷰 생성: - index: 등록된 OAuth Application 목록 (이름, client_id, redirect_uri, scopes) - new/edit: Application 등록/수정 폼 - show: Application 상세 (client_id, client_secret 표시, secret은 생성 시에만 표시) 4. 기존 어드민 레이아웃/스타일(Tailwind) 활용 5. 기존 어드민 사이드바에 메뉴 추가 ## 참고 파일 - `app/controllers/admin/` — 기존 어드민 컨트롤러 패턴 참고 - `app/views/admin/` — 기존 어드민 뷰 패턴 참고 - `app/views/layouts/admin.html.erb` — 어드민 레이아웃 - `app/helpers/icon_helper.rb` — 아이콘 헬퍼 ## 의존성 - backend-dev의 doorkeeper 설치 완료 후 작업 가능 - Doorkeeper::Application 모델 사용 ## 완료 기준 - 어드민에서 OAuth Application 생성/수정/삭제 가능 - client_id/secret 발급 및 표시 - scopes, redirect_uri 설정 가능
doorkeeper 통합 테스트
## 작업 내용 1. Authorization Code Grant 흐름 테스트: - OAuth Application 등록 → authorize 요청 → callback → token 교환 - access_token으로 보호된 리소스 접근 - 잘못된 token으로 401 응답 확인 2. Client Credentials Grant 테스트: - client_id/secret으로 직접 token 발급 - 서버 간 API 호출 시나리오 3. 기존 인증 회귀 테스트: - Google OAuth 로그인 정상 동작 - Kakao OAuth 로그인 정상 동작 - Magic Link 로그인 정상 동작 - 기존 세션 기반 인증 정상 동작 4. Refresh Token 테스트: - 만료된 access_token으로 refresh 요청 - 새 access_token 발급 확인 ## 참고 파일 - `test/integration/authentication_test.rb` — 기존 인증 테스트 패턴 참고 - `test/test_helper.rb` — 테스트 헬퍼 ## 의존성 - backend-dev의 doorkeeper 설치 완료 후 작업 가능 ## 완료 기준 - 모든 테스트 통과 (rails test) - Authorization Code, Client Credentials 흐름 검증 - 기존 인증 회귀 테스트 통과