Search in sources :

Example 1 with IdPManagementDAO

use of org.wso2.carbon.idp.mgt.dao.IdPManagementDAO in project carbon-identity-framework by wso2.

the class IdPManagementServiceComponent method activate.

@Activate
protected void activate(ComponentContext ctxt) {
    try {
        BundleContext bundleCtx = ctxt.getBundleContext();
        TenantManagementListener idPMgtTenantMgtListener = new TenantManagementListener();
        ServiceRegistration tenantMgtListenerSR = bundleCtx.registerService(TenantMgtListener.class.getName(), idPMgtTenantMgtListener, null);
        if (tenantMgtListenerSR != null) {
            log.debug("Identity Provider Management - TenantMgtListener registered");
        } else {
            log.error("Identity Provider Management - TenantMgtListener could not be registered");
        }
        ServiceRegistration userOperationListenerSR = bundleCtx.registerService(UserOperationEventListener.class.getName(), new UserStoreListener(), null);
        if (userOperationListenerSR != null) {
            log.debug("Identity Provider Management - UserOperationEventListener registered");
        } else {
            log.error("Identity Provider Management - UserOperationEventListener could not be registered");
        }
        ServiceRegistration auditLoggerSR = bundleCtx.registerService(IdentityProviderMgtListener.class.getName(), new IDPMgtAuditLogger(), null);
        if (auditLoggerSR != null) {
            log.debug("Identity Provider Management - Audit Logger registered");
        } else {
            log.error("Identity Provider Management - Error while registering Audit Logger");
        }
        ServiceRegistration idPNameResolverListener = bundleCtx.registerService(IdentityProviderMgtListener.class.getName(), new IdentityProviderNameResolverListener(), null);
        if (idPNameResolverListener != null) {
            if (log.isDebugEnabled()) {
                log.debug("Identity Provider Name Resolver Listener registered.");
            }
        } else {
            log.error("Identity Provider Management - Error while registering Identity Provider Name Resolver " + "Listener.");
        }
        setIdentityProviderMgtListenerService(new IdPMgtValidationListener());
        CacheBackedIdPMgtDAO dao = new CacheBackedIdPMgtDAO(new IdPManagementDAO());
        if (dao.getIdPByName(null, IdentityApplicationConstants.RESIDENT_IDP_RESERVED_NAME, IdentityTenantUtil.getTenantId(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME), MultitenantConstants.SUPER_TENANT_DOMAIN_NAME) == null) {
            addSuperTenantIdp();
        }
        bundleCtx.registerService(IdpManager.class, IdentityProviderManager.getInstance(), null);
        ServiceRegistration idpClaimMetadataMgtListener = bundleCtx.registerService(ClaimMetadataMgtListener.class.getName(), new IdentityProviderClaimMgtListener(), null);
        if (idpClaimMetadataMgtListener != null) {
            if (log.isDebugEnabled()) {
                log.debug("Identity Provider Claim Metadata Management Listener registered.");
            }
        } else {
            log.error("Identity Provider Management - Error while registering Identity Provider Claim Metadata " + "Management Listener.");
        }
        buildFileBasedIdPList();
        cleanUpRemovedIdps();
        log.debug("Identity Provider Management bundle is activated");
    } catch (Throwable e) {
        log.error("Error while activating Identity Provider Management bundle", e);
    }
}
Also used : IdentityProviderNameResolverListener(org.wso2.carbon.idp.mgt.listener.IdentityProviderNameResolverListener) UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) CacheBackedIdPMgtDAO(org.wso2.carbon.idp.mgt.dao.CacheBackedIdPMgtDAO) IdPManagementDAO(org.wso2.carbon.idp.mgt.dao.IdPManagementDAO) IdentityProviderMgtListener(org.wso2.carbon.idp.mgt.listener.IdentityProviderMgtListener) ClaimMetadataMgtListener(org.wso2.carbon.identity.claim.metadata.mgt.listener.ClaimMetadataMgtListener) TenantMgtListener(org.wso2.carbon.stratos.common.listeners.TenantMgtListener) IdentityProviderClaimMgtListener(org.wso2.carbon.idp.mgt.listener.IdentityProviderClaimMgtListener) IDPMgtAuditLogger(org.wso2.carbon.idp.mgt.listener.IDPMgtAuditLogger) IdPMgtValidationListener(org.wso2.carbon.idp.mgt.listener.IdPMgtValidationListener) BundleContext(org.osgi.framework.BundleContext) ServiceRegistration(org.osgi.framework.ServiceRegistration) Activate(org.osgi.service.component.annotations.Activate)

