use of org.wso2.carbon.user.core.listener.UserOperationEventListener 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;
}
use of org.wso2.carbon.user.core.listener.UserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserIdResolverListener method doPreDeleteUser.
@Override
public boolean doPreDeleteUser(String userName, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
if (userID == null) {
return handleUserIDResolveFailure(userName, userStoreManager);
}
// Setting the thread-local to keep userID for doPostDeleteUserWithID listener.
IdentityUtil.threadLocalProperties.get().put(DO_PRE_DELETE_USER_USER_ID, userID);
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!((UniqueIDUserOperationEventListener) listener).doPreDeleteUserWithID(userID, userStoreManager)) {
return false;
}
}
}
return true;
}
use of org.wso2.carbon.user.core.listener.UserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserNameResolverListener method doPreUpdateUserListOfRoleWithID.
@Override
public boolean doPreUpdateUserListOfRoleWithID(String roleName, String[] deletedUserIDs, String[] newUserIDs, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String[] deletedUserNames = getUserNamesFromUserIDs(deletedUserIDs, (AbstractUserStoreManager) userStoreManager);
String[] newUserNames = getUserNamesFromUserIDs(newUserIDs, (AbstractUserStoreManager) userStoreManager);
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!listener.doPreUpdateUserListOfRole(roleName, deletedUserNames, newUserNames, userStoreManager)) {
return false;
}
}
}
return true;
}
use of org.wso2.carbon.user.core.listener.UserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserNameResolverListener method doPreUpdateUserListOfInternalRoleWithID.
@Override
public boolean doPreUpdateUserListOfInternalRoleWithID(String roleName, String[] deletedUserIDs, String[] newUserIDs, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String[] deletedUserNames = getUserNamesFromUserIDs(deletedUserIDs, (AbstractUserStoreManager) userStoreManager);
String[] newUserNames = getUserNamesFromUserIDs(newUserIDs, (AbstractUserStoreManager) userStoreManager);
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!listener.doPreUpdateUserListOfInternalRole(roleName, deletedUserNames, newUserNames, userStoreManager)) {
return false;
}
}
}
return true;
}
use of org.wso2.carbon.user.core.listener.UserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserNameResolverListener method doPostGetUsersClaimValuesWithID.
@Override
public boolean doPostGetUsersClaimValuesWithID(List<String> userIDs, List<String> claims, String profileName, List<UniqueIDUserClaimSearchEntry> uniqueIDUserClaimSearchEntries, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
List<String> userNamesList = ((AbstractUserStoreManager) userStoreManager).getUserNamesFromUserIDs(userIDs);
String[] userNames = userNamesList.toArray(new String[0]);
List<UserClaimSearchEntry> userClaimSearchEntries = ((AbstractUserStoreManager) userStoreManager).getUserClaimSearchEntries(uniqueIDUserClaimSearchEntries);
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!listener.doPostGetUsersClaimValues(userNames, claims.toArray(new String[0]), profileName, userClaimSearchEntries.toArray(new UserClaimSearchEntry[0]))) {
return false;
}
}
}
return true;
}
Aggregations