use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserIdResolverListener method doPostUpdateUserListOfInternalRole.
@Override
public boolean doPostUpdateUserListOfInternalRole(String roleName, String[] deletedUsers, String[] newUsers, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String[] deletedUserIDs;
try {
deletedUserIDs = getUserIdsFromUserNames(deletedUsers, (AbstractUserStoreManager) userStoreManager);
} catch (UserStoreException e) {
// supported user store.
if (log.isDebugEnabled()) {
log.debug(e.getMessage(), e);
}
return true;
}
String[] newUserIDs;
try {
newUserIDs = getUserIdsFromUserNames(newUsers, (AbstractUserStoreManager) userStoreManager);
} catch (UserStoreException e) {
// supported user store.
if (log.isDebugEnabled()) {
log.debug(e.getMessage(), e);
}
return true;
}
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!((UniqueIDUserOperationEventListener) listener).doPostUpdateUserListOfInternalRoleWithID(roleName, deletedUserIDs, newUserIDs, userStoreManager)) {
return false;
}
}
}
return true;
}
use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserIdResolverListener method doPostGetUsersClaimValues.
@Override
public boolean doPostGetUsersClaimValues(String[] userNames, String[] claims, String profileName, UserClaimSearchEntry[] userClaimSearchEntries, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
List<String> userIDsList = ((AbstractUserStoreManager) userStoreManager).getUserIDsFromUserNames(Arrays.asList(getDomainLessNames(userNames)));
List<String> claimsList = Arrays.asList(claims);
List<UniqueIDUserClaimSearchEntry> uniqueIDUserClaimSearchEntriesList = ((AbstractUserStoreManager) userStoreManager).getUniqueIDUserClaimSearchEntries(userClaimSearchEntries);
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!((UniqueIDUserOperationEventListener) listener).doPostGetUsersClaimValuesWithID(userIDsList, claimsList, profileName, uniqueIDUserClaimSearchEntriesList, userStoreManager)) {
return false;
}
}
}
return true;
}
use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserIdResolverListener method doPreUpdateUserListOfRole.
@Override
public boolean doPreUpdateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String[] deletedUserIDs;
try {
deletedUserIDs = getUserIdsFromUserNames(deletedUsers, (AbstractUserStoreManager) userStoreManager);
} catch (UserStoreException e) {
// supported user store.
if (log.isDebugEnabled()) {
log.debug(e.getMessage(), e);
}
return true;
}
String[] newUserIDs;
try {
newUserIDs = getUserIdsFromUserNames(newUsers, (AbstractUserStoreManager) userStoreManager);
} catch (UserStoreException e) {
// supported user store.
if (log.isDebugEnabled()) {
log.debug(e.getMessage(), e);
}
return true;
}
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!((UniqueIDUserOperationEventListener) listener).doPreUpdateUserListOfRoleWithID(roleName, deletedUserIDs, newUserIDs, userStoreManager)) {
return false;
}
}
}
return true;
}
use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserIdResolverListener method doPostUpdateUserListOfRole.
@Override
public boolean doPostUpdateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String[] deletedUserIDs;
try {
deletedUserIDs = getUserIdsFromUserNames(deletedUsers, (AbstractUserStoreManager) userStoreManager);
} catch (UserStoreException e) {
// supported user store.
if (log.isDebugEnabled()) {
log.debug(e.getMessage(), e);
}
return true;
}
String[] newUserIDs;
try {
newUserIDs = getUserIdsFromUserNames(newUsers, (AbstractUserStoreManager) userStoreManager);
} catch (UserStoreException e) {
// supported user store.
if (log.isDebugEnabled()) {
log.debug(e.getMessage(), e);
}
return true;
}
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!((UniqueIDUserOperationEventListener) listener).doPostUpdateUserListOfRoleWithID(roleName, deletedUserIDs, newUserIDs, userStoreManager)) {
return false;
}
}
}
return true;
}
use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserIdResolverListener method doPostAuthenticate.
@Override
public boolean doPostAuthenticate(String userName, boolean authenticated, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
if (userID == null) {
return handleUserIDResolveFailure(userName, userStoreManager);
}
AuthenticationResult authenticationResult;
if (authenticated) {
authenticationResult = new AuthenticationResult(AuthenticationResult.AuthenticationStatus.SUCCESS);
User user = ((AbstractUserStoreManager) userStoreManager).getUser(userID, userName);
authenticationResult.setAuthenticatedUser(user);
} else {
authenticationResult = new AuthenticationResult(AuthenticationResult.AuthenticationStatus.FAIL);
}
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!((UniqueIDUserOperationEventListener) listener).doPostAuthenticateWithID(userID, authenticationResult, userStoreManager)) {
return false;
}
}
}
return true;
}
Aggregations