Package com.evasion.entity.security

Examples of com.evasion.entity.security.User


        } else {
        this.getPerson().setEmail(dto.getEmail());
        this.setPerson(dto.getPerson());
        }
        if (this.getUser()==null) {
            this.setUser(new User());
        }
        this.getUser().setUsername(dto.getUsername());
        this.getUser().setPassword(dto.getPassword());
        this.getUser().setEmail(dto.getEmail());
       
View Full Code Here


    @edu.umd.cs.findbugs.annotations.SuppressWarnings("UPM_UNCALLED_PRIVATE_METHOD")
    @PostConstruct
    private void init() {
        authorityDAO.setEntityManager(em);
        userDAO.setEntityManager(em);
        User admin = userDAO.findById("admin");
        if (admin == null) {
            LOGGER.error("Restart app to init admin user.");
        }
    }
View Full Code Here

     * {@inheritDoc }
     */
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    @Override
    public void postLogin(String userName) {
        final User user = userDAO.findById(userName);
        updateLastLogin(user);
    }
View Full Code Here

    /**
     * {@inheritDoc }
     */
    @Override
    public EvasionPrincipal getEvasionPrincipal(String userName) {
        final User user = userDAO.findById(userName);
        EvasionPrincipal userPrincipal = new EvasionPrincipal(userName);
        userPrincipal.setLastLogin(user.getLastLogin());
        return userPrincipal;
    }
View Full Code Here

    /**
     * {@inheritDoc }
     */
    @Override
    public String getPassword(String userName) {
        final User user = userDAO.findById(userName);
        if (user == null) {
            return null;
        } else {
            return user.getPassword();
        }
    }
View Full Code Here

    public Account findOrCreateAdminAccount() throws EvasionException {

        Account acc = accountDAO.findAccountByUsername("admin");
        if (acc == null) {
            User admin = userDAO.findById("admin");
            if (admin == null) {
                admin = new User();
                admin.setEnabled(true);
                admin.setUsername("admin");
                admin.setPassword("adminadmin");
                admin.setEmail("admin@localhost");
            }
            Person person = new Individual("", Civilite.monsieur, "admin", "admin", new Date());
            defaultDAO.persist(person);
            acc = new Account(admin, person);
            createAccount(acc);
View Full Code Here

        return acc;
    }

    public void checkOrUpdateAdminAuth() throws EvasionException {
        Authority auth = findOrCreateAdminAuthority();
        User admin = findOrCreateAdminAccount().getUser();
        if (!admin.getAuthorities().contains(auth)) {
            admin.addAuthority(auth);
            updateUser(admin);
        }
    }
View Full Code Here

        }
        return u;
    }

    public User updateUser(User u) {
        final User userBDD = em.find(User.class, u.getUsername());
        LOGGER.debug("Mise à jour du user: {}", u.toString());
        validGrantedAuthority(u);
        if (!userBDD.getPassword().equals(u.getPassword())) {
            encodPassword(u);
        }
        return em.merge(u);
    }
View Full Code Here

    }

    public final UserDetails loadUserByUsername(String login)
            throws PersistenceViolationException {
        try {
            User account = findUserByUserName(login);
            em.flush();
            if (account != null) {
                return new UserDetailsAdapter(account);
            } else {
                return null;
View Full Code Here

            throw new PersistenceViolationException("Erreur lors de l'identification du login '" + login + "' en persistence");
        }
    }

    public User findUserByUserName(String u) {
        User user;
        if (u.equals(USERNAME_ADMIN)) {
            user = initAdminUser();
        } else {
            user = em.find(User.class, u);
        }
View Full Code Here

TOP

Related Classes of com.evasion.entity.security.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.