Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxlambrecht/java-spiffe-examples
A bunch of example apps using java-spiffe library.
https://github.com/maxlambrecht/java-spiffe-examples
Last synced: 18 days ago
JSON representation
A bunch of example apps using java-spiffe library.
- Host: GitHub
- URL: https://github.com/maxlambrecht/java-spiffe-examples
- Owner: maxlambrecht
- License: apache-2.0
- Created: 2020-08-27T11:41:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-20T18:28:49.000Z (about 1 year ago)
- Last Synced: 2024-10-15T08:11:35.145Z (2 months ago)
- Language: Java
- Homepage: https://github.com/spiffe/java-spiffe
- Size: 467 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-spiffe-spire - Java SPIFFE examples
README
# Java SPIFFE examples
A bunch of [java-spiffe](https://github.com/spiffe/java-spiffe) use examples
## Before running the examples
To run the examples, a SPIRE Server and Agent need to be running.
### Run SPIRE
Download the latest SPIRE from [releases github page](https://github.com/spiffe/spire/releases) and extract the tar file.
Copy the content of [spire/conf](spire/conf) in the SPIRE conf folder.
#### Run SPIRE Server
In a terminal in the SPIRE root folder run:
```
./spire-server run
```#### Create SPIRE Registration Entry
```
./spire-server entry create -parentID spiffe://example.org/host -spiffeID spiffe://example.org/myservice -ttl 300 -selector unix:uid:1000
```Change the UID to the UID of the user you will use to run the examples.
For the sake of simplicity the example uses the same identity (`myservice`) for both the frontend and backend apps.
#### Run SPIRE Agent
Create a join token:
```
TOKEN=$(./spire-server token generate -spiffeID spiffe://example.org/host | awk -F'Token: ' '{print $2}')
```Start the agent using the join token to connect to the server:
```
./spire-agent run -joinToken $TOKEN
```#### Define environment variable to point to Socket Endpoint
```
export SPIFFE_ENDPOINT_SOCKET=unix:/tmp/agent.sock
```This environment variable is used by the java-spiffe library as a default socket endpoint address to connect to the SPIRE Agent.