OCI Vault

You can use Helidon’s OCI SDK Extension to access OCI Services. This document describes how to use it to access OCI Vault.

Maven Coordinates

To enable OCI Vault add the following dependency to your project’s pom.xml (see Managing Dependencies).

<dependency>
     <groupId>io.helidon.integrations.oci.sdk</groupId>
     <artifactId>helidon-integrations-oci-sdk-cdi</artifactId>
</dependency>
Copied

Then add dependencies on the OCI SDK’s Vault API. Your specific dependencies may differ depending on the OCI SDK features you use.

<dependency>
    <groupId>com.oracle.oci.sdk</groupId>
    <artifactId>oci-java-sdk-vault</artifactId>
</dependency>
<dependency>
    <groupId>com.oracle.oci.sdk</groupId>
    <artifactId>oci-java-sdk-keymanagement</artifactId>
</dependency>
<dependency>
    <groupId>com.oracle.oci.sdk</groupId>
    <artifactId>oci-java-sdk-secrets</artifactId>
</dependency>
Copied

Injecting a Vault client

Once you have Helidon’s OCI extension added to your application you can inject OCI SDK Clients.

Field-injection example
 @Inject
 private Vaults vaults;
Copied
Constructor-injection example
 @Inject
 VaultResource(Secrets secrets, KmsCrypto crypto, Vaults vaults) {
     this.secrets = secrets;
     this.crypto = crypto;
     this.vaults = vaults;
  }
Copied

The extension implements these injection points by creating objects in the singleton scope.

Configuring the Helidon OCI SDK Extension

By default the extension will select and configure an appropriate OCI Authentication Details Provider for you based on your environment. For this reason it is recommended that you configure your environment first and get it working with the OCI CLI before using the Helidon OCI SDK Extension.

For more information see Helidon OCI Extension.

Using the Vault client

Once you have injected OCI Vault objects you can use them as described in: