set up hlaeja JWT

This commit is contained in:
2025-01-17 13:17:33 +01:00
parent d97502bcf8
commit 410cbd2b21
7 changed files with 37 additions and 0 deletions

View File

@@ -17,6 +17,10 @@ tab_width = 2
[*.bat]
end_of_line = crlf
[*.{cer,pem}]
max_line_length = 64
insert_final_newline = false
# noinspection EditorConfigKeyCorrectness
[*.{kt,kts}]
ij_kotlin_packages_to_use_import_on_demand = unset

3
.gitignore vendored
View File

@@ -38,3 +38,6 @@ out/
### Kotlin ###
.kotlin
#### Hlæja ###
/cert/

View File

@@ -7,6 +7,7 @@ In realms of connectedness, where devices roam free, A nexus of management, harm
| name | required | info |
|------------------------|:--------:|-------------------------|
| spring.profiles.active | ✓ | Spring Boot environment |
| jwt.public-key | ✓ | JWT public key file |
*Required: ✓ can be stored as text, and ✗ need to be stored as secret.*
@@ -16,6 +17,12 @@ Run `release.sh` script from `master` branch.
## Development Information
### Public RSA Key
This service uses the public key from **[Hlæja Account Register](https://github.com/swordsteel/hlaeja-account-registry)** to identify users. To set up user identification for local development, copy the `public_key.pem` file from the `./cert` directory in **Hlæja Account Register** into the `./cert` directory of this project.
*Note: For more information on generating RSA keys, please refer to our [generate RSA key](https://github.com/swordsteel/hlaeja-development/blob/master/doc/rsa_key.md) documentation.*
### Global Setting
The following global settings are used in Hlaeja Device Registry. You can configure these settings using either Gradle properties or alternatively environment variables.

View File

@@ -1,6 +1,7 @@
plugins {
alias(hlaeja.plugins.kotlin.jvm)
alias(hlaeja.plugins.kotlin.spring)
alias(hlaeja.plugins.ltd.hlaeja.plugin.certificate)
alias(hlaeja.plugins.ltd.hlaeja.plugin.service)
alias(hlaeja.plugins.spring.dependency.management)
alias(hlaeja.plugins.springframework.boot)
@@ -8,9 +9,11 @@ plugins {
dependencies {
implementation(hlaeja.fasterxml.jackson.module.kotlin)
implementation(hlaeja.jjwt.api)
implementation(hlaeja.kotlin.logging)
implementation(hlaeja.kotlin.reflect)
implementation(hlaeja.kotlinx.coroutines)
implementation(hlaeja.library.hlaeja.jwt)
implementation(hlaeja.projectreactor.kotlin.reactor.extensions)
implementation(hlaeja.springboot.starter.actuator)
implementation(hlaeja.springboot.starter.security)
@@ -28,3 +31,9 @@ dependencies {
}
group = "ltd.lulz"
tasks {
named("processResources") {
dependsOn("copyCertificates")
}
}

View File

@@ -23,6 +23,9 @@ management:
info:
enabled: true
jwt:
public-key: cert/public_key.pem
---
###############################
### Development environment ###

View File

@@ -0,0 +1,2 @@
jwt:
public-key: cert/valid-public-key.pem

View File

@@ -0,0 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3ZdlbISX729m5Ur1pVhg
XIvazcgUt0T0G32ML0tfwQ4aWTfwPII0SQRThaN6eiiBMRa0V8JMih1LT8JmGgst
dEx2nhMbVs/Osu8MhmP86c+HB/jPa1+0IR1TZKXoZoF52D2ZtoVf+mOWggAcm1R+
V0Fj2cR/pgLkVt3GKUE2OokFC1iFUQFjThd1EzKcOv53TUek8FY8t66npQ4t3unD
bXZKoGXMuXCqZVykMbGTUQFRuT3NAOXRrJP+UDeY2uM2Yk98J+8FtLDYD6jpmyi0
ghv6k8pK1w1n5NI3atVv5ZMUeQZ36AXL8SZi1105mamhLVQ0e0JixoMOPh7ziFyv
uwIDAQAB
-----END PUBLIC KEY-----