/** * {@inheritDoc} */ @Override public SSHUserPrivateKey snapshot(SSHUserPrivateKey credentials) { if (credentials instanceof BasicSSHUserPrivateKey) { final PrivateKeySource keySource = ((BasicSSHUserPrivateKey) credentials).getPrivateKeySource(); if (keySource.isSnapshotSource()) { return credentials; } } final Secret passphrase = credentials.getPassphrase(); return new BasicSSHUserPrivateKey(credentials.getScope(), credentials.getId(), credentials.getUsername(), new DirectEntryPrivateKeySource(credentials.getPrivateKeys()), passphrase == null ? null : passphrase.getEncryptedValue(), credentials.getDescription()); } }