mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 22:43:57 +00:00
bug4811: trim \n off public key output in REST API; add time point to generated SSH public key comment
This commit is contained in:
1 parent
91e3e50ac7
commit
dfebfa60a9
2 files changed
+5
-3
No files matched your search
+3
-2
@@ -226,9 +226,10 @@ implements AwsLandscape<ShardingKey, MetricsT, ProcessT> {
|
||||
final KeyPair keyPair = KeyPair.load(new JSch(), privKey, /* pubkey */ null); // private key is unencrypted so far; public key can be obtained:
|
||||
final String creatorName = principal==null?"":principal.toString();
|
||||
final ByteArrayOutputStream publicKeyBytes = new ByteArrayOutputStream();
|
||||
keyPair.writePublicKey(publicKeyBytes, "public key generated by user "+creatorName);
|
||||
final TimePoint now = TimePoint.now();
|
||||
keyPair.writePublicKey(publicKeyBytes, "public key generated by user "+creatorName+" at "+now);
|
||||
final SSHKeyPair result = new SSHKeyPair(region.getId(), creatorName,
|
||||
TimePoint.now(), keyPairResponse.keyName(), publicKeyBytes.toByteArray(), privKey,
|
||||
now, keyPairResponse.keyName(), publicKeyBytes.toByteArray(), privKey,
|
||||
privateKeyEncryptionPassphrase);
|
||||
addSSHKeyPair(result);
|
||||
return result;
|
||||
|
||||
+2
-1
@@ -19,7 +19,8 @@ public class SSHKeyPairJsonSerializer implements JsonSerializer<SSHKeyPair> {
|
||||
result.put(REGION_ID_FIELD, object.getRegionId());
|
||||
result.put(CREATOR_NAME_FIELD, object.getCreatorName());
|
||||
result.put(CREATION_TIME_MILLIS_FIELD, object.getCreationTime().asMillis());
|
||||
result.put(PUBLIC_KEY_FIELD, object.getPublicKey() == null ? null : new String(object.getPublicKey()));
|
||||
result.put(PUBLIC_KEY_FIELD, object.getPublicKey() == null ? null : new String(object.getPublicKey())
|
||||
.trim().replaceFirst("\n$", ""));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user