This repository contains all the code for the Spring Data Elasticsearch tutorial, illustrating the JHipster support for the Elasticsearch engine in Spring Boot applications.
Prerequisites:
To install this example, first clone this repository:
git clone https://github.com/indiepopart/spring-data-elasticsearch.git
cd spring-data-elasticsearch
With OktaCLI, register for a free developer account:
okta register
Provide the required information. Once you complete the registration, create the OIDC client applications.
cd spring-data-elasticsearch
okta apps create jhipster
You will be prompted to select the following options:
- Application name: spring-data-elasticsearch
- Redirect URI: http://localhost:8080/login/oauth2/code/oidc,http://localhost:8081/login/oauth2/code/oidc,http://localhost:8761/login/oauth2/code/oidc
- Post Logout Redirect URI: http://localhost:8080,http://localhost:8081,http://localhost:8761
The OktaCLI will create the client application and configure the issuer, clientId and clientSecret in an .okta.env
file in the application root folder.
In the blog
and gateway
root, generate the application container image with the following Maven command:
./mvnw -DskipTests -ntp -Pprod verify jib:dockerBuild
Edit the file docker-compose/central-server-config/application.yml
and replace the placeholders with the values from .okta.env
:
spring:
security:
oauth2:
client:
provider:
oidc:
issuer-uri: https://{yourOktaDomain}/oauth2/default
registration:
oidc:
client-id: {clientId}
client-secret: {clientSecret}
Go to the docker folder and run the services with Docker Compose:
cd docker-compose
docker compose up
Once the services are up, go to http://localhost:8080 and login with your Okta credentials.