@@ -659,6 +659,30 @@ KeyManagerUtils.addIdentityRoute(keyManager, "client-alias-one", "https://localh
659659// Override existing routes
660660KeyManagerUtils.overrideIdentityRoute(keyManager, "client-alias-two", "https://localhost:9463/", "https://localhost:9473/")
661661```
662+ ##### Managing additional identities at runtime
663+ Please beware when using multiple identities from a keystore. The alias name from the key entry within the keystore should be unique across all the identities.
664+ ``` text
665+ SSLFactory sslFactory = SSLFactory.builder()
666+ .withInflatableIdentityMaterial()
667+ .withIdentityMaterial(Paths.get("/path/to/your/identity-1.jks"), "password".toCharArray())
668+ .withTrustMaterial("truststore.jks", password)
669+ .withIdentityRoute("client-alias-one", "https://localhost:8443/", "https://localhost:8453/")
670+ .build();
671+
672+ X509ExtendedKeyManager keyManager = sslFactory.getKeyManager().get();
673+
674+ // Adding identity and an additional route
675+ KeyStore identityTwo = KeyStoreUtils.loadKeyStore(Paths.get("/path/to/your/identity-2.jks"), "password".toCharArray());
676+ KeyManagerUtils.addIdentityMaterial(keyManager, "client-alias-two", identityTwo, "password".toCharArray());
677+ KeyManagerUtils.addIdentityRoute(keyManager, "client-alias-two", "https://localhost:8463/", "https://localhost:8473/");
678+
679+ // Getting existing list of aliases from the inflatable key manager
680+ List<String> aliases = KeyManagerUtils.getAliases(keyManager);
681+
682+ // Removing identity
683+ KeyManagerUtils.removeIdentityMaterial(keyManager, "client-alias-two");
684+ KeyManagerUtils.removeIdentityRoute(keyManager, "client-alias-two");
685+ ```
662686##### Managing ssl session
663687``` text
664688SSLFactory sslFactory = SSLFactory.builder()
0 commit comments