use of org.wso2.carbon.identity.base.IdentityRuntimeException in project carbon-identity-framework by wso2.
the class AbstractEventHandler method canHandle.
public boolean canHandle(MessageContext messageContext) throws IdentityRuntimeException {
Event event = ((IdentityEventMessageContext) messageContext).getEvent();
String eventName = event.getEventName();
List<Subscription> subscriptionList = null;
if (configs != null) {
subscriptionList = configs.getSubscriptions();
} else {
return false;
}
if (subscriptionList != null) {
for (Subscription subscription : subscriptionList) {
if (subscription.getSubscriptionName().equals(eventName)) {
return true;
}
}
}
return false;
}
use of org.wso2.carbon.identity.base.IdentityRuntimeException in project carbon-identity-framework by wso2.
the class DatabaseBasedUserStoreDAOImpl method addUserStoreProperties.
private void addUserStoreProperties(String userStoreProperties, String domainName) throws IdentityUserStoreMgtException {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
String errorMessage = "Error occurred while updating the user store properties for " + "the userstore domain:" + domainName + "in the tenant:" + tenantId;
try {
try (Connection connection = IdentityDatabaseUtil.getDBConnection()) {
try (PreparedStatement userStorePrepStmt = connection.prepareStatement(UserStoreMgtDBQueries.STORE_USERSTORE_PROPERTIES)) {
String uuid = String.valueOf(UUID.randomUUID());
userStorePrepStmt.setString(1, uuid);
userStorePrepStmt.setInt(2, tenantId);
setBlobValue(userStoreProperties, userStorePrepStmt, 3);
userStorePrepStmt.setString(4, domainName);
userStorePrepStmt.setString(5, XML);
userStorePrepStmt.setString(6, USERSTORE);
userStorePrepStmt.execute();
if (log.isDebugEnabled()) {
log.debug("The userstore domain:" + domainName + "added for the tenant:" + tenantId);
}
IdentityDatabaseUtil.commitTransaction(connection);
} catch (SQLException e) {
IdentityDatabaseUtil.rollbackTransaction(connection);
throw new IdentityUserStoreMgtException(errorMessage, e);
}
} catch (IOException | SQLException ex) {
throw new IdentityUserStoreMgtException(errorMessage, ex);
}
} catch (IdentityRuntimeException e) {
throw new IdentityUserStoreMgtException("Couldn't get a database connection.", e);
}
}
use of org.wso2.carbon.identity.base.IdentityRuntimeException in project identity-governance by wso2-extensions.
the class ChallengeQuestionManager method deleteChallengeQuestions.
/**
* Delete challenge questions from a tenant registry.
*
* @param challengeQuestions
* @param tenantDomain
* @throws IdentityRecoveryException
*/
public void deleteChallengeQuestions(ChallengeQuestion[] challengeQuestions, String tenantDomain) throws IdentityRecoveryException {
try {
tenantDomain = validateTenantDomain(tenantDomain);
for (ChallengeQuestion question : challengeQuestions) {
if (isChallengeQuestionExists(question, tenantDomain)) {
String questionPath = getQuestionPath(question);
if (StringUtils.isNotEmpty(question.getLocale())) {
String locale = question.getLocale();
resourceMgtService.deleteIdentityResource(questionPath, tenantDomain, locale);
} else {
resourceMgtService.deleteIdentityResource(questionPath, tenantDomain);
}
}
}
} catch (IdentityRuntimeException e) {
log.error("Error deleting challenge quesitons in " + tenantDomain);
throw new IdentityRecoveryException("Error when deleting challenge questions.", e);
}
}
use of org.wso2.carbon.identity.base.IdentityRuntimeException in project identity-governance by wso2-extensions.
the class CodeInvalidationHandler method canHandle.
public boolean canHandle(MessageContext messageContext) throws IdentityRuntimeException {
Event event = ((IdentityEventMessageContext) messageContext).getEvent();
String eventName = event.getEventName();
if (IdentityEventConstants.Event.POST_DELETE_USER.equals(eventName)) {
return true;
}
return false;
}
Aggregations