Skip to content

Conversation

@KarstenSchnitter
Copy link
Contributor

This change extracts all java-jwt dependencies into its own submodule. When running without dynamic log levels this dependency is no longer required. If the JWT-based dynamic log levels are still required, the new Maven module cf-java-logging-support-servelt-dynlog-jwt needs to be added. Extensibility is provided via SPI.

The Spring Boot sample app was changed and demonstrates. how a custom secrets handling can be implemented. It no longer uses compile-time generated key-pairs but reads them from a (user-defined) serivce. If no config is found, it generates a key pair on startup.

This change extracts all java-jwt dependencies into its own submodule.
When running without dynamic log levels this dependency is no longer
required. If the JWT-based dynamic log levels are still required, the new
Maven module `cf-java-logging-support-servelt-dynlog-jwt` needs to be
added. Extensibility is provided via SPI.

The Spring Boot sample app was changed and demonstrates.
how a custom secrets handling can be implemented. It no longer uses
compile-time generated key-pairs but reads them from a (user-defined)
serivce. If no config is found, it generates a key pair on startup.

Signed-off-by: Karsten Schnitter <[email protected]>
@KarstenSchnitter KarstenSchnitter changed the title Extract JWT Imeplementation for Dynamic Log Levels Extract JWT Implementation for Dynamic Log Levels Mar 31, 2025

static String createPublicKeyPem(PublicKey key) {
String encoded = Base64.getEncoder().encodeToString(key.getEncoded());
StringBuilder sb = new StringBuilder("-----BEGIN PUBLIC KEY-----\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
StringBuilder sb = new StringBuilder("-----BEGIN PUBLIC KEY-----\n");
StringBuilder sb = new StringBuilder("-----BEGIN PUBLIC KEY-----").append(System.lineSeparator());

Comment on lines +14 to +15
for (int i = 0; i < encoded.length() / 64 + 1; i++) {
sb.append(encoded, i * 64, Math.min(encoded.length(), (i + 1) * 64)).append("\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (int i = 0; i < encoded.length() / 64 + 1; i++) {
sb.append(encoded, i * 64, Math.min(encoded.length(), (i + 1) * 64)).append("\n");
for (int i = 0; i < encoded.length(); i += 64) {
sb.append(encoded, i, Math.min(i + 64, encoded.length()))
.append(System.lineSeparator());

@juergen-walter juergen-walter self-requested a review April 1, 2025 14:43
@KarstenSchnitter KarstenSchnitter merged commit 2834e74 into SAP:release-4 Apr 9, 2025
2 checks passed
@KarstenSchnitter KarstenSchnitter deleted the release-4 branch April 9, 2025 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants