Fără Descriere

Daniel Bohry 02a347306f set token expiration based on user role 10 luni în urmă
.github 18c25bb6c8 add deploy trigger gha 10 luni în urmă
gradle d37df53da1 bump java 25 (#4) 1 an în urmă
src 02a347306f set token expiration based on user role 10 luni în urmă
.gitignore fb9cc9ebc6 Upgrade auth endpoint 2 ani în urmă
Dockerfile d37df53da1 bump java 25 (#4) 1 an în urmă
README.md fc96eaf92b update README.md 1 an în urmă
build.gradle d37df53da1 bump java 25 (#4) 1 an în urmă
gradlew fb9cc9ebc6 Upgrade auth endpoint 2 ani în urmă
gradlew.bat fb9cc9ebc6 Upgrade auth endpoint 2 ani în urmă
settings.gradle 6b56c52c0c first commit 3 ani în urmă

README.md

Auth Service

This is a basic authentication service providing user registration, authentication (login), and authorization checks. The service is built using Spring Boot and is intended to be integrated as a backend module in larger systems.

Endpoints

All endpoints are prefixed with /api.

POST /api/register

Registers a new user.

  • Request Body:

    {
    "username": "imusername",
    "password": "supersecret123"
    }
    - **Response (201 CREATED)**
    

    json { "id": "a435bf57-f4b8-6j3h-g362-a5adbffd6fft", "username": "imusername", "token": "eyJhbGciOiJIUzI1NiJ4.eyJzdWIiOiJkYm3ocnkiLCJleHAiOjE3NDcwNTA4NTcsImlhdCI6MTc0Njg3ODE1NywiYXV0aG9yaXRpZXMiOlsiQURNSU4iLCJVU0VSIl19.PRcIp7Jds65ScSSxBgzLFImP4BF5LcAHYAx7Q1y7ij5", "expirationDate": "2025-05-12T11:55:57.349Z", "roles": [

    "USER"
    

    ] }

POST /api/authenticate

Authenticates an existing user and returns a JWT token.

  • Request Body:

    {
    "username": "imusername",
    "password": "supersecret123"
    }
    - **Response (200 OK)**
    

    json { "id": "a435bf57-f4b8-6j3h-g362-a5adbffd6fft", "username": "imusername", "token": "eyJhbGciOiJIUzI1NiJ4.eyJzdWIiOiJkYm3ocnkiLCJleHAiOjE3NDcwNTA4NTcsImlhdCI6MTc0Njg3ODE1NywiYXV0aG9yaXRpZXMiOlsiQURNSU4iLCJVU0VSIl19.PRcIp7Jds65ScSSxBgzLFImP4BF5LcAHYAx7Q1y7ij5", "expirationDate": "2025-05-12T11:55:57.349Z", "roles": [

    "USER"
    

    ] }

POST /api/authorize

Validates whether the currently authenticated user has the required authority.

Headers:

Authorization: Bearer <JWT token>

Response:

200 OK if authorized

403 FORBIDDEN if not authorized