org.wso2.carbon.identity.application.common.IdentityApplicationManagementException Java Examples

The following examples show how to use org.wso2.carbon.identity.application.common.IdentityApplicationManagementException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationTemplateDAOImpl.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isExistingTemplate(String templateName, String tenantDomain)
        throws IdentityApplicationManagementException {

    if (log.isDebugEnabled()) {
        log.debug(String.format("Checking application template exists for name: %s in tenant: %s", templateName,
                tenantDomain));
    }

    JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();
    try {
        Integer count = jdbcTemplate.fetchSingleRecord(IS_SP_TEMPLATE_EXISTS, (resultSet, rowNumber) ->
                        resultSet.getInt(1),
                preparedStatement -> {
                    preparedStatement.setString(1, templateName);
                    preparedStatement.setInt(2, getTenantID(tenantDomain));
                });
        if (count == null) {
            return false;
        }
        return (count > 0);
    } catch (DataAccessException e) {
        throw new IdentityApplicationManagementException(String.format("Error while checking existence of " +
                "application template: %s in tenant: %s", templateName, tenantDomain), e);
    }
}
 
Example #2
Source File: UIBasedConfigurationBuilder.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
public SequenceConfig getSequence(String reqType, String clientId, String tenantDomain)
        throws FrameworkException {

    ApplicationManagementService appInfo = ApplicationManagementService.getInstance();

    // special case for OpenID Connect, these clients are stored as OAuth2 clients
    if ("oidc".equals(reqType)) {
        reqType = "oauth2";
    }

    ServiceProvider serviceProvider;

    try {
        serviceProvider = appInfo.getServiceProviderByClientId(clientId, reqType, tenantDomain);
    } catch (IdentityApplicationManagementException e) {
        throw new FrameworkException(e.getMessage(), e);
    }
    return uiBasedConfigurationLoader.getSequence(serviceProvider, tenantDomain);
}
 
Example #3
Source File: ProvisioningManagementDAO.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * @param dbConnection
 * @param idPName
 * @param tenantId
 * @return
 * @throws SQLException
 * @throws IdentityApplicationManagementException
 */
private int getIdentityProviderIdentifier(Connection dbConnection, String idPName, int tenantId)
        throws SQLException,
        IdentityApplicationManagementException {

    String sqlStmt;
    PreparedStatement prepStmt = null;
    ResultSet rs = null;
    try {
        sqlStmt = IdPManagementConstants.SQLQueries.GET_IDP_ID_BY_NAME_SQL;
        prepStmt = dbConnection.prepareStatement(sqlStmt);
        prepStmt.setInt(1, tenantId);
        prepStmt.setString(2, idPName);
        rs = prepStmt.executeQuery();
        if (rs.next()) {
            return rs.getInt(1);
        } else {
            throw new IdentityApplicationManagementException("Invalid Identity Provider Name " +
                    idPName);
        }
    } finally {
        IdentityApplicationManagementUtil.closeResultSet(rs);
        IdentityApplicationManagementUtil.closeStatement(prepStmt);
    }
}
 
Example #4
Source File: ProvisioningManagementDAO.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * @param dbConnection
 * @param idPId
 * @param connectorType
 * @return
 * @throws SQLException
 * @throws IdentityApplicationManagementException
 */
private int getProvisioningConfigurationIdentifier(Connection dbConnection, int idPId,
                                                   String connectorType) throws SQLException,
        IdentityApplicationManagementException {

    String sqlStmt;
    PreparedStatement prepStmt = null;
    ResultSet rs = null;
    try {
        sqlStmt = IdentityProvisioningConstants.SQLQueries.GET_IDP_PROVISIONING_CONFIG_ID_SQL;
        prepStmt = dbConnection.prepareStatement(sqlStmt);
        prepStmt.setInt(1, idPId);
        prepStmt.setString(2, connectorType);
        rs = prepStmt.executeQuery();
        if (rs.next()) {
            return rs.getInt(1);
        } else {
            throw new IdentityApplicationManagementException("Invalid connector type " +
                    connectorType);
        }
    } finally {
        IdentityApplicationManagementUtil.closeResultSet(rs);
        IdentityApplicationManagementUtil.closeStatement(prepStmt);
    }
}
 
