Skip to main content

Java

Setup

Clone the server

Start by cloning the server repository from GitHub. You can do this by running the following command:

git clone https://github.com/aserto-demo/todo-java-v2

Set up an .env file

Copy the application.properties.example file to application.properties and update the aserto.authorizer.grpc.caCertPath and aserto.directory.grpc.caCertPath to correspond to the path in which Topaz generated your certificates (by default this path will be ${user.home}/.local/share/topaz/certs/grpc-ca.crt, or ${user.home}\AppData\Local\topaz\certs on Windows).

cp src/main/resources/application.properties.example src/main/resources/application.properties

Your application.properties file should look like:

# --- Authorizer configuration
aserto.authorizer.serviceUrl=localhost:8282
aserto.authorization.enabled=true
aserto.authorizer.policyRoot=todoApp
aserto.authorizer.decision=allowed

## Topaz
## This configuration targets a Topaz instance running locally.
aserto.authorizer.insecure=false
aserto.authorizer.grpc.caCertPath=${user.home}/.local/share/topaz/certs/grpc-ca.crt

# --- Directory configuration
aserto.directory.serviceUrl=localhost:9292
aserto.directory.insecure=false

# Topaz directory
aserto.directory.grpc.caCertPath=${user.home}/.local/share/topaz/certs/grpc-ca.crt

# App configuration
logging.level.com.aserto=DEBUG
server.port=3001

# Create the schema on startup
spring.jpa.hibernate.ddl-auto=update

Install dependencies

To install the application dependencies, run the following command:

cd todo-java-v2
mvn clean package

Start the server

java -jar target/todo-java-v2.jar

Next steps

Test your server by using the sample web Todo application.