A demonstration of Role-Based Access Control (RBAC) implementation using the Yew web framework in Rust.
src/
├── main.rs # Application entry point
├── pages.rs # Page components and login logic
├── router.rs # Route definitions and protected route logic
└── state.rs # Global state management (AuthState, Role enum)
- Trunk for building and serving
- Clone the repository:
git clone <repository-url>
cd demo-yew-rbac
- Install Trunk (if not already installed):
cargo install trunk
- Build and serve the application:
trunk serve
- Open your browser and navigate to
http://localhost:8080
The application includes mock authentication with the following test accounts:
Username | Password | Role |
---|---|---|
mobu | 1234 | Mobu |
fighter | 5678 | Fighter |
master | 9999 | Master |
- Login: Enter any of the demo credentials above
- Role-Based Access: Each role can only access their designated page:
/mobu
- Accessible only by users with Mobu role/fighter
- Accessible only by users with Fighter role/master
- Accessible only by users with Master role
- Navigation: Use the navigation links to test protected route behavior
- Logout: Click the logout button to clear the session