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

New credentials #2

Merged
merged 12 commits into from
Nov 15, 2023
Merged

New credentials #2

merged 12 commits into from
Nov 15, 2023

Conversation

tonisives
Copy link
Contributor

@tonisives tonisives commented Nov 8, 2023

HMKit can be intialized with either HMKitOAuthCredentials or HMKitPrivateKeyCredentials.

HMKitOAuthCredentials:

    HMKitCredentials credentials = new HMKitOAuthCredentials(
      "client_id",
      "client_secret"
    );

    HMKitConfiguration configuration = new HMKitConfiguration.Builder()
      .credentials(credentials)
      .environment(HMKitFleet.Environment.SANDBOX)
      .build();

    HMKitFleet hmkit = new HMKitFleet(configuration);

HMKitPrivateKeyCredentials

    HMKitCredentials credentials = new HMKitPrivateKeyCredentials(
      "client_id",
      "private_key_json_file_contents"
    );

    HMKitConfiguration configuration = new HMKitConfiguration.Builder()
      .credentials(credentials)
      .environment(HMKitFleet.Environment.SANDBOX)
      .build();

    HMKitFleet hmkit = new HMKitFleet(configuration);

Copy link

codecov bot commented Nov 8, 2023

Welcome to Codecov 🎉

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered ☂️

@slashmili
Copy link
Member

@tonisives what do you think in case of private key credentials, we actually ask for private key and private key id?

    HMKitCredentials credentials = new HMKitPrivateKeyCredentials(
      "client_id",
      "private_key_id",
      "private_key_pem"
    );

@tonisives
Copy link
Contributor Author

@tonisives what do you think in case of private key credentials, we actually ask for private key and private key id?

    HMKitCredentials credentials = new HMKitPrivateKeyCredentials(
      "client_id",
      "private_key_id",
      "private_key_pem"
    );

It might be easier for users to copy/paste the json file contents.
We had a problem where users didn't include the -----BEGIN PRIVATE KEY-----\n part.

But negative is that if we change the json file keys/content then the parsing in hmkit-fleet fails

Either option is fine with me

@slashmili
Copy link
Member

I understand your concern. However I'd say people make mistake and then learn(or read the doc) and use it properly :D

Let's go for explicit configuration and only pass what is needed.

Copy link
Member

@slashmili slashmili left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@tonisives tonisives merged commit 9848b2b into v2 Nov 15, 2023
3 checks passed
@tonisives tonisives deleted the new-credentials branch November 15, 2023 23:58
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.

2 participants