jembi / openhim-core-js

The Open Health Information Mediator core component. OpenHIM Support: Post your query on OpenHIE Discourse using the #openhim tag https://discourse.ohie.org/
http://openhim.org
Mozilla Public License 2.0
69 stars 69 forks source link

PLAT 638 Adjust login wih session and cookies #1180

Closed nour-borgi closed 1 year ago

nour-borgi commented 1 year ago

In this PR:

Now authentication can be done by either "basic" or "local" types. "local" means through the UI with username and password, this will create a session and set cookies in the browser. "basic" means with basic auth either through browser or postman by giving also username and password.

In Mongo, added passport and session tables to store auth info.

codecov[bot] commented 1 year ago

Codecov Report

Merging #1180 (927a69f) into master (5ece1a1) will increase coverage by 1.14%. The diff coverage is 95.34%.

:exclamation: Current head 927a69f differs from pull request most recent head ab76407. Consider uploading reports for the commit ab76407 to get more accurate results

@@            Coverage Diff             @@
##           master    #1180      +/-   ##
==========================================
+ Coverage   85.08%   86.23%   +1.14%     
==========================================
  Files          77       84       +7     
  Lines        5310     5716     +406     
==========================================
+ Hits         4518     4929     +411     
+ Misses        792      787       -5     
Impacted Files Coverage Δ
src/server.js 73.17% <69.23%> (+0.01%) :arrow_up:
src/upgradeDB.js 82.31% <82.75%> (+0.22%) :arrow_up:
src/api/users.js 92.54% <91.93%> (+9.02%) :arrow_up:
src/middleware/sessionStore.js 93.75% <93.75%> (ø)
src/passport.js 96.00% <96.00%> (ø)
src/api/authentication.js 95.60% <96.66%> (-0.13%) :arrow_down:
src/api/transactions.js 90.51% <100.00%> (+0.03%) :arrow_up:
src/koaApi.js 100.00% <100.00%> (ø)
src/model/index.js 100.00% <100.00%> (ø)
src/model/passport.js 100.00% <100.00%> (ø)
... and 7 more

... and 65 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.