Example #5
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public String exportSPApplicationFromAppID(String applicationId, boolean exportSecrets,
                                           String tenantDomain) throws IdentityApplicationManagementException {

    ApplicationBasicInfo application = getApplicationBasicInfoByResourceId(applicationId, tenantDomain);
    if (application == null) {
        throw buildClientException(APPLICATION_NOT_FOUND, "Application could not be found " +
                "for the provided resourceId: " + applicationId);
    }
    String appName = application.getApplicationName();
    try {
        startTenantFlow(tenantDomain);
        return exportSPApplication(appName, exportSecrets, tenantDomain);
    } finally {
        endTenantFlow();
    }
}
 
Example #6
Source File: DirectoryServerApplicationMgtListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreDeleteApplication(String applicationName, String tenantDomain, String userName)
        throws IdentityApplicationManagementException {

    ApplicationDAO appDAO = ApplicationMgtSystemConfig.getInstance().getApplicationDAO();
    ServiceProvider serviceProvider = appDAO.getApplication(applicationName, tenantDomain);
    if (serviceProvider != null &&
            serviceProvider.getInboundAuthenticationConfig() != null &&
            serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs() != null) {
        InboundAuthenticationRequestConfig[] configs = serviceProvider.getInboundAuthenticationConfig()
                .getInboundAuthenticationRequestConfigs();
        for (InboundAuthenticationRequestConfig config : configs) {
            if (KERBEROS.equalsIgnoreCase(config.getInboundAuthType()) && config.getInboundAuthKey() != null) {
                DirectoryServerManager directoryServerManager = new DirectoryServerManager();
                try {
                    directoryServerManager.removeServer(config.getInboundAuthKey());
                } catch (DirectoryServerManagerException e) {
                    String error = "Error while removing a kerberos: " + config.getInboundAuthKey();
                    throw new IdentityApplicationManagementException(error, e);
                }
                break;
            }
        }
    }
    return true;
}
 
Example #7
Source File: ApplicationManagementAdminService.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * Delete Application
 *
 * @param applicationName Application name
 * @throws org.wso2.carbon.identity.application.common.IdentityApplicationManagementException
 */
public void deleteApplication(String applicationName) throws IdentityApplicationManagementException {

    try {
        if (!ApplicationMgtUtil.isUserAuthorized(applicationName, getUsername())) {
            log.warn("Illegal Access! User " + CarbonContext.getThreadLocalCarbonContext().getUsername() +
                    " does not have access to the application " + applicationName);
            throw new IdentityApplicationManagementException("User not authorized");
        }
        applicationMgtService = ApplicationManagementService.getInstance();
        applicationMgtService.deleteApplication(applicationName, getTenantDomain(), getUsername());
    } catch (IdentityApplicationManagementException ex) {
        String msg = "Error while deleting application: " + applicationName + " for tenant: " + getTenantDomain();
        throw handleException(msg, ex);
    }
}
 
Example #8
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
private void updateSpFromTemplate(ServiceProvider serviceProvider, String tenantDomain,
                                  SpTemplate spTemplate) throws IdentityApplicationManagementException {

    if (spTemplate != null && spTemplate.getContent() != null) {
        ServiceProvider spConfigFromTemplate = unmarshalSP(spTemplate.getContent(), tenantDomain);
        Field[] fieldsSpTemplate = spConfigFromTemplate.getClass().getDeclaredFields();
        for (Field field : fieldsSpTemplate) {
            try {
                Field fieldSpTemplate = spConfigFromTemplate.getClass().getDeclaredField(field.getName());
                fieldSpTemplate.setAccessible(true);
                Object value = fieldSpTemplate.get(spConfigFromTemplate);
                if (value != null && fieldSpTemplate.getAnnotation(XmlElement.class) != null) {
                    Field fieldActualSp = serviceProvider.getClass().getDeclaredField(field.getName());
                    fieldActualSp.setAccessible(true);
                    fieldActualSp.set(serviceProvider, value);
                }
            } catch (IllegalAccessException | NoSuchFieldException e) {
                throw new IdentityApplicationManagementException("Error when updating SP template configurations" +
                        "into the actual service provider");
            }
        }
    }
}
 
