log.info("User: " + scimUser.getUserName() + " is retrieved through SCIM."); return scimUser;
String currentUserName = user.getUserName(); currentUserName = UserCoreUtil.removeDomainFromName(currentUserName); user.setUserName(userName.append(userStoreName) String userStoreDomainName = IdentityUtil.extractDomainFromName(user.getUserName()); if(StringUtils.isNotBlank(userStoreDomainName) && !isSCIMEnabled(userStoreDomainName)){ throw new CharonException("Cannot add user through scim to user store " + ". SCIM is not " + log.debug("Creating user: " + user.getUserName()); if (carbonUM.isExistingUser(user.getUserName())) { String error = "User with the name: " + user.getUserName() + " already exists in the system."; throw new ConflictException(error); carbonUM.addUser(user.getUserName(), user.getPassword(), null, claimsInLocalDialect, null); log.info("User: " + user.getUserName() + " is created through SCIM."); String errMsg = "Error in adding the user: " + user.getUserName() + " to the user store. "; errMsg += e.getMessage(); throw new CharonException(errMsg, e);
log.info("User: " + scimUser.getUserName() + " is retrieved through SCIM.");
@Override public User getUser(String userId, Map<String, Boolean> requiredAttributes) throws CharonException, BadRequestException, NotFoundException { if (log.isDebugEnabled()) { log.debug("Retrieving user: " + userId); } try { org.wso2.carbon.identity.mgt.User userStoreUser = identityStore.getUser(userId); //TODO:We need to pass the scim claim dialect for this method List<Claim> claimList = userStoreUser.getClaims(); //TODO this is a temporary method. need to remove this once the claim management is completed. claimList = ClaimMapper.getInstance().convertToScimDialect(claimList); User scimUser = getSCIMUser(userStoreUser, claimList); if (log.isDebugEnabled()) { log.debug("User: " + scimUser.getUserName() + " is retrieved through SCIM."); } return scimUser; } catch (IdentityStoreException e) { throw new CharonException("Error in getting user from the userid :" + userId, e); } catch (UserNotFoundException e) { throw new NotFoundException("User not found with the given userid :" + userId); } }
try { if (log.isDebugEnabled()) { log.debug("Updating user: " + user.getUserName()); User oldUser = this.getUser(user.getId(), ResourceManagerUtil.getAllAttributeURIs(schema)); if (userStoreDomainFromSP != null && !userStoreDomainFromSP .equalsIgnoreCase(IdentityUtil.extractDomainFromName(oldUser.getUserName()))) { throw new CharonException("User :" + oldUser.getUserName() + "is not belong to user store " + userStoreDomainFromSP + "Hence user updating fail"); !UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME.equalsIgnoreCase(getUserStoreDomainFromSP())) { user.setUserName(IdentityUtil .addDomainToName(UserCoreUtil.removeDomainFromName(user.getUserName()), getUserStoreDomainFromSP())); if (!carbonUM.isExistingUser(user.getUserName())) { throw new CharonException("User name is immutable in carbon user store."); Map<String, String> oldClaimList = carbonUM.getUserClaimValues(user.getUserName(), requiredClaimsInLocalDialect .toArray(new String[requiredClaims.size()]), null); carbonUM.deleteUserClaimValue(user.getUserName(), entry.getKey(), null); carbonUM.setUserClaimValues(user.getUserName(), claimValuesInLocalDialect, null); carbonUM.updateCredentialByAdmin(user.getUserName(), user.getPassword()); log.info("User: " + user.getUserName() + " updated through SCIM."); return getUser(user.getId(),requiredAttributes);
public void deleteUser() throws IdentitySCIMException { String filter = USER_FILTER + ((User) scimObject).getUserName(); List<User> users = (List<User>) (List<?>) listWithGet(null, null, filter, 1, 1, null, null, SCIM2CommonConstants.USER); handleSCIMErrorResponse(response); } else { logger.error("No Users found with userName: " + ((User) scimObject).getUserName());
String userStoreDomain = SCIMCommonUtils.extractDomainFromName(user.getUserName(), identityStore); user.setUserName(SCIMCommonUtils.removeDomainFromName(user.getUserName())); throw new ConflictException("User with the name: " + user.getUserName() + " already exists in the system."); log.debug("User: " + user.getUserName() + " is created through SCIM."); String errMsg = "Error occurred while adding user:" + user.getUserName() + "to user store"; String errMsg = "Error in retrieving newly added user:" + user.getUserName() + " from user store";
@Override public User updateUser(User user, Map<String, Boolean> requiredAttributes) throws NotImplementedException, CharonException, BadRequestException, NotFoundException { try { if (log.isDebugEnabled()) { log.debug("Updating user: " + user.toString()); } //get the claims map from the new scim user object. Map<String, String> claims = SCIMClaimResolver.getClaimsMap(user); //get the claim list to be updated. List<Claim> claimList = getUserBeanFromClaims(claims).getClaims(); //TODO this is a temporary method. need to remove this once the claim management is completed. claimList = ClaimMapper.getInstance().convertMetaToWso2Dialect(claimList); //set user updated claim values identityStore.updateUserClaims(user.getId(), claimList); if (log.isDebugEnabled()) { log.debug("User: " + user.getUserName() + " updated through SCIM."); } //get the updated user from the user core and sent it to client. return this.getUser(user.getId(), requiredAttributes); } catch (UserNotFoundException | NotFoundException e) { throw new NotFoundException("No such user with the user id : " + user.getId()); } catch (IdentityStoreException e) { throw new CharonException("Error in updating the user", e); } }
public void updateUser(String httpMethod) throws IdentitySCIMException { String filter = USER_FILTER + ((User) scimObject).getUserName(); List<User> users = (List<User>) (List<?>) listWithGet(null, null, filter, 1, 1, null, null, SCIM2CommonConstants.USER); logger.error("No Users found with userName: " + ((User) scimObject).getUserName());
Optional<User> user = Optional.ofNullable(getSCIMUser(userId, requiredUserClaims, false)); if (user.isPresent()) { scimGroup.setMember(user.get().getId(), user.get().getUserName()); } else { log.warn("User " + userId + " recorded as member of group " + groupId + " but user "