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 readme doc issues of jca #215

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,39 @@ jdk 11.0.12 or above
```
1. Get the azure-security-keyvault-jca.jar. You can download the latest published jar from maven
repository [azure-security-keyvault-jca](https://mvnrepository.com/artifact/com.azure/azure-security-keyvault-jca). When this document is
written, the latest jar is azure-security-keyvault-jca.2.2.0.jar
written, the latest jar is azure-security-keyvault-jca-2.6.0.jar
1. Make a directory, for example, sample_client. Then put the 3 files into sample_client folder
- java.security
- run-with-command-line-client-1.0.0.jar
- azure-security-keyvault-jca-2.1.0.jar
- run-with-command-line-client-side-1.0.0.jar
- azure-security-keyvault-jca-2.6.0.jar
1. Open terminal and enter the directory sample_client, run the following command:
```
java \
--module-path ./azure-security-keyvault-jca-2.1.0.jar \
--add-modules com.azure.security.keyvault.jca \
--module-path ./azure-security-keyvault-jca-2.6.0.jar \
--add-modules com.azure.security.keyvault.jca \
-Dsecurity.overridePropertiesFile=true \
-Djava.security.properties==./java.security \
-Djavax.net.ssl.trustStoreType=AzureKeyVault \
-Djava.security.properties==./java.security \
-Djavax.net.ssl.trustStoreType=AzureKeyVault \
-Dazure.keyvault.uri=<yourKeyVaultURI> \
-Dazure.keyvault.tenant-id=<yourTenantID> \
-Dazure.keyvault.client-id=<yourClientID> \
-Dazure.keyvault.client-secret=<yourSecretValue> \
-Dazure.keyvault.client-secret=<yourSecretValue> \
-jar run-with-command-line-client-side-1.0.0.jar
```
If you have run the server side with client authentication needed, please use the following
command instead of the above to run the client side:
```
java \
--module-path ./azure-security-keyvault-jca-2.1.0.jar \
--add-modules com.azure.security.keyvault.jca \
--module-path ./azure-security-keyvault-jca-2.6.0.jar \
--add-modules com.azure.security.keyvault.jca \
-Dsecurity.overridePropertiesFile=true \
-Djava.security.properties==./java.security \
-Djavax.net.ssl.trustStoreType=AzureKeyVault \
-Djava.security.properties==./java.security \
-Djavax.net.ssl.trustStoreType=AzureKeyVault \
-Djavax.net.ssl.keyStoreType=AzureKeyVault \
-Dazure.keyvault.uri=<yourKeyVaultURI> \
-Dazure.keyvault.tenant-id=<yourTenantID> \
-Dazure.keyvault.client-id=<yourClientID> \
-Dazure.keyvault.client-secret=<yourSecretValue> \
-Dazure.keyvault.client-secret=<yourSecretValue> \
-jar run-with-command-line-client-side-1.0.0.jar
```
1. Check the output. The client will be started and connect to the server side after a while, you
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,29 @@ jdk 11.0.12 or above
```
1. Get the azure-security-keyvault-jca.jar. You can download the latest published jar from maven
repository [azure-security-keyvault-jca]. When this document is written, the latest jar is
azure-security-keyvault-jca.2.2.0.jar
1. Make a directory, for example, sample_client. Then put the 3 files into sample_client folder
azure-security-keyvault-jca-2.6.0.jar
1. Make a directory, for example, sample_server. Then put the 3 files into sample_server folder
- java.security
- run-with-command-line-client-1.0.0.jar
- azure-security-keyvault-jca-2.1.0.jar
- run-with-command-line-server-side-1.0.0.jar
- azure-security-keyvault-jca-2.6.0.jar
1. Open terminal and enter the directory sample_server, run the following command:
```
java\
--module-path ./azure-security-keyvault-jca-2.1.0.jar \
--module-path ./azure-security-keyvault-jca-2.6.0.jar \
--add-modules com.azure.security.keyvault.jca \
-Dsecurity.overridePropertiesFile=true \
-Djava.security.properties==./java.security \
-Dazure.keyvault.uri=<yourAzureKeyVaultUri> \
-Dazure.keyvault.tenant-id=<yourTenantID> \
-Dazure.keyvault.client-id=<youClientID> \
-Dazure.keyvault.client-secret=<yourSecretValue> \
-jar run-with-command-line-server-side-1.0.0.jar \
-jar run-with-command-line-server-side-1.0.0.jar \
--server.port=8443 \
--server.ssl.enabled=true \
--server.ssl.key-alias=<yourCertificatName> \
--server.ssl.keystore-type=DKS \
--server.ssl.keyStoreProvider=AzureKeyVault \
--server.ssl.key-store=classpath:keyvault.dummy
--server.ssl.key-store=classpath:keyvault.dummy
```
1. Check the output. The server will be started after a while without needing client side
authentication, you can visit https://localhost:8443 and see "Hello World!". If you want to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ This sample should work together with [azure-spring-boot-sample-keyvault-certifi
```
source script/setup.sh
```
2. Option 2 - If you created the resource via the Azure Portal, you need configure the application.yml manually, please replace the placeholders with the resources you created.
2. Option 2 - If you created the resource via the Azure Portal, you need configure the application.yml manually, please replace the placeholders with the resources you created.
> Attention: The service principal must be configured with permissions:
> Certificate Permissions: configure with **get and list** permissions.
> Key Permissions: configure with **get** permission.
> Secret Permissions: configure with **get** permission.

#### Using TLS with service principal created via App registration.
1. Start azure-spring-boot-sample-keyvault-certificates-client-side's SampleApplication by running command:
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ You can also create resources manually via Azure Portal. Please follow:
- If you cannot use managed identity, you can register your application with AAD, see [register app with AAD][register_app_with_AAD]. The registration also creates a second application object that identifies your app.
2. Create the key vault and certificates. Please refer to [create key vault and certificates][create_key_vault_and_certificates]
3. Make the key vault accessible to your service principal. Please refer to [assign key vault access policy][assign_key_vault_access_policy]
4. You need manually configure the application.yml, replace the placeholders with the resources you created in the Azure Portal.
> Attention: The service principal must be configured with permissions:
> Certificate Permissions: configure with **get and list** permissions.
> Key Permissions: configure with **get** permission.
> Secret Permissions: configure with **get** permission.
5. You need manually configure the application.yml, replace the placeholders with the resources you created in the Azure Portal.

If you used the script to create the resources, or you created the resources via Azure Portal and created the Service Principal in App Registration way.
### Run sample Using TLS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ if [ ${SERVICE_PRINCIPAL_NAME} ];then
sed -i 's#export SERVICE_PRINCIPAL_TETANT=#&'"$SERVICE_PRINCIPAL_TETANT"'#' script/export_environment_variables_of_created_resource.sh

az keyvault set-policy --name ${KEY_VAULT_NAME} --certificate-permission get list \
--key-permission get list \
--secret-permission get list \
--key-permission get \
--secret-permission get \
--spn ${SERVICE_PRINCIPAL_ID} \
--resource-group ${RESOURCE_GROUP_NAME}
fi
Expand Down