Example #9
Source File: ApplicationMgtUtil.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * Rename the registry path node name for a deleted Service provider role.
 *
 * @param oldName
 * @param newName
 * @throws IdentityApplicationManagementException
 */
public static void renameAppPermissionPathNode(String oldName, String newName)
        throws IdentityApplicationManagementException {

    List<ApplicationPermission> loadPermissions = loadPermissions(oldName);
    String newApplicationNode = ApplicationMgtUtil.getApplicationPermissionPath() + PATH_CONSTANT + oldName;
    Registry tenantGovReg = CarbonContext.getThreadLocalCarbonContext().getRegistry(
            RegistryType.USER_GOVERNANCE);
    //creating new application node
    try {
        for (ApplicationPermission applicationPermission : loadPermissions) {
            tenantGovReg.delete(newApplicationNode + PATH_CONSTANT + applicationPermission.getValue());
        }
        tenantGovReg.delete(newApplicationNode);
        Collection permissionNode = tenantGovReg.newCollection();
        permissionNode.setProperty("name", newName);
        newApplicationNode = ApplicationMgtUtil.getApplicationPermissionPath() + PATH_CONSTANT + newName;
        String applicationNode = newApplicationNode;
        tenantGovReg.put(newApplicationNode, permissionNode);
        addPermission(applicationNode, loadPermissions.toArray(new ApplicationPermission[loadPermissions.size()]),
                tenantGovReg);
    } catch (RegistryException e) {
        throw new IdentityApplicationManagementException("Error while renaming permission node "
                + oldName + "to " + newName, e);
    }
}
 
Example #10
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
public ImportResponse importSPApplication(SpFileContent spFileContent, String tenantDomain, String username,
                                          boolean isUpdate) throws IdentityApplicationManagementException {

    if (log.isDebugEnabled()) {
        log.debug("Importing service provider from file " + spFileContent.getFileName());
    }

    ServiceProvider serviceProvider = unmarshalSP(spFileContent, tenantDomain);
    ImportResponse importResponse = importSPApplication(serviceProvider, tenantDomain, username, isUpdate);

    if (log.isDebugEnabled()) {
        log.debug(String.format("Service provider %s@%s created successfully from file %s",
                serviceProvider.getApplicationName(), tenantDomain, spFileContent.getFileName()));
    }

    return importResponse;
}
 
Example #11
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public IdentityProvider[] getAllIdentityProviders(String tenantDomain)
        throws IdentityApplicationManagementException {

    try {
        startTenantFlow(tenantDomain);
        IdentityProviderDAO idpdao = ApplicationMgtSystemConfig.getInstance().getIdentityProviderDAO();
        List<IdentityProvider> fedIdpList = idpdao.getAllIdentityProviders();
        if (fedIdpList != null) {
            return fedIdpList.toArray(new IdentityProvider[fedIdpList.size()]);
        }
        return new IdentityProvider[0];
    } catch (Exception e) {
        String error = "Error occurred while retrieving all Identity Providers" + ". " + e.getMessage();
        throw new IdentityApplicationManagementException(error, e);
    } finally {
        endTenantFlow();
    }
}
 
Example #12
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public String[] getAllLocalClaimUris(String tenantDomain) throws IdentityApplicationManagementException {

    try {
        startTenantFlow(tenantDomain);
        String claimDialect = ApplicationMgtSystemConfig.getInstance().getClaimDialect();
        ClaimMapping[] claimMappings = CarbonContext.getThreadLocalCarbonContext().getUserRealm().getClaimManager()
                .getAllClaimMappings(claimDialect);
        List<String> claimUris = new ArrayList<>();
        for (ClaimMapping claimMap : claimMappings) {
            claimUris.add(claimMap.getClaim().getClaimUri());
        }
        String[] allLocalClaimUris = (claimUris.toArray(new String[claimUris.size()]));
        if (ArrayUtils.isNotEmpty(allLocalClaimUris)) {
            Arrays.sort(allLocalClaimUris);
        }
        return allLocalClaimUris;
    } catch (Exception e) {
        String error = "Error while reading system claims" + ". " + e.getMessage();
        throw new IdentityApplicationManagementException(error, e);
    } finally {
        endTenantFlow();
    }
}
 
