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

add custom token provider support #2613

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

tnazarew
Copy link
Contributor

@tnazarew tnazarew commented Apr 18, 2024

Problem

OL didn't have a support for custom token providers

Closes: #2542

Solution

TokenProviderTypeIdResolver was added to handle both FQCN and (for backward compatibility) api_key type in spark.openlineage.transport.auth.type

Note: All schema changes require discussion. Please link the issue for context.

  • Your change modifies the core OpenLineage model
  • Your change modifies one or more OpenLineage facets

One-line summary:

Checklist

  • You've signed-off your work
  • Your pull request title follows our guidelines
  • Your changes are accompanied by tests (if relevant)
  • Your change contains a small diff and is self-contained
  • Your comment includes a one-liner for the changelog about the specific purpose of the change (if necessary)
  • You've added a header to source files (if relevant)

SPDX-License-Identifier: Apache-2.0
Copyright 2018-2023 contributors to the OpenLineage project

@boring-cyborg boring-cyborg bot added area:client/java openlineage-java area:integration/spark area:documentation Improvements or additions to documentation labels Apr 18, 2024
Copy link
Contributor

@pawel-big-lebowski pawel-big-lebowski left a comment

Choose a reason for hiding this comment

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

Hi @tnazarew, so happy to see you back here. Thanks for preparing the amazing PR! 🥇


@NoArgsConstructor
@ToString
public class FakeTokenProvider implements TokenProvider {
Copy link
Contributor

Choose a reason for hiding this comment

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

you can try it as static class within ArgumentParserTest if you like

public JavaType typeFromId(DatabindContext context, String id) {
Class<?> subType = null;
if (Objects.equals(id, "api_key")) // backwards compatibility
return context.constructSpecializedType(superType, ApiKeyTokenProvider.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

don't forget our old friend Spotless

Copy link
Contributor Author

Choose a reason for hiding this comment

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

funny thing is, when you forget to put curly brackets after if, spotless doesn't even recognise it as incorrect and spotlessApply changes indentation to what you can see here

@tnazarew tnazarew force-pushed the spark/custom-token-provider-support branch 2 times, most recently from 2d18071 to e14dcb9 Compare April 22, 2024 14:29
Signed-off-by: tnazarew <tomasz.nazarewicz@getindata.com>
Signed-off-by: tnazarew <tomasz.nazarewicz@getindata.com>
@pawel-big-lebowski pawel-big-lebowski force-pushed the spark/custom-token-provider-support branch from 91f5a5b to 5a400cf Compare April 23, 2024 08:05
@pawel-big-lebowski pawel-big-lebowski merged commit 89e6e95 into main Apr 23, 2024
42 checks passed
@pawel-big-lebowski pawel-big-lebowski deleted the spark/custom-token-provider-support branch April 23, 2024 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:client/java openlineage-java area:documentation Improvements or additions to documentation area:integration/spark
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom token provider in Java not working
2 participants