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

Cosmos Key Credential #4885

Merged
merged 4 commits into from
Aug 8, 2019

Conversation

kushagraThapar
Copy link
Member

  • New class CosmosKeyCredential.
  • CosmosClientBuilder takes CosmosKeyCredential.
  • Updating the key in the same instance of CosmosKeyCredential will reflect the update throughout the BaseAuthorizationTokenProvider.
  • RxDocumentClientImpl will wrap the master key in CosmosKeyCredential, if CosmosKeyCredential is not provided to support backward compatibility.

@kushagraThapar
Copy link
Member Author

/azp run java-cosmos-tests

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@kushagraThapar
Copy link
Member Author

/azp run java - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@christopheranderson christopheranderson left a comment

Choose a reason for hiding this comment

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

I have some requested changes to public surface area, but I think implementation/test coverage looks good.

Copy link
Contributor

@moderakh moderakh left a comment

Choose a reason for hiding this comment

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

I have a minor comment on the implementation in the auth token provider, other than that and Chris' comment on public surface API, it looks good to me.

Copy link
Member

@srnagar srnagar left a comment

Choose a reason for hiding this comment

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

Without prior context on Cosmos APIs and client library guidelines, I have added a few comments based on the track 2 API guidelines documented here - https://azure.github.io/azure-sdk/java_design.html

If these don't apply to Cosmos, please ignore my comments.

Copy link
Contributor

@christopheranderson christopheranderson left a comment

Choose a reason for hiding this comment

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

Approved with some nits on javadocs

@@ -136,7 +147,7 @@ TokenResolver getTokenResolver() {

/**
* CREATE a Database if it does not already exist on the service
* The {@link Mono} upon successful completion will contain a single cosmos database response with the
* The {@link Mono} upon successful completion will contain a single cosmos database response with the
Copy link
Member

Choose a reason for hiding this comment

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

Would this read better with the following:

Upon successful complete, a {@link Mono} containing the cosmos database response with the created or existing database will be returned

Potentially remove the statement given that its similar to the @return statement. Also, should cosmos be capitalized given it is the service's name?

* If none of the above is set, emulator endpoint will be used.
*/
public final class TestConfigurations {
// REPLACE MASTER_KEY and HOST with values from your Azure Cosmos DB account.
// The default values are credentials of the local emulator, which are not used in any production environment.
// <!--[SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine")]-->
public static String MASTER_KEY =
System.getProperty("ACCOUNT_KEY",
System.getProperty("ACCOUNT_KEY",
StringUtils.defaultString(Strings.emptyToNull(
System.getenv().get("ACCOUNT_KEY")),
Copy link
Member

Choose a reason for hiding this comment

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

I know this is a testing file but should a different environment variable name be used to reduce chance of collision such as COSMOS_ACCOUNT_KEY?

@kushagraThapar kushagraThapar merged commit 6e13b4a into Azure:master Aug 8, 2019
pull bot referenced this pull request in AzureSDKAutomation/azure-sdk-for-java Aug 8, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
pull bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 8, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
pull bot pushed a commit to test-repo-tih/azure-sdk-for-java that referenced this pull request Aug 8, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 14, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 14, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 14, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 14, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 14, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 14, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-bot-test bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 23, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 24, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 24, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 24, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 24, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 25, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 25, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 25, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 25, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 25, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 25, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 25, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 25, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
openapi-sdkautomation bot pushed a commit to test-repo-billy/azure-sdk-for-java that referenced this pull request Aug 26, 2019
Cosmos Key Credential holds the key credentials, and supports key rotations. User can update the key in CosmosKeyCredential object, and that will be reflected in SDK on the fly.
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.

6 participants