Skip to content

Commit 94d4018

Browse files
committed
HPI-22073 IAM-10197 IAM-10215 Update here-aaa-java-sdk to support jwt assertions
Signed-off-by: Stanislav Paltis <Stanislav.altis@here.com>
1 parent feb7a3e commit 94d4018

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

here-oauth-client/src/test/java/com/here/account/oauth2/JwtClientAssertionIT.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,26 @@ public void test_clientAssertion_viaIniStream() throws IOException {
490490
String privateKeyValue = props.getProperty(JwtClientAssertionProvider.PRIVATE_KEY_PROPERTY);
491491
String keyId = props.getProperty(JwtClientAssertionProvider.KEY_ID_PROPERTY);
492492

493+
// INI format can't handle multi-line PEM values inline.
494+
// If the private key value is inline PEM content, write it to a temp file first.
495+
String privateKeyRef = privateKeyValue;
496+
File tempKeyFile = null;
497+
if (privateKeyValue.contains("-----BEGIN") || privateKeyValue.contains("MII")) {
498+
tempKeyFile = File.createTempFile("jwt-it-key", ".pem");
499+
tempKeyFile.deleteOnExit();
500+
try (java.io.FileWriter fw = new java.io.FileWriter(tempKeyFile)) {
501+
fw.write(privateKeyValue);
502+
}
503+
privateKeyRef = tempKeyFile.getAbsolutePath();
504+
}
505+
493506
// Build INI content
494507
StringBuilder ini = new StringBuilder();
495508
ini.append("[default]\n");
496509
ini.append("here.token.endpoint.url = ").append(tokenUrl).append("\n");
497510
ini.append("here.auth.method = private_key_jwt\n");
498511
ini.append("here.client.id = ").append(clientId).append("\n");
499-
ini.append("here.private.key = ").append(privateKeyValue).append("\n");
512+
ini.append("here.private.key = ").append(privateKeyRef).append("\n");
500513
if (keyId != null) {
501514
ini.append("here.key.id = ").append(keyId).append("\n");
502515
}

0 commit comments

Comments
 (0)