DA
dandedotdev/demo-yew-rbac
A Yew-based RBAC (Role-Based Access Control) demo application.
Demo Yew RBAC
A demonstration of Role-Based Access Control (RBAC) implementation using the Yew web framework in Rust.
Project Structure
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)
Getting Started
Prerequisites
- Trunk for building and serving
Installation
- 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
Usage
Demo Credentials
The application includes mock authentication with the following test accounts:
| Username | Password | Role |
|---|---|---|
| mobu | 1234 | Mobu |
| fighter | 5678 | Fighter |
| master | 9999 | Master |
How to Test
- 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