Example #13
Source File: IdPManagementUIUtil.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * @param fedIdp
 * @param paramMap
 * @throws IdentityApplicationManagementException
 */
private static void buildClaimConfiguration(IdentityProvider fedIdp,
                                            Map<String, String> paramMap, List<String> idpClaims,
                                            ClaimMapping[] currentClaimMapping)
        throws IdentityApplicationManagementException {

    ClaimConfig claimConfiguration = new ClaimConfig();

    if (idpClaims != null && idpClaims.size() > 0) {
        List<Claim> idPClaimList = new ArrayList<Claim>();
        for (Iterator<String> iterator = idpClaims.iterator(); iterator.hasNext(); ) {
            String claimUri = iterator.next();
            Claim idpClaim = new Claim();
            idpClaim.setClaimUri(claimUri);
            idPClaimList.add(idpClaim);
        }
        claimConfiguration.setIdpClaims(idPClaimList.toArray(new Claim[idPClaimList.size()]));
    }

    claimConfiguration.setUserClaimURI(paramMap.get("user_id_claim_dropdown"));
    claimConfiguration.setRoleClaimURI(paramMap.get("role_claim_dropdown"));

    ClaimConfig claimConfigurationUpdated = claimMappingFromUI(claimConfiguration, paramMap);

    fedIdp.setClaimConfig(claimConfigurationUpdated);
}
 
Example #14
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public SpTemplate getApplicationTemplate(String templateName, String tenantDomain)
        throws IdentityApplicationManagementException {

    String retrievedTemplateName = templateName;
    if (StringUtils.isBlank(retrievedTemplateName)) {
        retrievedTemplateName = ApplicationConstants.TENANT_DEFAULT_SP_TEMPLATE_NAME;
    }

    SpTemplate spTemplate = doGetApplicationTemplate(retrievedTemplateName, tenantDomain);

    if (spTemplate == null) {
        if (StringUtils.isBlank(templateName)) {
            return null;
        } else {
            throw new IdentityApplicationManagementClientException(new String[]{
                    String.format("Template with name: %s is not " + "registered for tenant: %s.",
                            templateName, tenantDomain)});
        }
    }
    return spTemplate;
}
 
Example #15
Source File: CacheBackedApplicationDAO.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
private void addAppBasicInfoToCache(ApplicationBasicInfo appBasicInfo, String tenantDomain) throws
        IdentityApplicationManagementException {

    if (log.isDebugEnabled()) {
        log.debug("Add cache for the application " + appBasicInfo.getApplicationName() + "@" + tenantDomain);
    }
    try {
        ApplicationMgtUtil.startTenantFlow(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);

        ApplicationBasicInfoResourceIdCacheKey key =
                new ApplicationBasicInfoResourceIdCacheKey(appBasicInfo.getApplicationResourceId());
        ApplicationBasicInfoResourceIdCacheEntry entry = new ApplicationBasicInfoResourceIdCacheEntry(appBasicInfo);
        appBasicInfoCacheByResourceId.addToCache(key, entry);
    } finally {
        ApplicationMgtUtil.endTenantFlow();
    }
}
 
Example #16
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Convert service provider object of service provider to xml formatted string
 *
 * @param serviceProvider service provider to be marshaled
 * @param tenantDomain    tenant domain
 * @return xml formatted string of the service provider
 * @throws IdentityApplicationManagementException Identity Application Management Exception
 */
private String marshalSP(ServiceProvider serviceProvider, String tenantDomain)
        throws IdentityApplicationManagementException {

    try {
        JAXBContext jaxbContext = JAXBContext.newInstance(ServiceProvider.class);
        Marshaller marshaller = jaxbContext.createMarshaller();
        DocumentBuilderFactory docBuilderFactory = IdentityUtil.getSecuredDocumentBuilderFactory();
        Document document = docBuilderFactory.newDocumentBuilder().newDocument();
        marshaller.marshal(serviceProvider, document);

        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer = transformerFactory.newTransformer();
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
        transformer.setOutputProperty(OutputKeys.CDATA_SECTION_ELEMENTS,
                "AuthenticationScript inboundConfiguration");

        StringWriter stringBuilder = new StringWriter();
        StreamResult result = new StreamResult(stringBuilder);
        transformer.transform(new DOMSource(document), result);
        return stringBuilder.getBuffer().toString();
    } catch (JAXBException | ParserConfigurationException | TransformerException e) {
        throw new IdentityApplicationManagementException(String.format("Error in exporting Service Provider %s@%s",
                serviceProvider.getApplicationName(), tenantDomain), e);
    }
}
 
