User authentication service simply operates user actions such as authentication and authorization It produces Json Web Tokens for successfull operations.
Before run the application, you need to generate two files in order to configure the app
-
Create file named
application.yml
undersrc/main/resources/
directory and fill it as follows:java-jwt: secret: YOUR SECRET HERE issuer: YOUR ISSUER HERE expiration: EXPIRATION TIMES IN SECONDS spring: datasource: url: jdbc:postgresql://DB_URL/DB_NAME username: DB_USERNAME password: DB_PASSWORD jpa: hibernate: ddl-auto: none properties: hibernate: dialect: org.hibernate.dialect.PostgreSQLDialect
-
Create file named
.env
inside root directory of project in order to configure databaseDB_PASSWORD=DB_PASSWORD DB_NAME=DB_NAME DB_USER=DB_USER_NAME
-
You can create docker image with command:
docker build -t emakas-users .
-
After creation, you can start
- iss: Issuer of this token
- sub: Unified Unique Id for user that requested
- exp: Timestamp of expiration date
- aud: Audience claim that describes which domains will use this token
- id: Unified Unique Identifier that describes user in the database
- uname: A choosen unique username that describes user in the database
- email: Contact mail of the user
- password: Hashed pass code that using for authentication
- name: Name that describes user
- surname: Surname that describes user
- createdTime: The time when user created
- updatedTime: The last time when datas of the user updated
{
"uname": "string",
"password": "string",
"eMail": "string",
"name": "string",
"surname": "string"
}
Response code | Description |
---|---|
201 | User created successfully |
400 | Wrong parameters in post body |
This request does not need a body Header param:
- Authorization: Bearer jwt token that contains id of the user to be deleted
Response code | Description |
---|---|
200 | User deleted successfully |
400 | Wrong parameters in request |
404 | User cannot be founded |