set up jwt
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -38,3 +38,6 @@ out/
|
||||
|
||||
### Kotlin ###
|
||||
.kotlin
|
||||
|
||||
### Cert ###
|
||||
/keys/
|
||||
|
||||
25
README.md
25
README.md
@@ -7,9 +7,10 @@ Classes crafted, identities bestowed, Each device recorded, their functions unfo
|
||||
| name | required | info |
|
||||
|------------------------|----------|-------------------------|
|
||||
| spring.profiles.active | * | Spring Boot environment |
|
||||
| spring.r2dbc.url | * | Postgreas host url |
|
||||
| spring.r2dbc.username | * | Postgreas username |
|
||||
| spring.r2dbc.password | ** | Postgreas password |
|
||||
| spring.r2dbc.url | * | Postgres host url |
|
||||
| spring.r2dbc.username | * | Postgres username |
|
||||
| spring.r2dbc.password | ** | Postgres password |
|
||||
| jwt.private-key | | JWT private cert |
|
||||
|
||||
Required: * can be stored as text, and ** need to be stored as secret.
|
||||
|
||||
@@ -17,7 +18,23 @@ Required: * can be stored as text, and ** need to be stored as secret.
|
||||
|
||||
Run `release.sh` script from `master` branch.
|
||||
|
||||
## Development Configuration
|
||||
## Development Information
|
||||
|
||||
### Generate Private and Public RSA Key
|
||||
|
||||
OpenSSL Project is dedicated to providing a simple installation of OpenSSL for Microsoft Windows. [Download](https://slproweb.com/products/Win32OpenSSL.html)
|
||||
|
||||
Generate an RSA private key, of size 2048, and output it to a file named `private_key.pem` in to `./keys`
|
||||
|
||||
```shell
|
||||
openssl genrsa -out private_key.pem 2048
|
||||
```
|
||||
|
||||
Extract the public key from `private_key.pem` from `./keys`, and output it to a file named `public_key.pem` in to `./keys`
|
||||
|
||||
```shell
|
||||
openssl rsa -in private_key.pem -pubout -out public_key.pem
|
||||
```
|
||||
|
||||
### Global gradle properties
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ plugins {
|
||||
|
||||
dependencies {
|
||||
implementation(hlaeja.com.fasterxml.jackson.module.kotlin)
|
||||
implementation(hlaeja.jjwt.api)
|
||||
implementation(hlaeja.kotlin.logging)
|
||||
implementation(hlaeja.kotlin.reflect)
|
||||
implementation(hlaeja.kotlinx.coroutines)
|
||||
@@ -16,6 +17,8 @@ dependencies {
|
||||
implementation(hlaeja.org.springframework.springboot.r2dbc.starter)
|
||||
implementation(hlaeja.org.springframework.springboot.webflux.starter)
|
||||
|
||||
runtimeOnly(hlaeja.jjwt.impl)
|
||||
runtimeOnly(hlaeja.jjwt.jackson)
|
||||
runtimeOnly(hlaeja.org.postgresql)
|
||||
runtimeOnly(hlaeja.org.postgresql.r2dbc)
|
||||
|
||||
@@ -30,3 +33,15 @@ dependencies {
|
||||
}
|
||||
|
||||
group = "ltd.hlaeja"
|
||||
|
||||
tasks {
|
||||
named("processResources") {
|
||||
dependsOn("copyPrivateKey")
|
||||
}
|
||||
register<Copy>("copyPrivateKey") {
|
||||
group = "hlaeja"
|
||||
from("keys/private_key.pem")
|
||||
into("${layout.buildDirectory.get()}/resources/main/keys")
|
||||
onlyIf { file("keys/private_key.pem").exists() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
"name": "spring.application.build.os.version",
|
||||
"type": "java.lang.String",
|
||||
"description": "Application build os version."
|
||||
},
|
||||
{
|
||||
"name": "jwt.private-key",
|
||||
"type": "java.lang.String",
|
||||
"description": "Jwt private key file."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ spring:
|
||||
name: "%APP_BUILD_OS_NAME%"
|
||||
version: "%APP_BUILD_OS_VERSION%"
|
||||
|
||||
jwt:
|
||||
private-key: keys/private_key.pem
|
||||
|
||||
---
|
||||
###############################
|
||||
### Development environment ###
|
||||
|
||||
8
src/test/resources/application.yml
Normal file
8
src/test/resources/application.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
jwt:
|
||||
private-key: keys/valid-private-key.pem
|
||||
|
||||
spring:
|
||||
r2dbc:
|
||||
url: r2dbc:postgresql://placeholder
|
||||
username: placeholder
|
||||
password: placeholder
|
||||
Reference in New Issue
Block a user