Example #17
Source File: OutboundProvisioningManager.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * @param idpName
 * @param connectorType
 * @param provisioningEntity
 * @param tenantDomain
 * @return
 * @throws IdentityApplicationManagementException
 */
private ProvisionedIdentifier getProvisionedEntityIdentifier(String idpName,
                                                             String connectorType,
                                                             ProvisioningEntity provisioningEntity,
                                                             String tenantDomain)
        throws IdentityApplicationManagementException {
    int tenantId = getTenantIdOfDomain(tenantDomain);
    return dao.getProvisionedIdentifier(idpName, connectorType, provisioningEntity, tenantId, tenantDomain);
}
 
Example #18
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
private void deleteApplicationPermission(String applicationName) {

        try {
            ApplicationMgtUtil.deletePermissions(applicationName);
        } catch (IdentityApplicationManagementException e) {
            log.error("Failed to delete the permissions for: " + applicationName, e);
        }
    }
 
Example #19
Source File: ApplicationManagementAdminService.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Validates whether the requested page number for pagination is not zero or negative.
 *
 * @param pageNumber Page number.
 * @throws IdentityApplicationManagementException
 */
private void validateRequestedPageNumber(int pageNumber) throws IdentityApplicationManagementException {

    // Validate whether the page number is not zero or a negative number.
    if (pageNumber < 1) {
        throw new IdentityApplicationManagementException("Invalid page number requested. The page number should " +
                "be a value greater than 0.");
    }
}
 
Example #20
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
private void deleteApplicationRole(String applicationName) {

        try {
            ApplicationMgtUtil.deleteAppRole(applicationName);
        } catch (IdentityApplicationManagementException e) {
            log.error("Failed to delete the application role for: " + applicationName, e);
        }
    }
 
Example #21
Source File: CacheBackedApplicationDAO.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public int getCountOfApplications(String filter) throws IdentityApplicationManagementException {

        if (appDAO instanceof PaginatableFilterableApplicationDAO) {
            return ((PaginatableFilterableApplicationDAO) appDAO).getCountOfApplications(filter);
        } else {
            throw new UnsupportedOperationException("This operation only supported in" +
                    " PaginatableFilterableApplicationDAO only.");
        }
    }
 
Example #22
Source File: DiscoverableApplicationManagerImpl.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Override
public ApplicationBasicInfo getDiscoverableApplicationBasicInfoByResourceId(String resourceId, String
        tenantDomain) throws IdentityApplicationManagementException {

    ApplicationDAO appDAO = ApplicationMgtSystemConfig.getInstance().getApplicationDAO();
    return appDAO.getDiscoverableApplicationBasicInfoByResourceId(resourceId, tenantDomain);
}
 
Example #23
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
private void validateApplicationConfigurations(ServiceProvider application,
                                               String tenantDomain,
                                               String username) throws IdentityApplicationManagementException {

    try {
        applicationMgtValidator.validateSPConfigurations(application, tenantDomain, username);
    } catch (IdentityApplicationManagementValidationException e) {
        String message = "Invalid application configuration for application: '" +
                application.getApplicationName() + "' of tenantDomain: " + tenantDomain + ".";
        String errorCode = INVALID_REQUEST.getCode();
        throw new IdentityApplicationManagementValidationException(errorCode, message, e.getValidationMsg());
    }
}
 
Example #24
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Delete SP template from database and cache.
 *
 * @param templateName template name
 * @param tenantDomain tenant domain
 * @throws IdentityApplicationManagementException
 */
