abhish1227 / abhish1227/HospitalDB_Spring

Feature Request: Add Role-Based Authentication

オープン
#1 コメント 3 件 リアクション 0 件 担当者 1 名 @abhish1227 に割り当て済み GitHub で見る
enhancement good first issue help wanted
主要言語
Java
スター
1
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

説明

### **Description**
Implement role-based access control (RBAC) to restrict access to specific endpoints based on user roles (e.g., ADMIN, DOCTOR, PATIENT). This will enhance security and allow fine-grained permission management across the system.

### **Motivation**
Currently, all authenticated users have equal access to protected endpoints. Introducing roles will:
- Prevent unauthorized access to sensitive operations
- Enable scalable permission management
- Align with real-world hospital workflows (e.g., only doctors can update medical records)

### Proposed Changes:
- Add a role field to the User entity (e.g., Enum or String)
- Assign roles during registration or via admin panel
- Update SecurityFilterChain to restrict endpoints using .hasRole("ROLE_NAME")

Example:
```
.requestMatchers("/doctors/admin/**").hasRole("DOCTOR")
.requestMatchers("/patients/admin/**").hasRole("ADMIN")
```
### Acceptance Criteria:
- Users can only access endpoints permitted by their role
- Unauthorized access returns 403 Forbidden
- Role assignment is clearly documented and testable

### Additional Notes:
- Consider using Spring Security’s GrantedAuthority and UserDetailsService for extensibility
- Update README with role-based access documentation once implemented

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。