Search in sources :

Example 1 with ErrorMessages

use of org.gluu.oxauth.model.error.ErrorMessages in project oxAuth by GluuFederation.

the class ConfigurationFactory method reloadErrorsFromFile.

private boolean reloadErrorsFromFile() {
    final ErrorMessages errorsFromFile = loadErrorsFromFile();
    if (errorsFromFile != null) {
        log.info("Reloaded errors from file: " + errorsFilePath);
        errorResponseFactory = new ErrorResponseFactory(errorsFromFile, conf);
        return true;
    } else {
        log.error("Failed to load errors from file: " + errorsFilePath);
    }
    return false;
}
Also used : ErrorMessages(org.gluu.oxauth.model.error.ErrorMessages) ErrorResponseFactory(org.gluu.oxauth.model.error.ErrorResponseFactory)

Example 2 with ErrorMessages

use of org.gluu.oxauth.model.error.ErrorMessages in project oxAuth by GluuFederation.

the class ConfSerialization method errorXmlDeserializer.

@Test
public void errorXmlDeserializer() throws IOException {
    final ErrorMessages objFromXml = loadXml("oxauth-errors.xml", ConfSerialization.class);
    Assert.assertNotNull(objFromXml);
    final String jsonStr = ServerUtil.createJsonMapper().writeValueAsString(objFromXml);
    System.out.println(jsonStr);
}
Also used : ErrorMessages(org.gluu.oxauth.model.error.ErrorMessages) Test(org.testng.annotations.Test)

Example 3 with ErrorMessages

use of org.gluu.oxauth.model.error.ErrorMessages in project oxAuth by GluuFederation.

the class ConfSerialization method errorJsonDeserializer.

@Test
public void errorJsonDeserializer() throws IOException {
    final ErrorMessages object = loadJson(new File(CONFIG_FOLDER + "oxauth-errors.json"), ErrorMessages.class);
    Assert.assertTrue(object != null && notEmpty(object.getAuthorize()) && notEmpty(object.getUma()) && notEmpty(object.getUserInfo()) && notEmpty(object.getClientInfo()) && notEmpty(object.getToken()) && notEmpty(object.getEndSession()));
}
Also used : ErrorMessages(org.gluu.oxauth.model.error.ErrorMessages) File(java.io.File) Test(org.testng.annotations.Test)

Example 4 with ErrorMessages

use of org.gluu.oxauth.model.error.ErrorMessages 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);
}
Also used : ErrorMessages(org.gluu.oxauth.model.error.ErrorMessages) WebKeysConfiguration(org.gluu.oxauth.model.config.WebKeysConfiguration) Conf(org.gluu.oxauth.model.config.Conf) AppConfiguration(org.gluu.oxauth.model.configuration.AppConfiguration) StaticConfiguration(org.gluu.oxauth.model.config.StaticConfiguration) FileInputStream(java.io.FileInputStream)

Aggregations

ErrorMessages (org.gluu.oxauth.model.error.ErrorMessages)4 Test (org.testng.annotations.Test)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 Conf (org.gluu.oxauth.model.config.Conf)1 StaticConfiguration (org.gluu.oxauth.model.config.StaticConfiguration)1 WebKeysConfiguration (org.gluu.oxauth.model.config.WebKeysConfiguration)1 AppConfiguration (org.gluu.oxauth.model.configuration.AppConfiguration)1 ErrorResponseFactory (org.gluu.oxauth.model.error.ErrorResponseFactory)1