use of org.gluu.oxauth.model.config.Conf in project oxAuth by GluuFederation.
the class KeyGeneratorTimer method updateKeysImpl.
private void updateKeysImpl() throws Exception {
log.info("Updating JWKS keys ...");
String dn = configurationFactory.getBaseConfiguration().getString("oxauth_ConfigurationEntryDN");
Conf conf = ldapEntryManager.find(Conf.class, dn);
JSONObject jwks = conf.getWebKeys().toJSONObject();
JSONObject updatedJwks = updateKeys(jwks);
conf.setWebKeys(ServerUtil.createJsonMapper().readValue(updatedJwks.toString(), WebKeysConfiguration.class));
long nextRevision = conf.getRevision() + 1;
conf.setRevision(nextRevision);
ldapEntryManager.merge(conf);
log.info("Updated JWKS successfully");
log.trace("JWKS keys: " + conf.getWebKeys().getKeys().stream().map(JSONWebKey::getKid).collect(Collectors.toList()));
log.trace("KeyStore keys: " + cryptoProvider.getKeys());
}
use of org.gluu.oxauth.model.config.Conf in project oxAuth by GluuFederation.
the class ConfigurationTest method createLatestTestConfInLdapFromFiles.
/*
* Useful test method to get create newest test configuration. It shouldn't
* be used directly for testing.
*/
// @Test
public void createLatestTestConfInLdapFromFiles() throws Exception {
final String prefix = "U:\\own\\project\\oxAuth\\Server\\src\\test\\resources\\conf";
final String errorsFile = prefix + "\\oxauth-errors.json";
final String staticFile = prefix + "\\oxauth-static-conf.json";
final String webKeysFile = prefix + "\\oxauth-web-keys.json";
final String configFile = prefix + "\\oxauth-config.xml";
final String errorsJson = IOUtils.toString(new FileInputStream(errorsFile));
final String staticConfJson = IOUtils.toString(new FileInputStream(staticFile));
final String webKeysJson = IOUtils.toString(new FileInputStream(webKeysFile));
final StaticConfiguration staticConf = ServerUtil.createJsonMapper().readValue(staticConfJson, StaticConfiguration.class);
final ErrorMessages errorConf = ServerUtil.createJsonMapper().readValue(errorsJson, ErrorMessages.class);
final WebKeysConfiguration webKeys = ServerUtil.createJsonMapper().readValue(webKeysJson, WebKeysConfiguration.class);
final AppConfiguration configJson = loadConfFromFile(configFile);
final Conf c = new Conf();
c.setDn("ou=testconfiguration,o=gluu");
c.setDynamic(configJson);
c.setErrors(errorConf);
c.setStatics(staticConf);
c.setWebKeys(webKeys);
ldapEntryManager.persist(c);
}
Aggregations