Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/delineaxpm/dsv-sdk-java

A Java SDK for Delinea DevOps Secrets Vault
https://github.com/delineaxpm/dsv-sdk-java

delinea dsv java thycotic

Last synced: 12 days ago
JSON representation

A Java SDK for Delinea DevOps Secrets Vault

Awesome Lists containing this project

README

        

# The Delinea Secrets Java SDK

![Deploy](https://github.com/DelineaXPM/dsv-sdk-java/workflows/Deploy/badge.svg)

The [Delinea](https://delinea.com/)
[DevOps Secrets Vault](https://delinea.com/products/devops-secrets-management-vault)
(DSV) Java SDK contains classes that interact with the DSV via the REST API.

The SDK contains an API based the [Spring Framework](https://spring.io/projects/spring-framework)
[RestTemplate](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html),
and a simple application based on [Spring Boot](https://spring.io/projects/spring-boot),
that calls the API.

## Install into your application

You can use this SDk in your application by adding the following dependency:

```xml

com.delinea.secrets
dsv-sdk-java
1.0

```

## Build locally

### Prerequisites

The SDK builds and runs on Java 8 or later.

Apache [Maven](https://maven.apache.org/) is also required to build the SDK.

Maven runs unit and integration tests during the build so the settings in
`src/main/resources/application.properties` must be configured before the build
will succeed.

### Settings

The API needs a `tenant` to create request URLs that refer to it.

```ini
secrets_vault.tenant = mytenant
```

It authenticates to DSV using a `client_id` and `client_secret`.

```ini
secrets_vault.client_id = 359f8c9f-d555-40ff-a036-ce95432e708b
secrets_vault.client_secret = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

The API assumes a the top-level domain (TLD) of _com_ but it can be overridden:

```ini
secrets_vault.tld = eu
```

The base URL template itself can also be explicitly set:

```ini
secrets_vault.base_url_template = https://%s.secretsvaultcloud.%s/v1
```

Note that the template must contain two _conversion specifiers_ for `.tenant` and
`.base_url_tld` respectively.

## Run the jar

The SDK example application gets a secret from DSV by it's `path`. The path can
be set as a proper

```ini
secret.path = path/to/secret
```

After the SDK application settings are configured the jar can be built:

```bash
mvn package
```

The build runs the SDK application, however, the it also produces an executable
jar capable of accepting properties set via the command-line.

For example:

```bash
java -jar target/dsv-sdk-java-1.0-SNAPSHOT-exec.jar --secret.path=/path/to/a/secret
```

## Use the API

Configure the `SecretsVaultFactoryBean` in the Spring
[ApplicationContext](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/ApplicationContext.html)
then inject a `SecretsVault` where required.

```java
@Autowired
private SecretsVault secretsVault;

public static void main(final String[] args) {
final Secret secret = secretsVault.getSecret("/path/to/secret");

System.out.println(String.format("The password is %s", secret.getData().get("password")));
}
```