use of org.wso2.carbon.user.core.listener.UserOperationEventListener in project carbon-identity-framework by wso2.
the class IdentityUserNameResolverListener method doPostGetUserListOfRoleWithID.
@Override
public boolean doPostGetUserListOfRoleWithID(String roleName, List<User> userList, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
List<String> returnUserNamesList = userList.stream().map(User::getUsername).collect(Collectors.toList());
String[] returnUserNames = returnUserNamesList.toArray(new String[0]);
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!listener.doPostGetUserListOfRole(roleName, returnUserNames, 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 doPreDeleteUserWithID.
@Override
public boolean doPreDeleteUserWithID(String userID, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String userName = getUserNameFromUserID(userID, (AbstractUserStoreManager) userStoreManager);
if (userName == null) {
return handleUserNameResolveFailure(userID, userStoreManager);
}
// Setting the thread-local to keep userName for doPostDeleteUserWithID listener.
IdentityUtil.threadLocalProperties.get().put(DO_PRE_DELETE_USER_USER_NAME, userName);
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!listener.doPreDeleteUser(userName, 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 doPreAuthenticateWithID.
@Override
public boolean doPreAuthenticateWithID(String preferredUserNameClaim, String preferredUserNameValue, Object credential, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String userName;
String[] users = userStoreManager.getUserList(preferredUserNameClaim, preferredUserNameValue, null);
if (users.length == 1) {
userName = UserCoreUtil.removeDomainFromName(users[0]);
} else {
return true;
}
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!listener.doPreAuthenticate(userName, credential, 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 doPostAuthenticateWithID.
@Override
public boolean doPostAuthenticateWithID(List<LoginIdentifier> loginIdentifiers, AuthenticationResult authenticationResult, UserStoreManager userStoreManager) throws UserStoreException {
if (!isEnable()) {
return true;
}
String userName;
boolean authenticated = authenticationResult.getAuthenticationStatus() == AuthenticationResult.AuthenticationStatus.SUCCESS;
if (authenticated) {
userName = authenticationResult.getAuthenticatedUser().get().getUsername();
} else {
return true;
}
for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
if (isNotAResolverListener(listener)) {
if (!listener.doPostAuthenticate(userName, authenticated, 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 doPostUpdateUserListOfInternalRoleWithID.
@Override
public boolean doPostUpdateUserListOfInternalRoleWithID(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.doPostUpdateUserListOfInternalRole(roleName, deletedUserNames, newUserNames, userStoreManager)) {
return false;
}
}
}
return true;
}
Aggregations