Search in sources :

Example 1 with BaseMappingException

use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.

the class StatusCheckerDaily method processInt.

/**
 * Gather periodically site and server status
 *
 * @param when
 *            Date
 * @param interval
 *            Interval
 */
private void processInt() {
    log.debug("Starting daily status checker");
    AppConfiguration appConfiguration = configurationFactory.getAppConfiguration();
    if (!appConfiguration.isUpdateApplianceStatus()) {
        return;
    }
    GluuAppliance appliance;
    try {
        appliance = applianceService.getAppliance();
    } catch (BaseMappingException ex) {
        log.error("Failed to load current appliance", ex);
        return;
    }
    // Set LDAP attributes
    setLdapAttributes(appliance);
    Date currentDateTime = new Date();
    appliance.setLastUpdate(currentDateTime);
    try {
        applianceService.updateAppliance(appliance);
    } catch (BaseMappingException ex) {
        log.error("Failed to update current appliance", ex);
        return;
    }
    if (centralLdapService.isUseCentralServer()) {
        try {
            GluuAppliance tmpAppliance = new GluuAppliance();
            tmpAppliance.setDn(appliance.getDn());
            boolean existAppliance = centralLdapService.containsAppliance(tmpAppliance);
            if (existAppliance) {
                centralLdapService.updateAppliance(appliance);
            } else {
                centralLdapService.addAppliance(appliance);
            }
        } catch (BaseMappingException ex) {
            log.error("Failed to update appliance at central server", ex);
            return;
        }
    }
    log.debug("Daily Appliance status update finished");
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) AppConfiguration(org.xdi.config.oxtrust.AppConfiguration) Date(java.util.Date)

Example 2 with BaseMappingException

use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.

the class UpdateClientAction method add.

public String add() throws Exception {
    if (this.client != null) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    this.update = false;
    this.client = new OxAuthClient();
    try {
        this.loginUris = getNonEmptyStringList(client.getOxAuthRedirectURIs());
        this.logoutUris = getNonEmptyStringList(client.getOxAuthPostLogoutRedirectURIs());
        this.clientlogoutUris = getNonEmptyStringList(client.getLogoutUri());
        this.scopes = getInitialScopeDisplayNameEntiries();
        this.responseTypes = getInitialResponseTypes();
        this.grantTypes = getInitialGrantTypes();
        this.contacts = getNonEmptyStringList(client.getContacts());
        this.defaultAcrValues = getNonEmptyStringList(client.getDefaultAcrValues());
        this.requestUris = getNonEmptyStringList(client.getRequestUris());
        this.authorizedOrigins = getNonEmptyStringList(client.getAuthorizedOrigins());
        this.claimRedirectURIList = getNonEmptyStringList(client.getClaimRedirectURI());
    } catch (BaseMappingException ex) {
        log.error("Failed to prepare lists", ex);
        facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to add new client");
        conversationService.endConversation();
        return OxTrustConstants.RESULT_FAILURE;
    }
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) OxAuthClient(org.gluu.oxtrust.model.OxAuthClient)

Example 3 with BaseMappingException

use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.

the class UpdateOrganizationAction method modifyOrganization.

private String modifyOrganization() {
    if (this.organization != null) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    try {
        GluuOrganization tmpOrganization = organizationService.getOrganization();
        this.organization = new GluuOrganization();
        // Clone shared instance
        try {
            PropertyUtils.copyProperties(this.organization, tmpOrganization);
        } catch (Exception ex) {
            log.error("Failed to load organization", ex);
            this.organization = null;
        }
    } catch (BaseMappingException ex) {
        log.error("Failed to load organization", ex);
    }
    if (this.organization == null) {
        return OxTrustConstants.RESULT_FAILURE;
    }
    initLogoImage();
    initFaviconImage();
    this.loginPageCustomMessage = organizationService.getOrganizationCustomMessage(OxTrustConstants.CUSTOM_MESSAGE_LOGIN_PAGE);
    this.welcomePageCustomMessage = organizationService.getOrganizationCustomMessage(OxTrustConstants.CUSTOM_MESSAGE_WELCOME_PAGE);
    this.welcomeTitleText = organizationService.getOrganizationCustomMessage(OxTrustConstants.CUSTOM_MESSAGE_TITLE_TEXT);
    initOxAuthSetting();
    appliances = new ArrayList<GluuAppliance>();
    try {
        appliances.addAll(applianceService.getAppliances());
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) GluuAppliance(org.gluu.oxtrust.model.GluuAppliance) GluuOrganization(org.gluu.oxtrust.model.GluuOrganization) BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) ParseException(java.text.ParseException) IOException(java.io.IOException)

Example 4 with BaseMappingException

use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.

the class UpdatePersonAction method update.

/**
 * Initializes attributes for updating person
 *
 * @return String describing success of the operation
 * @throws Exception
 */
public String update() {
    if (this.person != null) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    this.update = true;
    try {
        this.person = personService.getPersonByInum(inum);
    } catch (BaseMappingException ex) {
        log.error("Failed to find person {}", inum, ex);
        facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to find person");
        conversationService.endConversation();
        return OxTrustConstants.RESULT_FAILURE;
    }
    initAttributes(false);
    try {
        this.gluuStatus = this.person.getStatus();
        List<String> oxexternal = this.person.getOxExternalUid();
        externalAuthCustomAttributes = new ArrayList<String>();
        if (oxexternal != null && oxexternal.size() > 0) {
            for (String oxexternalStr : oxexternal) {
                String[] args = oxexternalStr.split(":");
                externalAuthCustomAttributes.add(args[0]);
            }
        }
        List<GluuCustomFidoDevice> gluuCustomFidoDevices = fidoDeviceService.searchFidoDevices(this.person.getInum(), null);
        deviceDataMap = new ArrayList<GluuDeviceDataBean>();
        if (gluuCustomFidoDevices != null) {
            for (GluuCustomFidoDevice gluuCustomFidoDevice : gluuCustomFidoDevices) {
                GluuDeviceDataBean gluuDeviceDataBean = new GluuDeviceDataBean();
                gluuDeviceDataBean.setCreationDate(ldapEntryManager.decodeGeneralizedTime(gluuCustomFidoDevice.getCreationDate()).toGMTString());
                gluuDeviceDataBean.setId(gluuCustomFidoDevice.getId());
                String devicedata = gluuCustomFidoDevice.getDeviceData();
                String modality = "";
                String nickName = "";
                if (devicedata != null) {
                    DeviceData deviceData = getDeviceata(devicedata);
                    // nickName = deviceData.getName();
                    nickName = gluuCustomFidoDevice.getNickname();
                    modality = "Super-Gluu Device";
                } else {
                    // nickName = "U2F";
                    nickName = gluuCustomFidoDevice.getNickname();
                    modality = "U2F device";
                }
                gluuDeviceDataBean.setNickName(nickName);
                gluuDeviceDataBean.setModality(modality);
                deviceDataMap.add(gluuDeviceDataBean);
            }
        }
        if (oxexternal != null && oxexternal.size() > 0) {
            for (String oxexternalStr : oxexternal) {
                String[] args = oxexternalStr.split(":");
                GluuDeviceDataBean gluuDeviceDataBean = new GluuDeviceDataBean();
                gluuDeviceDataBean.setNickName(args[0]);
                gluuDeviceDataBean.setModality(args[0]);
                gluuDeviceDataBean.setId(oxexternalStr);
                deviceDataMap.add(gluuDeviceDataBean);
            }
        }
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    userPasswordAction.setPerson(this.person);
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) GluuDeviceDataBean(org.gluu.oxtrust.model.fido.GluuDeviceDataBean) GluuCustomFidoDevice(org.gluu.oxtrust.model.fido.GluuCustomFidoDevice) DeviceData(org.xdi.oxauth.model.fido.u2f.protocol.DeviceData) BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) JsonParseException(org.codehaus.jackson.JsonParseException)

Example 5 with BaseMappingException

use of org.gluu.persist.exception.mapping.BaseMappingException in project oxTrust by GluuFederation.

the class UpdateScopeAction method searchAvailableDynamicScripts.

public void searchAvailableDynamicScripts() {
    if (this.availableDynamicScripts != null) {
        selectAddedDynamicScripts();
        return;
    }
    try {
        List<CustomScript> availableScripts = customScriptService.findCustomScripts(Arrays.asList(CustomScriptType.DYNAMIC_SCOPE), CUSTOM_SCRIPT_RETURN_ATTRIBUTES);
        List<SelectableEntity<CustomScript>> tmpAvailableDynamicScripts = new ArrayList<SelectableEntity<CustomScript>>();
        for (CustomScript dynamicScript : availableScripts) {
            if (dynamicScript.isEnabled()) {
                tmpAvailableDynamicScripts.add(new SelectableEntity<CustomScript>(dynamicScript));
            }
        }
        this.availableDynamicScripts = tmpAvailableDynamicScripts;
        selectAddedDynamicScripts();
    } catch (BaseMappingException ex) {
        log.error("Failed to find available authorization policies", ex);
    }
}
Also used : BaseMappingException(org.gluu.persist.exception.mapping.BaseMappingException) CustomScript(org.xdi.model.custom.script.model.CustomScript) SelectableEntity(org.xdi.model.SelectableEntity) ArrayList(java.util.ArrayList)

Aggregations

BaseMappingException (org.gluu.persist.exception.mapping.BaseMappingException)29 IOException (java.io.IOException)7 ArrayList (java.util.ArrayList)6 GluuAppliance (org.gluu.oxtrust.model.GluuAppliance)5 GluuSAMLTrustRelationship (org.gluu.oxtrust.model.GluuSAMLTrustRelationship)4 Date (java.util.Date)3 OxAuthClient (org.gluu.oxtrust.model.OxAuthClient)3 LdapEntryManager (org.gluu.persist.ldap.impl.LdapEntryManager)3 CustomScript (org.xdi.model.custom.script.model.CustomScript)3 CertificateEncodingException (java.security.cert.CertificateEncodingException)2 ParseException (java.text.ParseException)2 JsonParseException (org.codehaus.jackson.JsonParseException)2 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)2 GluuCustomAttribute (org.gluu.oxtrust.model.GluuCustomAttribute)2 GluuStatus (org.gluu.persist.model.base.GluuStatus)2 AppConfiguration (org.xdi.config.oxtrust.AppConfiguration)2 SelectableEntity (org.xdi.model.SelectableEntity)2 UmaScopeDescription (org.xdi.oxauth.model.uma.persistence.UmaScopeDescription)2 LDAPConnection (com.unboundid.ldap.sdk.LDAPConnection)1 LDAPException (com.unboundid.ldap.sdk.LDAPException)1