use of org.wso2.carbon.idp.mgt.dao.CacheBackedIdPMgtDAO 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);
}
}
use of org.wso2.carbon.idp.mgt.dao.CacheBackedIdPMgtDAO in project carbon-identity-framework by wso2.
the class GraphBasedSequenceHandlerAbstractTest method setUp.
@BeforeMethod
protected void setUp() throws UserStoreException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException, URISyntaxException {
URL root = this.getClass().getClassLoader().getResource(".");
File file = new File(root.getPath());
System.setProperty("carbon.home", file.toString());
resetAuthenticators();
CacheBackedIdPMgtDAO cacheBackedIdPMgtDAO = mock(CacheBackedIdPMgtDAO.class);
Field daoField = IdentityProviderManager.class.getDeclaredField("dao");
daoField.setAccessible(true);
daoField.set(IdentityProviderManager.getInstance(), cacheBackedIdPMgtDAO);
Field configFilePathField = FileBasedConfigurationBuilder.class.getDeclaredField("configFilePath");
configFilePathField.setAccessible(true);
URL url = this.getClass().getResource(APPLICATION_AUTHENTICATION_FILE_NAME);
configFilePathField.set(null, Paths.get(url.toURI()).toString());
}
use of org.wso2.carbon.idp.mgt.dao.CacheBackedIdPMgtDAO 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);
}
Aggregations