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

Add OGJWTAuthProvider to handle admin users #1423

Open
4 tasks
joshuadkitenge opened this issue Dec 2, 2024 · 0 comments · May be fixed by #1424
Open
4 tasks

Add OGJWTAuthProvider to handle admin users #1423

joshuadkitenge opened this issue Dec 2, 2024 · 0 comments · May be fixed by #1424
Assignees
Labels
enhancement New feature or request

Comments

@joshuadkitenge
Copy link
Contributor

Description

Introduce the OGJWTAuthProvider class to streamline handling of admin users in the OG. This class will provide the isAdmin method to verify if a user has administrative privileges based on the authorised_routes in their JWT.

Tasks

  • Implement the OGJWTAuthProvider class, inheriting from JWTAuthProvider, and add the isAdmin method.
    • Ensure isAdmin checks the token's authorised_routes for the presence of '/users GET'.
  • Write unit tests for the isAdmin method to cover:
    • No token in localStorage.
    • Token with no or empty authorised_routes.
    • Token containing the '/users GET' route.

Acceptance Criteria

  • OGJWTAuthProvider correctly identifies admin status through isAdmin.
  • Unit tests validate all possible scenarios for isAdmin.
@joshuadkitenge joshuadkitenge added the enhancement New feature or request label Dec 2, 2024
@joshuadkitenge joshuadkitenge self-assigned this Dec 2, 2024
@joshuadkitenge joshuadkitenge linked a pull request Dec 2, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant