Search in sources :

Example 1 with CIBAEndUserNotificationConfig

use of org.gluu.oxauth.model.configuration.CIBAEndUserNotificationConfig in project oxTrust by GluuFederation.

the class JsonConfigurationAction method getProtectedOxAuthAppConfiguration.

private String getProtectedOxAuthAppConfiguration(String oxAuthAppConfiguration) {
    if (oxAuthAppConfiguration != null) {
        try {
            org.gluu.oxauth.model.configuration.AppConfiguration appConfiguration = jsonService.jsonToObject(oxAuthAppConfiguration, org.gluu.oxauth.model.configuration.AppConfiguration.class);
            // Add missing config if needed
            if (appConfiguration.getCibaEndUserNotificationConfig() == null) {
                appConfiguration.setCibaEndUserNotificationConfig(new CIBAEndUserNotificationConfig());
                appConfiguration.getCibaEndUserNotificationConfig().setNotificationKey("");
            }
            try {
                String decryptedKey = encryptionService.decrypt(appConfiguration.getCibaEndUserNotificationConfig().getNotificationKey());
                appConfiguration.getCibaEndUserNotificationConfig().setNotificationKey(decryptedKey);
            } catch (EncryptionException ex) {
                log.error("Failed to decrypt values in the oxAuth json configuration: '{}'", oxAuthAppConfiguration, ex);
                appConfiguration.getCibaEndUserNotificationConfig().setNotificationKey("");
            }
            return jsonService.objectToJson(appConfiguration);
        } catch (Exception e) {
            log.error("Problems processing oxAuth App configuration file: {}", oxAuthAppConfiguration, e);
            return null;
        }
    }
    return null;
}
Also used : EncryptionException(org.gluu.util.security.StringEncrypter.EncryptionException) CIBAEndUserNotificationConfig(org.gluu.oxauth.model.configuration.CIBAEndUserNotificationConfig) EncryptionException(org.gluu.util.security.StringEncrypter.EncryptionException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 CIBAEndUserNotificationConfig (org.gluu.oxauth.model.configuration.CIBAEndUserNotificationConfig)1 EncryptionException (org.gluu.util.security.StringEncrypter.EncryptionException)1