(Requires modification for future use)
This package plays role of user-authenticator to be built for the Cloud based E-commerce Platform project.
Prerequisites:
- Create an project on Google Firebase.
- Download credentials for that project. (should be a json file) (Re-name it to
serviceAccountKey.json) - Go to your Firebase Console on Web -> select the project -> select the app.
- Copy the initialization snippet i.e. the json config.
- Save it to a file. Name it
firebase-config.json.
- Replace the appropriate firebase database url.
- Use a token generator to get a firebase token. Use this as Bearer Token when making requests
- Edit
schema.sqlif required in future. Have Postgres docker container up and running ( rundocker-compose up -d)
To start this service, use the docker-compose file in the root of the repository:
For API documentation, go to browser and hit: http://localhost:4050/documentation
You should be able to see a swagger json documentation page.
The main purpose of this service is to provide you with a authenticator for user requests.
These are the models in this service:
-
users- contains all the user related information -
stores- contains all the store related information -
security-groups- contains different access level -
memberships- contains membership of users in the stores -
user-security-groups- contains user access level in thestore -
src/repository- contains the wrapper classes to talk to the database. -
src/utils- contains the utility scripts required in the application (generally contains logger). -
app.js- the server configuration file for the application (changes should be as minimal to this as possible). -
Dockerfile- contains the configuration required to generate docker image for this application. -
registrations- contains a list of the routes to be plugged into the server (should contain all the subfolders ofsrc/endpointsfolder). -
process.json- defines pm2 process to be executed. (don't change this file unless required) -
.authenticationrc- contains system-wide configuration to be used throughout the service. Should be copied to root folder when running locally..authenticationtestrcis used for test environment. -
auth.js- contains setup for firbase admin
elv- we use this package forelv.coalesceto pick the first non-null value out of the list of valueshapi-firebase-auth- to integrate Firebase with Hapi
For more details refer the relevant file in the folders.