Example 2 with IdPManagementDAO

use of org.wso2.carbon.idp.mgt.dao.IdPManagementDAO in project carbon-identity-framework by wso2.

the class ApplicationManagementServiceImplTest method addIdentityProviders.

private void addIdentityProviders() throws IdentityProviderManagementException {
    idPManagementDAO = new IdPManagementDAO();
    IdentityProvider idp1 = new IdentityProvider();
    idp1.setIdentityProviderName(IDP_NAME_1);
    IdentityProvider idp2 = new IdentityProvider();
    idp2.setIdentityProviderName(IDP_NAME_2);
    idPManagementDAO.addIdP(idp1, SUPER_TENANT_ID);
    idPManagementDAO.addIdP(idp2, SUPER_TENANT_ID);
}
Also used : IdentityProvider(org.wso2.carbon.identity.application.common.model.IdentityProvider) IdPManagementDAO(org.wso2.carbon.idp.mgt.dao.IdPManagementDAO)

Example 3 with IdPManagementDAO

use of org.wso2.carbon.idp.mgt.dao.IdPManagementDAO in project carbon-identity-framework by wso2.

the class ApplicationManagementServiceImplTest method testGetIdentityProvider.

@Test(dataProvider = "getIdentityProviderDataProvider")
public void testGetIdentityProvider(Object idp, String tenantDomain, int tenantId) throws IdentityApplicationManagementException, IdentityProviderManagementException {
    idPManagementDAO = new IdPManagementDAO();
    idPManagementDAO.addIdP((IdentityProvider) idp, tenantId);
    IdentityProvider identityProvider = applicationManagementService.getIdentityProvider(((IdentityProvider) idp).getIdentityProviderName(), tenantDomain);
    Assert.assertEquals(identityProvider.getIdentityProviderName(), ((IdentityProvider) idp).getIdentityProviderName());
    // Deleting added identity provider.
    idPManagementDAO.deleteIdP(identityProvider.getIdentityProviderName(), tenantId, tenantDomain);
}
Also used : IdentityProvider(org.wso2.carbon.identity.application.common.model.IdentityProvider) IdPManagementDAO(org.wso2.carbon.idp.mgt.dao.IdPManagementDAO) Test(org.testng.annotations.Test)

Example 4 with IdPManagementDAO

use of org.wso2.carbon.idp.mgt.dao.IdPManagementDAO in project carbon-identity-framework by wso2.

the class IdpMgtServiceComponentHolder method addConnectorConfig.

public void addConnectorConfig(ConnectorConfig identityConnectorConfig) throws IdentityProviderManagementException {
    CacheBackedIdPMgtDAO dao = new CacheBackedIdPMgtDAO(new IdPManagementDAO());
    dao.clearIdpCache(IdentityApplicationConstants.RESIDENT_IDP_RESERVED_NAME, IdentityTenantUtil.getTenantId(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME), MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    this.identityConnectorConfigList.add(identityConnectorConfig);
}
Also used : CacheBackedIdPMgtDAO(org.wso2.carbon.idp.mgt.dao.CacheBackedIdPMgtDAO) IdPManagementDAO(org.wso2.carbon.idp.mgt.dao.IdPManagementDAO)

Aggregations

IdPManagementDAO (org.wso2.carbon.idp.mgt.dao.IdPManagementDAO)4 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)2 CacheBackedIdPMgtDAO (org.wso2.carbon.idp.mgt.dao.CacheBackedIdPMgtDAO)2 BundleContext (org.osgi.framework.BundleContext)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1 Activate (org.osgi.service.component.annotations.Activate)1 Test (org.testng.annotations.Test)1 ClaimMetadataMgtListener (org.wso2.carbon.identity.claim.metadata.mgt.listener.ClaimMetadataMgtListener)1 IDPMgtAuditLogger (org.wso2.carbon.idp.mgt.listener.IDPMgtAuditLogger)1 IdPMgtValidationListener (org.wso2.carbon.idp.mgt.listener.IdPMgtValidationListener)1 IdentityProviderClaimMgtListener (org.wso2.carbon.idp.mgt.listener.IdentityProviderClaimMgtListener)1 IdentityProviderMgtListener (org.wso2.carbon.idp.mgt.listener.IdentityProviderMgtListener)1 IdentityProviderNameResolverListener (org.wso2.carbon.idp.mgt.listener.IdentityProviderNameResolverListener)1 TenantMgtListener (org.wso2.carbon.stratos.common.listeners.TenantMgtListener)1 UserOperationEventListener (org.wso2.carbon.user.core.listener.UserOperationEventListener)1