Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BE - Protect Permission Routes #69

Open
3 of 4 tasks
sanjaysah101 opened this issue Sep 19, 2024 · 0 comments
Open
3 of 4 tasks

BE - Protect Permission Routes #69

sanjaysah101 opened this issue Sep 19, 2024 · 0 comments
Assignees
Labels
ansopedia enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@sanjaysah101
Copy link
Collaborator

sanjaysah101 commented Sep 19, 2024

Description:

Implement access control for user-related routes to ensure that only authenticated users can access them. Specifically, the following routes need to be protected:

  • GET /permissions

Key Requirements:

1. Authentication Middleware:

  • Use the validateAccessToken middleware to ensure that only logged-in users can access these routes.

2. Route Protection:

  • Apply the middleware to the following routes:
    router.get('/permissions', validateAccessToken, getPermissions);
  1. Remove Route:

    router.post('/permissions', createPermission);

4. Testing:

  • Write unit tests to cover the following scenarios:
    • Verify that authenticated users can access both routes successfully.
    • Ensure that unauthenticated users receive a 401 Unauthorized response when trying to access these routes.

Tasks:

  • Apply the validateAccessToken middleware to the /permissions
  • Remove Post /permissions route
  • Ensure proper error handling for unauthorized access.
  • Write unit tests for all scenarios mentioned above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ansopedia enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant