REST service for company to handle employees' salaries and authorities.
It also includes self-signed SSL certificate.
All registered emails must end with @acme.com, this can be changed in
User entity at field email
Service also has breached passwords table in the database.
Spring Boot
Spring Security
Spring Data JPA
Project lombok
MySQL database
Anonymous | User | Accountant | Administrator | Auditor | |
---|---|---|---|---|---|
POST api/auth/signup |
+ | + | + | + | - |
POST api/auth/changepass |
- | + | + | + | - |
GET api/empl/payment |
- | + | + | - | - |
POST api/acct/payments |
- | - | + | - | - |
PUT api/acct/payments |
- | - | + | - | - |
GET api/admin/user |
- | - | - | + | - |
DELETE api/admin/user |
- | - | - | + | - |
PUT api/admin/user/role |
- | - | - | + | - |
PUT api/admin/user/access |
- | - | - | + | - |
POST api/admin/breached-password |
- | - | - | + | - |
DELETE api/admin/breached-password |
- | - | - | + | - |
GET api/security/events |
- | - | - | - | + |
POST api/auth/signup
{
"name": "<name>",
"lastname": "<lastname>",
"email": "<email>",
"password": "<password>"
}
Saves new employee in the database, password must be longer than 12 chars.
First registered user gets administrator authorities.
POST api/auth/changepass
{
"email": "<email>",
"new_password": "<password>"
}
Saves new employees' password in the database, password must be longer than 12 chars.
GET api/empl/payment
Parameter | Type | Description |
---|---|---|
period |
string |
Not required. Period of payment to fetch |
Returns all payments of user that send the request, if a period is specified returns his payroll.
POST api/acct/payments
[
{
"employee": "<user email>",
"period": "<mm-YYYY>",
"salary": "<long value>"
},
{
"employee": "<user1 email>",
"period": "<mm-YYYY>",
"salary": "<long value>"
},
...
{
"employee": "<userN email>",
"period": "<mm-YYYY>",
"salary": "<long value>"
}
]
Adds new payrolls into database, must not be non-repetitive.
PUT api/acct/payments
{
"employee": "<user email>",
"period": "<mm-YYYY>",
"salary": "<long value>"
}
Updates the payroll with specified period.
GET api/admin/user
Returns a list of all registred users and thier authorities.
DELETE api/admin/user/{email}
Parameter | Type | Description |
---|---|---|
period |
@path |
Required. Users email to delete |
Deletes from database user with specified email.
PUT api/admin/user/role
{
"user": "<user email>",
"role": "<uppercase role to operate with>",
"operation": "<[GRANT, REMOVE]>"
}
Updates user roles
PUT api/admin/user/access
{
"user": "<String value>",
"operation": "<[LOCK, UNLOCK]>"
}
Locks or unlocks specified user account
POST api/admin/breached-password
Parameter | Type | Description |
---|---|---|
password |
string |
Required. The password to add |
Adds breached password into database and not allows to set password as it
DELETE api/admin/breached-password
Parameter | Type | Description |
---|---|---|
password |
string |
Required. The password to delete |
Removes provided breached password
GET api/security/events
Returns a list of all logs.
- Java 11 or higher
cd <path>
java -jar account-service.jar