private void doDeleteApplicationTemplate(String templateName, String tenantDomain)
        throws IdentityApplicationManagementException {

    // Delete SP template from database
    ApplicationTemplateDAO applicationTemplateDAO = ApplicationMgtSystemConfig.getInstance()
            .getApplicationTemplateDAO();
    applicationTemplateDAO.deleteApplicationTemplate(templateName, tenantDomain);

    // Delete SP template from cache
    ServiceProviderTemplateCacheKey templateCacheKey = new ServiceProviderTemplateCacheKey(templateName,
            tenantDomain);
    ServiceProviderTemplateCache.getInstance().clearCacheEntry(templateCacheKey);
}
 
Example #25
Source File: ApplicationManagementAdminService.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Import application from XML file from UI.
 *
 * @param spFileContent xml string of the SP and file name
 * @return Created application name
 * @throws IdentityApplicationManagementException Identity Application Management Exception
 */
public ImportResponse importApplication(SpFileContent spFileContent) throws IdentityApplicationManagementException {

    try {
        applicationMgtService = ApplicationManagementService.getInstance();
        return applicationMgtService.importSPApplication(spFileContent, getTenantDomain(), getUsername(), false);
    } catch (IdentityApplicationManagementException ex) {
        String message = "Error while importing application for tenant: " + getTenantDomain();
        throw handleException(message, ex);
    }
}
 
Example #26
Source File: ApplicationManagementAdminService.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Get all local claim uris
 *
 * @return claim uri array
 * @throws org.wso2.carbon.identity.application.common.IdentityApplicationManagementException
 */
@SuppressWarnings("ValidExternallyBoundObject")
public String[] getAllLocalClaimUris() throws IdentityApplicationManagementException {

    try {
        applicationMgtService = ApplicationManagementService.getInstance();
        return applicationMgtService.getAllLocalClaimUris(getTenantDomain());
    } catch (IdentityApplicationManagementException idpException) {
        log.error("Error while retrieving all local claim URIs for tenant: " + getTenantDomain(), idpException);
        throw idpException;

    }
}
 
Example #27
Source File: ApplicationManagementServiceImpl.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Add SP template to database and cache.
 *
 * @param spTemplate   SP template info
 * @param tenantDomain tenant domain
 * @throws IdentityApplicationManagementException
 */
private void doAddApplicationTemplate(SpTemplate spTemplate, String tenantDomain)
        throws IdentityApplicationManagementException {

    // Add application template to database
    ApplicationTemplateDAO applicationTemplateDAO = ApplicationMgtSystemConfig.getInstance()
            .getApplicationTemplateDAO();
    applicationTemplateDAO.createApplicationTemplate(spTemplate, tenantDomain);

    // Add application template to cache
    ServiceProviderTemplateCacheKey templateCacheKey = new ServiceProviderTemplateCacheKey(spTemplate.getName(),
            tenantDomain);
    ServiceProviderTemplateCache.getInstance().addToCache(templateCacheKey, spTemplate);
}
 
Example #28
Source File: DefaultApplicationResourceMgtListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Override
public boolean doPostDeleteApplicationByResourceId(ServiceProvider deletedApplication,
                                                   String applicationResourceId,
                                                   String tenantDomain,
                                                   String userPerformingAction)
        throws IdentityApplicationManagementException {

    for (ApplicationMgtListener listener : ApplicationMgtListenerServiceComponent.getApplicationMgtListeners()) {
        if (listener.isEnable()
                && !listener.doPostDeleteApplication(deletedApplication, tenantDomain, userPerformingAction)) {
            return false;
        }
    }
    return true;
}
 
Example #29
Source File: ProvisioningApplicationMgtListener.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
@Override
public boolean doPreUpdateApplication(ServiceProvider serviceProvider, String tenantDomain, String username)
        throws IdentityApplicationManagementException {
    if (!isEnable()) {
        return true;
    }
    if(log.isDebugEnabled()){
        log.debug("Clearing cache entry for " + serviceProvider.getApplicationName());
    }
    destroySpProvConnectors(serviceProvider.getApplicationName(), tenantDomain);
    return true;
}
 
Example #30
Source File: CacheBackedApplicationDAO.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
public void updateApplication(ServiceProvider serviceProvider, String tenantDomain) throws
        IdentityApplicationManagementException {

    ServiceProvider storedApp = getApplication(serviceProvider.getApplicationID());
    clearAllAppCache(storedApp, tenantDomain);
    appDAO.updateApplication(serviceProvider, tenantDomain);
}