-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Cosmos Key Credential #4885
Conversation
kushagraThapar
commented
Aug 7, 2019
- 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.
…os Key Credential
…os Key Credential feature
/azp run java-cosmos-tests |
No pipelines are associated with this pull request. |
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this 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.
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientBuilder.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientBuilder.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Outdated
Show resolved
Hide resolved
...microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java
Show resolved
Hide resolved
.../microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/TestConfigurations.java
Show resolved
Hide resolved
There was a problem hiding this 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.
...zure-cosmos/src/main/java/com/azure/data/cosmos/internal/BaseAuthorizationTokenProvider.java
Outdated
Show resolved
Hide resolved
...microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java
Outdated
Show resolved
Hide resolved
...microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientBuilder.java
Show resolved
Hide resolved
...microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java
Show resolved
Hide resolved
There was a problem hiding this 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.
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Outdated
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Outdated
Show resolved
Hide resolved
...microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java
Show resolved
Hide resolved
...zure-cosmos/src/main/java/com/azure/data/cosmos/internal/BaseAuthorizationTokenProvider.java
Outdated
Show resolved
Hide resolved
...zure-cosmos/src/main/java/com/azure/data/cosmos/internal/BaseAuthorizationTokenProvider.java
Show resolved
Hide resolved
There was a problem hiding this 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
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosKeyCredential.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientBuilder.java
Show resolved
Hide resolved
sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientBuilder.java
Show resolved
Hide resolved
@@ -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 |
There was a problem hiding this comment.
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?
...microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java
Show resolved
Hide resolved
* 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")), |
There was a problem hiding this comment.
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?
.../microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/TestConfigurations.java
Show resolved
Hide resolved
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.