https://github.com/hvalfangst/spring-security
Spring Boot 3 application developed in Kotlin with Spring Security 6 demonstrating JWT auth
https://github.com/hvalfangst/spring-security
exposed-orm kotlin postgresql spring-boot spring-boot-3 spring-security spring-security-6 spring-security-jwt
Last synced: 2 months ago
JSON representation
Spring Boot 3 application developed in Kotlin with Spring Security 6 demonstrating JWT auth
- Host: GitHub
- URL: https://github.com/hvalfangst/spring-security
- Owner: hvalfangst
- Created: 2023-07-25T18:25:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-28T20:58:51.000Z (almost 3 years ago)
- Last Synced: 2025-09-08T19:32:57.625Z (9 months ago)
- Topics: exposed-orm, kotlin, postgresql, spring-boot, spring-boot-3, spring-security, spring-security-6, spring-security-jwt
- Language: Kotlin
- Homepage:
- Size: 24.4 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JWT using Kotlin with Spring Boot
## Requirements
* x86-64
* JDK 17
* Keytool
* Linux
* Docker
* Kubernetes
## Startup
The script "up" starts the application by executing the following:
```
1. docker-compose -f db/docker-compose.yml up -d
2. mvn clean install
3. mvn spring-boot:run
```
## Shutdown
The script "down" wipes the database executing the following:
```
1. docker-compose -f db/docker-compose.yml down
```
## HTTP Endpoints
The endpoints under mapping "api/users" does not require any authentication
The endpoint "api/heroes/create" requires the role "HEROES_WRITE"
The endpoint "api/heroes/list/{USER_ID}" requires the role "HEROES_READ"
it.requestMatchers("/api/users/**").permitAll()
it.requestMatchers("/api/heroes/create").hasAnyAuthority("HEROES_WRITE")
it.requestMatchers("/api/heroes/list/**").hasAnyAuthority("HEROES_READ")
### Users
POST http://localhost:8080/api/users/create
```json
{
"fullname": "Glossy",
"email": "glossy@glosstradamus.com",
"password": "yellau"
}
```
POST http://localhost:8080/api/users/{USER_ID}/roles
GET http://localhost:8080/api/users/{USER_ID}/roles
POST http://localhost:8080/api/users/login
```json
{
"email": "glossy@glosstradamus.com",
"password": "yellau"
}
```
### Heroes
POST http://localhost:8080/api/heroes/create
```json
{
"userId": 1,
"class": "Wizard",
"level": 10,
"hitPoints": 200,
"attack": 10,
"damage": 5,
"ac": 12,
"name": "Ernst the Wizard"
}
```
GET http://localhost:8080/api/heroes/list/{USER_ID}