Skip to content

utpbw/account-service-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Account Service

A Spring Boot REST service that manages employee accounts, payroll, and role-based access control for the ACME corporation. The service is built incrementally through multiple Hyperskill stages, starting with user registration and evolving to include authentication, authorization, and audit logging.

Tech Stack

Layer Technology
Language Java 17+
Framework Spring Boot 3.5.9
Validation Jakarta Bean Validation (Hibernate 8.x)
Database H2 (in-memory/file)
Build Gradle (Hyperskill wrapper)
Testing Hyperskill hs-test framework

How to Run

./gradlew :Account_Service__Java_-task:bootRun

The server starts on port 28852. H2 console (when configured) is available at http://localhost:28852/h2-console.

API Reference

Method URL Auth Required Description
POST /api/auth/signup No Register a new user
POST /api/auth/changepass Basic Auth Change the authenticated user's password
GET /api/empl/payment Basic Auth Get the authenticated user's profile

More endpoints will be added in subsequent stages.

Request / Response Examples

POST /api/auth/signup

Request:

{
  "name": "John",
  "lastname": "Doe",
  "email": "johndoe@acme.com",
  "password": "secret"
}

Response 200 OK:

{
  "id": 1,
  "name": "John",
  "lastname": "Doe",
  "email": "johndoe@acme.com"
}

Response 400 — any field blank/null, wrong email domain, or duplicate email ("User exist!").

POST /api/auth/changepass (Basic Auth)

Request:

{ "new_password": "bZPGqH7fTJWW" }

Response 200 OK:

{
  "email": "johndoe@acme.com",
  "status": "The password has been updated successfully"
}

Response 400 — password < 12 chars, in the breached list, or same as current.

GET /api/empl/payment (Basic Auth)

Response 200 OK:

{
  "id": 1,
  "name": "John",
  "lastname": "Doe",
  "email": "johndoe@acme.com"
}

Validation Rules

Signup

Field Rule
name Must not be blank
lastname Must not be blank
email Must not be blank; must match *@acme.com (any case)
password Must not be blank
email Must be unique (case-insensitive); returns "User exist!"

Change Password

Field Rule
new_password ≥ 12 characters
new_password Must not be in the 12 breached PasswordFor* passwords
new_password Must differ from the current password

Running the Tests

./gradlew :Account_Service__Java_-task:test

About

Hyperskill Account Service — Spring Boot 3.x REST API with Basic Auth, role-based access, payroll management, security event logging, and brute-force protection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages