Java library for SPIFFE support
Go to file
Max Lambrecht 666766a90f
Enhancements: Example Config File, Default Path, and Error Handling Improvements (#199)
Add default helper config
Improving java-spiffe-helper Runner and Config logic
Improve error handling in java-spiffe-helper
Update README

Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
2024-02-05 09:13:31 -06:00
.github Bump actions/cache from 3 to 4 (#188) 2024-01-22 13:58:35 -08:00
conf Enhancements: Example Config File, Default Path, and Error Handling Improvements (#199) 2024-02-05 09:13:31 -06:00
gradle/wrapper Update to Gradle 8.5 (#201) 2024-01-31 06:56:10 -06:00
java-spiffe-core Bump com.google.protobuf:protoc from 3.23.4 to 3.25.2 (#193) 2024-01-24 09:31:04 -06:00
java-spiffe-helper Enhancements: Example Config File, Default Path, and Error Handling Improvements (#199) 2024-02-05 09:13:31 -06:00
java-spiffe-provider Add mergeServiceFiles to shawdowJar configs (#198) 2024-01-24 17:56:37 -06:00
.gitignore First commit 2018-05-28 12:39:13 -03:00
CHANGELOG.md Prepare release 0.8.4 (#134) 2023-04-14 13:47:26 -05:00
CODEOWNERS Add maintainer to CODEOWNERS file 2020-11-09 17:42:15 -03:00
LICENSE Adding LICENSE 2018-08-22 10:53:38 -03:00
README.md Prepare release 0.8.4 (#134) 2023-04-14 13:47:26 -05:00
build.gradle Bump grpcVersion from 1.61.0 to 1.61.1 (#202) 2024-02-05 09:07:06 -06:00
gradlew Update to Gradle 8.5 (#201) 2024-01-31 06:56:10 -06:00
gradlew.bat Update to Gradle 8.5 (#201) 2024-01-31 06:56:10 -06:00
integration-tests.sh Update SPIRE version for integration tests to 1.5.3 (#105) 2023-01-11 15:26:40 -03:00
lombok.config Adding utility methods for generating x509 certificates for testing purposes. 2020-05-22 09:31:32 -03:00
settings.gradle Aarch64 support (#101) 2023-01-11 14:37:29 -03:00

README.md

Java SPIFFE Library

continuous-integration Coverage Status

Overview

The JAVA-SPIFFE library provides functionality to interact with the Workload API to fetch X.509 and JWT SVIDs and Bundles, and a Java Security Provider implementation to be plugged into the Java Security architecture. This is essentially an X.509-SVID based KeyStore and TrustStore implementation that handles the certificates in memory and receives the updates asynchronously from the Workload API. The KeyStore handles the Certificate chain and Private Key to prove identity in a TLS connection, and the TrustStore handles the trusted bundles (supporting federated bundles) and performs peer's certificate and SPIFFE ID verification.

This library contains three modules:

  • java-spiffe-core: Core functionality to interact with the Workload API, and to process and validate X.509 and JWT SVIDs and bundles.

  • java-spiffe-provider: Java Provider implementation.

  • java-spiffe-helper: Helper to store X.509 SVIDs and Bundles in Java Keystores in disk.

Supports Java 8+

Download

The JARs can be downloaded from Maven Central.

The dependencies can be added to pom.xml

To import the java-spiffe-provider component:

<dependency>
  <groupId>io.spiffe</groupId>
  <artifactId>java-spiffe-provider</artifactId>
  <version>0.8.4</version>
</dependency>

The java-spiffe-provider component imports the java-spiffe-core component.

To just import the java-spiffe-core component:

<dependency>
  <groupId>io.spiffe</groupId>
  <artifactId>java-spiffe-core</artifactId>
  <version>0.8.4</version>
</dependency>

Using Gradle:

Import java-spiffe-provider:

implementation group: 'io.spiffe', name: 'java-spiffe-provider', version: '0.8.4'

Import java-spiffe-core:

implementation group: 'io.spiffe', name: 'java-spiffe-core', version: '0.8.4'

MacOS Support

x86 Architecture

In case run on a osx-x86 architecture, add to your pom.xml:


<dependency>
  <groupId>io.spiffe</groupId>
  <artifactId>grpc-netty-macos</artifactId>
  <version>0.8.4</version>
  <scope>runtime</scope>
</dependency>

Using Gradle:

runtimeOnly group: 'io.spiffe', name: 'grpc-netty-macos', version: '0.8.4'

Aarch64 (M1) Architecture

If you are running the aarch64 architecture (M1 CPUs), add to your pom.xml:


<dependency>
  <groupId>io.spiffe</groupId>
  <artifactId>grpc-netty-macos-aarch64</artifactId>
  <version>0.8.4</version>
  <scope>runtime</scope>
</dependency>

Using Gradle:

runtimeOnly group: 'io.spiffe', name: 'grpc-netty-macos-aarch64', version: '0.8.4'

Caveat: not all OpenJDK distributions are aarch64 native, make sure your JDK is also running natively

Note: java-spiffe-helper artifact

As the java-spiffe-helper artifact is meant to be used as a standalone JAR and not as a Maven dependency, it is not published to Maven Central, but to Github releases, for both Linux and MacOS versions.

Build the JARs

On Linux or MacOS, run:

 $ ./gradlew assemble
 BUILD SUCCESSFUL 

All jar files are placed in build/libs folder.

Jars that include all dependencies

For the module java-spiffe-provider, a fat jar is generated with the classifier -all-[os-classifier].

For the module java-spiffe-helper, a fat jar is generated with the classifier [os-classifier].

Based on the OS where the build is run, the [os-classifier] will be:

  • -linux-x86_64 for Linux
  • -osx-x86_64 for MacOS with x86_64 architecture
  • -osx-aarch64 for MacOS with aarch64 architecture (M1)