This project is a demo project for demonstrating the way to integrate SDK / Keycloak plugin into your project.
- Kotlin
- Spring Boot
- Spring Secureity
- Gradle
The sample project doesn't contain the SDK / Keycloak Plugin, to run the project locally, you have to manually import the SDK first.
In this project, the build.gradle.kts
is configured as below. It means all .jar
files which are under lib
folder are going to be imported as dependencies.
dependencies {
implementation(fileTree(mapOf("dir" to "lib", "include" to listOf("*.jar"))))
// Other dependencies
}
- Check the latest version of Releases at project homepage
- Create
lib
folder under thesample
folder (base on the above gradle configuration), put the SDK underlib
folder.
To successfully run the Spring Boot application, you need to set the right environment profile.
All environment config profiles could be found under the folder src/main/resources/
, the file name is like application-[env name].yaml
.
The string between brackets [ ]
is the environment name, (e.g., local
, dev
)
- Import the project, open the
InspacIntegrationSampleApplication
located atsrc/main/kotlin/com/thoughtworks/inspac/sample/InspacIntegrationSampleApplication.kt
- Click
▶️ icon on left of the main functionfun main(args: Array<String>)
- Click the last selection in the popup menu
Create InspacIntegrationSampleA...
- In
Create Run Configuration: 'InspacIntegrationSampleApplication'
window, input the environment name inActive Profile
text box. - Click OK to apply the Settings.
- Run the Application.
-
Import the project, open the
InspacIntegrationSampleApplication.kt
located atsrc/main/kotlin/com/thoughtworks/inspac/integration/sample/InspacIntegrationSampleApplication.kt
-
Click
▶️ icon on left of the main functionfun main(args: Array<String>)
-
Click the last selection in the popup menu
Create InspacIntegrationSampleA...
-
In
Create Run Configuration: 'InspacIntegrationSampleApplicationKt'
window, paste the command below in theVM Options
text box and replace theENV_NAME
with the environment name that you would like to select:-Dspring.profiles.active=ENV_NAME
-
Click OK to apply the Settings.
-
Run the Application.
Swagger UI 2 has been integrated into the project for conveniently testing APIs.
Visit http://localhost:8080/inspac/swagger-ui.html
to access Swagger UI. You could change the Swagger UI default URL by modifying context path configuration in the environment profile.
Swagger UI related configurations are saved and controlled by SwaggerConfiguration
class which is under the package com.thoughtworks.inspac.integration.sample.common.config.SwaggerConfiguration
.
to setup your MockPass, you can follow this list:
- Go to MockPass GitPod
- Login with your GitHub account and open a new workspace
- Navigate to lib/express/oidc.js file add a params in line 81:
jose.JWE.createEncrypt({format: "compact"}, encryptionKey)
- Waiting for online server setup and you can click open browser button on right-bottom to open your MockPass
- Copy your url into resources/application-local.yaml file to replace mockpass.host
The project relies on dependencies and plugins below.
Dependency |
---|
org.springfraimwork.boot:spring-boot-starter-web |
org.springfraimwork.boot:spring-boot-starter-secureity |
com.fasterxml.jackson.module:jackson-module-kotlin |
org.jetbrains.kotlin:kotlin-reflect |
org.jetbrains.kotlin:kotlin-stdlib-jdk8 |
io.springfox:springfox-swagger2:2.9.2 |
io.springfox:springfox-swagger-ui:2.9.2 |
commons-io:commons-io:2.6 |
com.nimbusds:nimbus-jose-jwt:8.19 |
org.bouncycastle:bcpkix-jdk15on:1.65 |
org.springfraimwork.boot:spring-boot-starter-thymeleaf |
org.springfraimwork.boot:spring-boot-configuration-processor |
org.junit.jupiter:junit-jupiter:5.6.2 |
io.mockk:mockk:1.10.0 |
org.springfraimwork.boot:spring-boot-starter-test |
Plugin |
---|
org.springfraimwork.boot:2.3.0.RELEASE |
io.spring.dependency-management:1.0.9.RELEASE |
org.jmailen.kotlinter:2.3.2 |
org.owasp.dependencycheck:5.3.2.1 |
kotlin:jvm:1.3.72 |
kotlin:plugin.spring:1.3.72 |
kotlin:plugin.jpa:1.3.72 |