EYBlockchain / nightfall_3

a mono-repo containing an optimistic version of nightfall
Creative Commons Zero v1.0 Universal
263 stars 56 forks source link

Adding authentication layer #1360

Closed israelboudoux closed 1 year ago

israelboudoux commented 1 year ago

What does this implement/fix? Explain your changes.

This authentication layer is something good to have that can be used by any of the microservices, it just needed to set the AUTHENTICATION_KEY environment variable with the API Key desired, which will be used to authenticate requests against the X-API-Key header. The env var ENDPOINTS_WHITELISTED can be used to whitelist endpoints - it may contain a comma-separated-list of endpoints and is able to accept regex. At the moment this capability is configured only for nightfall-client, since it is likely that a deployer/enterprise wants to use this layer to protect the application endpoints.

This change implies changes in SDK so that the calls can be authenticated.

Does this close any currently open issues?

No

What commands can I run to test the change?

A new test was added to Github Action

Any other comments?

No

daveroga commented 1 year ago

LGTM! Just one more thing about nf3.test.mjs : we could close the user instance at the end of each test with await nf3User.close(). raised_hands

I agree with @imagobea