backend version of the Spring Petclinic application only provides a REST API implemented by Kotlin. There is no UI. The spring-petclinic-angular project is a Angular front-end application which consumes the REST API.
See the presentation of the Spring Petclinic Framework version
git clone https://github.com/junoyoon/spring-petclinic-rest-kotlin.git
cd spring-petclinic-rest-kotlin
./gradle bootRun
You can then access petclinic here: http://localhost:8080/
There are actuator health check and info routes as well:
You can reach the swagger UI with this URL http://localhost:8080/.
You then can get the Open API description reaching this URL localhost:8080/v3/api-docs.
In its default configuration, Petclinic uses an in-memory database (HSQLDB) which gets populated at startup with data.
In its default configuration, Petclinic doesn't have authentication and authorization enabled.
In order to use the basic authentication functionality, turn in on from the application.properties file
petclinic.security.enable=true
This will secure all APIs and in order to access them, basic authentication is required. Apart from authentication, APIs also require authorization. This is done via roles that a user can have. The existing roles are listed below with the corresponding permissions
- OWNER_ADMIN -> OwnerController, PetController, PetTypeController (getAllPetTypes and getPetType), VisitController
- VET_ADMIN -> PetTypeController, SpecialityController, VetController
- ADMIN -> UserController
There is an existing user with the username admin
and password admin
that has access to all APIs.
In order to add a new user, please use the following API:
POST /api/users
{
"username": "secondAdmin",
"password": "password",
"enabled": true,
"roles": [
{ "name" : "OWNER_ADMIN" }
]
}