https://github.com/permitio/springboot-authorization-example-app
https://github.com/permitio/springboot-authorization-example-app
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/permitio/springboot-authorization-example-app
- Owner: permitio
- Created: 2025-07-10T09:22:22.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-10T09:22:52.000Z (12 months ago)
- Last Synced: 2025-07-30T01:06:29.380Z (11 months ago)
- Language: JavaScript
- Size: 21.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 🎵 Spring Boot Music Player with Permit.io Authorization
A modern, responsive web-based music player built with Spring Boot and featuring fine-grained authorization using Permit.io.
## ✨ Features
- **Music Management**: Browse songs, create playlists, queue management
- **Authorization**: Fine-grained permissions using Permit.io
- **Multi-User Support**: Switch between users with different access levels
- **Modern UI**: Dark theme with responsive design
- **Real-time Permissions**: Dynamic permission checks for all actions
## 🚀 Quick Start
### Prerequisites
- Java 17 or higher
- Maven 3.6 or higher
- Permit.io account (free at [app.permit.io](https://app.permit.io))
### Setup
1. **Clone the repository**
```bash
git clone
cd springboot-music-player
```
2. **Configure Permit.io**
- Create a free account at [app.permit.io](https://app.permit.io)
- Get your API key from the dashboard
- Update `src/main/resources/application.properties`:
```properties
permit.api.key=YOUR_PERMIT_API_KEY_HERE
```
3. **Run the application**
```bash
./run.sh
```
Or manually:
```bash
mvn spring-boot:run
```
4. **Access the application**
Open your browser and navigate to: `http://localhost:8080`
## 🔐 Permission Model
The application uses Permit.io to enforce the following permissions:
### Resources
- **playlist**: Public and private playlists
- **song**: Individual songs
### Actions
- **view-public**: View public playlists
- **view-private**: View private playlists
- **add-to-playlist**: Add songs to playlists
- **delete**: Remove songs from playlists
- **play**: Play songs
- **add-to-queue**: Add songs to playback queue
## 🏗️ Architecture
### Backend
- **Spring Boot**: REST API with authorization enforcement
- **Permit.io SDK**: Real-time permission checks
- **In-memory storage**: Simple data layer for demo purposes
### Frontend
- **Thymeleaf + Bootstrap**: Responsive UI
- **jQuery**: AJAX calls with permission-aware error handling
## 🛠️ Development
### Project Structure
```
src/
├── main/
│ ├── java/com/example/musicplayer/
│ │ ├── MusicPlayerApplication.java
│ │ ├── controller/ # REST endpoints with authorization
│ │ ├── model/ # Data models
│ │ └── config/ # Permit.io configuration
│ └── resources/
│ ├── static/ # CSS and JavaScript
│ ├── templates/ # Thymeleaf templates
│ └── application.properties
```
### API Endpoints
- `GET /api/songs` - List all songs
- `GET /api/songs/{id}/play` - Get song playback URL (requires permission)
- `GET /api/playlists/{id}` - Get playlist (requires view permission)
- `POST /api/playlists/{id}/songs` - Add song to playlist (requires permission)
- `DELETE /api/playlists/{id}/songs/{songId}` - Remove song (requires permission)
## 📝 License
This project is open source and available under the MIT License.