-
Notifications
You must be signed in to change notification settings - Fork 86
Refactor of oauth
package
#783
Comments
We have created an issue in Pivotal Tracker to manage this: https://www.pivotaltracker.com/story/show/152329490 The labels on this github issue will be updated when the story is started. |
Can we instead split this module into 2 (or 3) smaller ones? |
Well, most of the stuff is indeed The The |
Also, I don't like how the |
@momchil-sap Do we have more work here or can we close the issue? |
Another point here: the Another point for improvement here is to refactor the package in way that it accepts only one type of url. Preferably the uaa url, as the target uaa server in some cases could be not cloud foundry one. |
@martin-d-aleksandrov , makes perfect sense. @hsiliev , there is a lot more work here. I expect this to be an ongoing issue, until we manage to sort all small problems out. (i.e. expect multiple pull request references to this issue) |
The
oauth
package has grown enough to become a mess. I think that we should invest some time to refactor it. Seeing how it is used by many other packages, I don't believe this will be a one-step process. This is why I am creating this issue where the general direction can be discussed and implemented through a series of pull-requests.Currently, the export section of
oauth
looks like this:https://github.com/cloudfoundry-incubator/cf-abacus/blob/ab1b40a2c0eabc0634147a227783743f71f08482/lib/utils/oauth/src/index.js#L492-L501
The functions there are various in nature: from middlewares to assertion functions; from basic-authentication ones to bearer-token ones; from request manipulation to header manipulation to direct token manipulation; all the way to generic tokens.
Not to mention that there is code (
basicStrategy
) that is used only by thecf-abacus-broker
project. In that regard, the code can be considered dead by someone not aware of that project.My idea is to split the
oauth
package into multiple modules, still part of the same package. This will add some level of namespacing and will split the source code into maintainable parts. Some aspects (basic authentication ones) may be split into separate packages.To get a communication started, here is an initial unpolished API idea:
I kind of also would like to separate the functions based on whether they operate on http entities (i.e. express related) or are raw functions working on strings / tokens.
The text was updated successfully, but these errors were encountered: