-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aesthetic clean-up / format OAuth code #7782
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All lgtm, just wanted to clarify my one comment below.
public BaseOAuthFlow(final ConfigRepository configRepository, HttpClient httpClient) { | ||
this(configRepository, httpClient, BaseOAuthFlow::generateRandomState); | ||
} | ||
public abstract class BaseOAuthFlow implements OAuthFlowImplementation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This renaming of these base classes implies abstraction for both OAuth[1] and OAuth2, because we have BaseOAuthFlow
and then BaseOAuth2Flow
that extends it.
Is it the intention (and therefore possible) that BaseOAuthFlow
can be used for OAuth[1] flows? If not, then what is the purpose of distinction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Trello OAuth is the only OAuth 1 for the moment
I am guessing if we have another oauth 1 flow, we'll be able to introduce a BaseOAuth1Flow at that moment to factor whatever common code shared between trello and that new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, yeah agreed with that approach.
What
Cleaning up oauth classes formatting code and renaming the base classes before changing APIs
How
The major change in this PR is that
extractRefreshToken()
is being refactored intoextractOAuthOutput()
which is now always returning a flat map (non-nested) of values.
Then a second separate method
formatOAuthOutput()
is called to handle nesting of OAuth results under "credentials" (or some other node names) if necessary.This method will be refactored in the future to follow some "AuthSpecification" fields in the spec.json instead of being hard-coded in the Flow implementation code.
The renaming of base classes is;