Refactor authentication module

Merged
#195 · Created  · Last updated

Merged pull request

Merged in auth-code-refactor (pull request #195)

4e89571·Author: ·Closed by: ·2020-07-16

Description

Rather than add functions onto an object and referring to the functions via this I’ve split it out into normal functions and calling them directly. I then re-export them by specifying the module exports explicitly.

I also took out extractJwtFromRequest to be outside of the authenticate function so it’s a bit easier to comprehend what’s happening. Having functions defined inside functions makes it a bit difficult to understand where the variables are coming from.

The point where I want to get to is to be able to refactor this code so that I could call a function that only returns the VerifiedParams. My use-case is that I’m using apollo-server and I need to verify the request manually. Currently, I have my own modified authentication.js code that does this but would be great if I could get this inside ACE so I don’t need to maintain my own copy.

Since I’m in no rush as I have something working, I want to create smallish PRs so that things are a bit easier to review.

0 attachments

0 comments

Loading commits...