rasnesakam / emakas-users

0 stars 0 forks source link

emakas-users

User authentication api made with love and Spring Framework in java

User authentication service simply operates user actions such as authentication and authorization It produces Json Web Tokens for successfull operations.

Run the Application

Before run the application, you need to generate two files in order to configure the app

  1. Create file named application.yml under src/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
  2. Create file named .env inside root directory of project in order to configure database

    DB_PASSWORD=DB_PASSWORD
    DB_NAME=DB_NAME
    DB_USER=DB_USER_NAME
  3. You can create docker image with command:

    docker build -t emakas-users .
  4. After creation, you can start

JWT has this claims

Simple user has these informations in the database

Endpoints and responses

Users

POST: /users/sign-up Register new User

Body:

{
    "uname": "string",
    "password": "string",
    "eMail": "string",
    "name": "string",
    "surname": "string"
}

Response

Response code Description
201 User created successfully
400 Wrong parameters in post body

DELETE: /users/delete/ Delete a user

This request does not need a body Header param:

Response

Response code Description
200 User deleted successfully
400 Wrong parameters in request
404 User cannot be founded