$ show Heeexy/SpringBoot-Shiro-Vue
This repository provides a full-stack demonstration of a permission management system using Spring Boot for the backend and Vue.js for the frontend. Despite its name, it does not use Apache Shiro; instead, it implements a custom, annotation-based permission control via AOP (RequiresPermissions annotation and PermissionAspect) and token-based authentication using Caffeine local cache. The backend is a monolithic Spring Boot 2.3.10 application with MyBatis for database access, serving a REST API. The frontend is a Vue 2 application (based on vueAdmin-template) with dynamic routing and ElementUI, featuring a custom directive for button-level permission checks. The system supports multi-role users, role-based menu and permission assignment, and a clean separation of concerns between backend and frontend permission enforcement. The codebase is well-structured and serves as a clear reference for implementing RBAC-like permission systems in Java+Vue projects, though it is not intended for production use without significant hardening and updates.
The LLM identified 3 files worth highlighting for reuse:
A reusable AOP aspect that intercepts methods annotated with @RequiresPermissions and validates the current user's permission set against the required permissions. It supports logical AND/OR conditions and throws an UnauthorizedException on failure. This pattern decouples permission logic from business code and can be extracted into any Spring Boot project requiring method-level security.
A self-contained service for generating, validating, and invalidating authentication tokens. It uses Caffeine cache to store user session information (SessionUserInfo) keyed by a short UUID token, with configurable expiration. The service also handles admin-specific permission expansion. This pattern demonstrates a lightweight, stateless authentication mechanism that can be adapted to use Redis or other distributed caches.
A custom Vue directive that removes DOM elements if the user lacks the required permission. It supports multiple permissions separated by '|' (OR logic) and integrates with the Vuex store. This pattern is a clean, reusable way to implement button-level permission control in Vue.js applications and can be extracted with minimal changes to any Vue project using a similar permission store.