I'm trying to add some post quantum algorithms to Keycloak via custom SPI's and, to do so, I need to modify some core classes (mostly Provider classes) from Keycloak with my code so the system recognizes the new algorithms.
Unfortunately, recompile Keycloak is a toilsome job (that takes a lot of time), therefore modifying core files would make impracticable to run tests and stuff, while developing.
I've been studying Keycloak source files and noticed that the providers I need to modify (apparently) don't implement ProviderFactory interfaces, so (I think) it's not possible to modify these files with a SPI approach.
My questions are: Is it possible to modify such classes without recompiling entire Keycloak? Can I use custom SPI's to fix these problems? Should I try another solution? (I'm kinda out of ideas)
By the way, one of the classes I need to modify is BCPemUtilsProvider and I would like to do something like this:
@Override
protected String encode(Object obj) {
if (obj == null) {
return null;
}
try {
StringWriter writer = new StringWriter();
JcaPEMWriter pemWriter = new JcaPEMWriter(writer);
/**
* MY CODE GOES HERE...
*/
pemWriter.writeObject(obj);
pemWriter.flush();
pemWriter.close();
String s = writer.toString();
return removeBeginEnd(s);
} catch (Exception e) {
throw new PemException(e);
}
}