Skip to content

Siddhesh202/Auth_Service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auth microservice

AUTHSERVICE DOCUMENTATION

This micro-service mainly focusses on the authorization and authentication of the Users that are sending request for signup and signin in the following service.

Additional Features:

  • deleting an User account
  • finding whether an User is admin or not

DB DESIGNS

  • Databases required

    • User
    • Role
    • UserRoles
    • AirplaneAuthorities
  • Design of the Databases

    • Users Table (or User Model)

      • id (created by sequelize automatically)
      • email
      • password
      • createdAt (created by sequelize automatically)
      • updatedAt (created by sequelize automatically)
    • Roles Table (or Role Model)

      • id (created by sequelize automatically)
      • name
      • createdAt (created by sequelize automatically)
      • updatedAt (created by sequelize automatically)
    • UserRoles Table : used as a through - table to create MANY-TO-MANY associations between tables Users and Roles.

    • AirplaneAuthorities Table (or AirplaneAuthority Model)

      • id (created by sequelize automatically)
      • name
      • domainName
      • createdAt (created by sequelize automatically)
      • updatedAt (created by sequelize automatically)

DB Design image


APIs exposed and its corresponding URLS

For signup
Request Format (to be sent in body) (json):

{
 "email": <YOUR_EMAILID>,
 "password": <YOUR_PASSWORD>
}
  • Creates a User with the given email-id and password. The password is encrypted using the npm package bcrypt.
  • As soon as the user is created it allots a role to the user based upon the Domain-name in email-id. For example,
    • if the email is of the form xxxxxx@admin.xxx then it allots an admin role.
    • if the email is of the form xxxxxx@<AIRPLANE_AUTHORITY>.xxx then it allots a role of Airplane Authority.
    • for all other cases, it allots a role of customer to the user.

For signin
Request format (to be sent in body) (json):

{
 "email": <YOUR_EMAILID>,
 "password": <YOUR_PASSWORD>
}
  • On successfull signin, a token (valid for 96 hrs or 4 days) is given which the user should save for further use during flight booking or any other activities which may require it.

For deleting an user
Request format (to be sent in body) (json):

{
 "email": <YOUR_EMAILID>,
 "password": <YOUR_PASSWORD>,
 "token": <YOUR_TOKEN>
}
  • Successfull deletion resuslts in removal of allotted user role.

For checking Admin rights
Request format (to be sent in body) (json):

{
    "userId": <INTEGER_USERID> 
}
  • Returns whether the corresponding user is an admin or not.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published