Skip to content

Refine auth credentials refresh flow#187

Merged
kravets-levko merged 1 commit intomainfrom
refactor-auth-refresh-flow
Oct 2, 2023
Merged

Refine auth credentials refresh flow#187
kravets-levko merged 1 commit intomainfrom
refactor-auth-refresh-flow

Conversation

@kravets-levko
Copy link
Copy Markdown
Contributor

Some of our auth providers (currently OAuth) support automatic credentials update (when token expires it can request a new one). And before each request to server we should request credentials from auth provider and pass it with the request. While we were using a HttpConnection from thrift library it was hard to implement the desired behavior because HttpConnection didn't support updating its options. So we were re-creating it when auth credentials change, which was a bit ugly (even if it worked).

But with our new custom HttpConnection class added in #183 it became possible to just update headers, without recreating connection or Thrift client objects, and without doing any dirty-checks or whatever. The amount of changes probably looks too large, but it fixes the whole flow and makes it working in a straightforward way

This PR is also a spin-off of #174

Signed-off-by: Levko Kravets <levko.ne@gmail.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Files Coverage Δ
lib/connection/auth/DatabricksOAuth/index.ts 93.75% <ø> (ø)
lib/connection/auth/PlainHttpAuthentication.ts 100.00% <ø> (ø)
lib/connection/connections/ThriftHttpConnection.ts 60.00% <100.00%> (+0.74%) ⬆️
lib/utils/index.ts 100.00% <100.00%> (ø)
lib/connection/connections/HttpConnection.ts 95.45% <92.30%> (+1.33%) ⬆️
lib/DBSQLClient.ts 86.30% <66.66%> (-1.66%) ⬇️

📢 Thoughts on this report? Let us know!.

Copy link
Copy Markdown
Contributor

@nithinkdb nithinkdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Didn't go too in depth though, so would be good to get someone else's signoff as well.

@kravets-levko kravets-levko merged commit 46c3586 into main Oct 2, 2023
@kravets-levko kravets-levko deleted the refactor-auth-refresh-flow branch October 2, 2023 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants