Package org.apache.syncope.core.persistence.beans.user

Examples of org.apache.syncope.core.persistence.beans.user.SyncopeUser


     */
    public List<PropagationTask> getCreateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
            final String password, final List<AttributeTO> vAttrs, final Set<String> syncResourceNames)
            throws NotFoundException {

        SyncopeUser user = getSyncopeUser(wfResult.getResult().getKey());
        if (vAttrs != null && !vAttrs.isEmpty()) {
            userDataBinder.fillVirtual(user, vAttrs, AttributableUtil.getInstance(AttributableType.USER));
        }

        final PropagationByResource propByRes = wfResult.getPropByRes();
View Full Code Here


    public List<PropagationTask> getUpdateTaskIds(final WorkflowResult<Map.Entry<Long, Boolean>> wfResult,
            final String password, final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated,
            final Set<String> syncResourceNames)
            throws NotFoundException {

        SyncopeUser user = getSyncopeUser(wfResult.getResult().getKey());

        return getUpdateTaskIds(user, wfResult.getPropByRes(), password, vAttrsToBeRemoved, vAttrsToBeUpdated, wfResult.
                getResult().getValue(), syncResourceNames);
    }
View Full Code Here

     * @throws NotFoundException if user is not found
     */
    public List<PropagationTask> getDeleteTaskIds(final Long userId, final String syncResourceName)
            throws NotFoundException {

        SyncopeUser user = getSyncopeUser(userId);

        final PropagationByResource propByRes = new PropagationByResource();
        propByRes.set(PropagationOperation.DELETE, user.getResourceNames());
        if (syncResourceName != null) {
            propByRes.get(PropagationOperation.DELETE).remove(syncResourceName);
        }

        return provision(user, null, false, true, propByRes);
View Full Code Here

                             * (when the task is generated via UserController.update()): this basically means that
                             * before such update, this user used to have the current resource assigned by more than
                             * one mean (for example, two different memberships with the same resource).
                             */

                            SyncopeUser user = null;
                            if (task.getSyncopeUser() != null) {
                                try {
                                    user = getSyncopeUser(task.getSyncopeUser().getId());
                                } catch (NotFoundException e) {
                                    LOG.warn("Requesting to delete a non-existing user from {}",
                                            task.getResource().getName(), e);
                                }
                            }

                            if (user == null || !user.getResourceNames().contains(task.getResource().getName())) {
                                LOG.debug("Perform deprovisioning on {}", task.getResource().getName());

                                connector.delete(
                                        task.getPropagationMode(),
                                        ObjectClass.ACCOUNT,
View Full Code Here

    @Transactional(noRollbackFor = {BadCredentialsException.class, DisabledException.class})
    public Authentication authenticate(final Authentication authentication)
            throws AuthenticationException {

        boolean authenticated = false;
        SyncopeUser passwordUser = new SyncopeUser();
        SyncopeUser user = null;

        String username = authentication.getPrincipal().toString();

        if (adminUser.equals(username)) {
            passwordUser.setPassword(authentication.getCredentials().toString(), CipherAlgorithm.MD5, 0);
            authenticated = adminMD5Password.equalsIgnoreCase(passwordUser.getPassword());
        } else {
            user = userDAO.find(username);

            if (user != null) {
                if (user.getSuspended()) {
                    throw new DisabledException("User " + user.getUsername() + " is suspended");
                }

                passwordUser.setPassword(authentication.getCredentials().toString(), user.getCipherAlgoritm(), 0);
                authenticated = user.getPassword().equalsIgnoreCase(passwordUser.getPassword());
            }
        }

        UsernamePasswordAuthenticationToken token;

        if (authenticated) {
            token = new UsernamePasswordAuthenticationToken(
                    authentication.getPrincipal(),
                    null,
                    userDetailsService.loadUserByUsername(authentication.getPrincipal().toString()).getAuthorities());

            token.setDetails(authentication.getDetails());

            auditManager.audit(Category.authentication, AuthenticationSubCategory.login, Result.success,
                    "Successfully authenticated, with roles: " + token.getAuthorities());

            LOG.debug("User {} successfully authenticated, with roles {}", authentication.getPrincipal(), token.
                    getAuthorities());

            if (user != null) {
                user.setLastLoginDate(new Date());
                user.setFailedLogins(0);
                userDAO.save(user);
            }

        } else {
            if (user != null) {
                user.setFailedLogins(user.getFailedLogins() + 1);
                userDAO.save(user);
            }

            auditManager.audit(Category.authentication, AuthenticationSubCategory.login, Result.failure,
                    "User " + authentication.getPrincipal() + " not authenticated");
View Full Code Here

            }
        }

        final List<SyncopeUser> result = new ArrayList<SyncopeUser>(userIds.size());

        SyncopeUser user;
        for (Object userId : userIds) {
            user = userDAO.find(((Number) userId).longValue());
            if (user == null) {
                LOG.error("Could not find user with id {}, " + "even though returned by the native query", userId);
            } else {
View Full Code Here

     * @throws NotFoundException if user contained in the workflow result cannot be found
     */
    public void createTasks(final WorkflowResult<Long> wfResult)
            throws NotFoundException {

        SyncopeUser user = userDAO.find(wfResult.getResult());
        if (user == null) {
            throw new NotFoundException("User " + wfResult.getResult());
        }

        for (Notification notification : notificationDAO.findAll()) {
View Full Code Here

        userMod.addMembershipToBeRemoved(userTO.getMemberships().iterator().next().getId());

        userTO = restTemplate.postForObject(BASE_URL + "user/update", userMod, UserTO.class);
        assertNotNull(userTO);

        SyncopeUser passwordTestUser = new SyncopeUser();
        passwordTestUser.setPassword("newPassword", CipherAlgorithm.MD5, 0);
        assertEquals(passwordTestUser.getPassword(), userTO.getPassword());

        assertEquals(1, userTO.getMemberships().size());
        assertEquals(1, userTO.getMemberships().iterator().next().getAttributes().size());
        assertFalse(userTO.getDerivedAttributes().isEmpty());
View Full Code Here

        userTO = restTemplate.postForObject(BASE_URL + "user/update", userMod, UserTO.class);

        // check for changePwdDate
        assertNotNull(userTO.getChangePwdDate());

        SyncopeUser passwordTestUser = new SyncopeUser();
        passwordTestUser.setPassword("newPassword", CipherAlgorithm.MD5, 0);
        assertEquals(passwordTestUser.getPassword(), userTO.getPassword());

        List<PropagationTaskTO> afterTasks = Arrays.asList(restTemplate.getForObject(
                BASE_URL + "task/propagation/list", PropagationTaskTO[].class));
        assertNotNull(afterTasks);
        assertFalse(afterTasks.isEmpty());
View Full Code Here

     * @throws NotFoundException if user contained in the workflow result cannot be found
     */
    public void createTasks(final WorkflowResult<Long> wfResult)
            throws NotFoundException {

        SyncopeUser user = userDAO.find(wfResult.getResult());
        if (user == null) {
            throw new NotFoundException("User " + wfResult.getResult());
        }

        for (Notification notification : notificationDAO.findAll()) {
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.user.SyncopeUser

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.