Skip to content
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

fix(frontend): refactoring AuthServiceClient #6029

Conversation

aditya-radhakrishnan
Copy link
Contributor

@aditya-radhakrishnan aditya-radhakrishnan commented Sep 22, 2022

Summary

Refactors AuthServiceClient to:

  • Create JSON requests using Jackson ObjectMapper to guard against JSON injection
  • Migrate away from using deprecated methods under the Play framework. Note there are a still few left to migrate

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the product PR or Issue related to the DataHub UI/UX label Sep 22, 2022

// TODO: Call getAuthenticatedUser and then generate a session cookie for the UI if the user is authenticated.

final Optional<String> maybeRedirectPath = Optional.ofNullable(ctx().request().getQueryString(AUTH_REDIRECT_URI_PARAM));
final Optional<String> maybeRedirectPath = Optional.ofNullable(request.getQueryString(AUTH_REDIRECT_URI_PARAM));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice - thank you!

.withHttpOnly(false)
.withMaxAge(Duration.of(30, ChronoUnit.DAYS))
.build());
return ok().withSession(createSessionMap(userUrnString, accessToken))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for extracting the common logic!

Copy link
Collaborator

@jjoyce0510 jjoyce0510 left a comment

Choose a reason for hiding this comment

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

Let's wait for CI to pass.

@github-actions
Copy link

Unit Test Results (build & test)

562 tests  ±0   562 ✔️ ±0   12m 50s ⏱️ -8s
139 suites ±0       0 💤 ±0 
139 files   ±0       0 ±0 

Results for commit d9d4839. ± Comparison against base commit 1119173.

@aditya-radhakrishnan aditya-radhakrishnan merged commit d13145e into datahub-project:master Sep 23, 2022
@aditya-radhakrishnan aditya-radhakrishnan deleted the ar--sanitize-json branch September 23, 2022 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR or Issue related to the DataHub UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants