Package com.sparc.knappsack.components.entities

Examples of com.sparc.knappsack.components.entities.User


        }
    }

    @Override
    public void updateUserDomainRole(Long userId, Long domainId, UserRole userRole) {
        User user = userService.get(userId);
        UserDomain userDomain = get(user, domainId);

        if (userDomain != null) {
            userDomain.setRole(roleService.getRoleByAuthority(userRole.toString()));
View Full Code Here


    private UserService userService;

    @Override
    public IOSKeyVaultEntry createKeyVaultEntry(KeyVaultEntryForm keyVaultEntryForm) {
        IOSKeyVaultEntry keyVaultEntry = null;
        User user = userService.getUserFromSecurityContext();

        if (keyVaultEntryForm != null && user != null && user.getActiveOrganization() != null) {
            Domain parentDomain = user.getActiveOrganization();
            if (parentDomain != null) {
                keyVaultEntry = new IOSKeyVaultEntry();
                keyVaultEntry.setName(StringUtils.trimTrailingWhitespace(keyVaultEntryForm.getName()));
                keyVaultEntry.setDistributionKeyPassword(keyVaultEntryForm.getDistributionKeyPassword());
                keyVaultEntry.setStorageConfiguration(getStorageConfiguration(parentDomain));
View Full Code Here

    @Qualifier("userService")
    @Autowired(required = true)
    private UserService userService;

    public User loadUserByUsername(String userName) throws UsernameNotFoundException, DisabledException {
        User user = userDetailsDao.findByEmail(userName);
        if (user == null) {
            throw new UsernameNotFoundException("User not found for userName: " + userName);
        } else {
            if (!user.isEnabled()) {
                throw new DisabledException("User is disabled");
            }
            userService.setDefaultActiveOrganization(user);
            return user;
        }
View Full Code Here

        }
    }

    @Override
    public org.springframework.security.core.userdetails.UserDetails loadUserDetails(OpenIDAuthenticationToken token) throws UsernameNotFoundException {
        User existingUser = null;
        for (OpenIDAttribute attribute : token.getAttributes()) {
            if ("email".equals(attribute.getName())) {
                existingUser = userDetailsDao.findByEmail(attribute.getValues().get(0).toLowerCase());
                break;
            }
        }
        if (existingUser == null) {
            throw new OpenIDUserNotFoundException("User not found for OpenID: " + token.getName(), token);
        } else {
            existingUser.getOpenIdIdentifiers().add(token.getIdentityUrl());
            userService.setDefaultActiveOrganization(existingUser);
            userDetailsDao.update(existingUser);
        }

        return existingUser;
View Full Code Here

            }

            model.setApplicationType(keyVaultEntry.getApplicationType());
            model.setCreateDate(keyVaultEntry.getCreateDate());

            User user = userService.getByEmail(keyVaultEntry.getChangedBy());
            if (user != null) {
                UserModel userModel = new UserModel();
                userModel.setFirstName(user.getFirstName());
                userModel.setLastName(user.getLastName());
                userModel.setEmail(user.getEmail());

                model.setCreatedBy(userModel);
            }
        }
        return model;
View Full Code Here

    @Autowired(required = true)
    private InvitationService invitationService;

    @Override
    public User registerUser(UserModel userModel, boolean useTemporaryPassword) {
        User user = null;
        if (userModel != null) {
            List<Role> userRoles = new ArrayList<Role>();
            Role userRole = roleService.getRoleByAuthority(UserRole.ROLE_USER.toString());
            userRoles.add(userRole);

            user = new User(userModel.getEmail(), passwordEncoder.encodePassword(userModel.getPassword(), userModel.getEmail().toLowerCase().trim()), userModel.getEmail(), userModel.getFirstName(), userModel.getLastName(), userRoles);
            user.setPasswordExpired(useTemporaryPassword);
            //If this is the first user in the application, set them as a Knappsack administrator
            if (userService.countAll() == 0) {
                setAdminRole(user);
            }
            userDetailsDao.add(user);
View Full Code Here

        if (user != null && StringUtils.hasText(password)) {
            String oldPassword = user.getPassword();
            userService.changePassword(user, password, isTempPassword);

            User updatedUser = userService.getByEmail(user.getEmail());

            if (updatedUser != null && StringUtils.hasText(updatedUser.getPassword()) && !updatedUser.getPassword().equals(oldPassword)) {
                userService.updateSecurityContext(updatedUser);

                success = true;

                if (isTempPassword) {
                    EventComposite composite = new UserPasswordResetComposite(password);
                    EventDeliveryWithComposite deliveryMechanism = eventDeliveryWithCompositeFactory.getEventDelivery(EventType.USER_PASSWORD_RESET);
                    if (deliveryMechanism != null) {
                        boolean notificationSent = deliveryMechanism.sendNotifications(updatedUser, composite);
                        if (!notificationSent) {
                            log.info(String.format("Password reset email not sent to: %s", updatedUser.getEmail()));
                        }
                    }
                }

            } else {
View Full Code Here

TOP

Related Classes of com.sparc.knappsack.components.entities.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.