[Feat/auth user roles] - security role 추가#91
Conversation
WalkthroughThis update introduces user roles into the authentication and authorization system. It adds role information to JWT tokens, updates the user entity and database schema to include roles, and enforces role-based access control on specific API endpoints. Related methods and token generation logic are refactored to handle the new role field throughout the application. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant JwtAuthenticationFilter
participant JwtResolver
participant SecurityContext
Client->>JwtAuthenticationFilter: Sends request with JWT token
JwtAuthenticationFilter->>JwtResolver: getUserDetailFromJwtToken(token)
JwtResolver-->>JwtAuthenticationFilter: Returns UserDetail(userId, role)
JwtAuthenticationFilter->>SecurityContext: Authenticate with userId and ROLE_{role}
SecurityContext-->>JwtAuthenticationFilter: Sets authentication context
JwtAuthenticationFilter-->>Client: Proceeds with authorized request
sequenceDiagram
participant Application
participant JwtTokenFactory
participant User
Application->>JwtTokenFactory: generateAccessToken(User)
JwtTokenFactory->>User: Get publicId and role
JwtTokenFactory-->>Application: Returns JWT with userId and role claims
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (19)
✅ Files skipped from review due to trivial changes (4)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
jeeheaG
left a comment
There was a problem hiding this comment.
role 이 지금 추가되는군요
고생하셨습니다!!
작업내역
USER와 어드민ADMIN으로 나뉩니다.Notice
Summary by CodeRabbit