Examples of UserImpl


Examples of org.internna.iwebmvc.model.security.UserImpl

    @Before
    public void init() throws Exception {
        userManager.setName("john");
        securityDAO.createAuthority("registered_user");
        UserImpl john = new UserImpl();
        john.setUsername("john");
        john.setPassword("john");
        john.setName("John Smith");
        john.addRole((RoleImpl) securityDAO.findAuthority("registered_user"));
        securityDAO.createUser(john);
        assertNotNull(securityDAO.findUser("john"));
        UserImpl mary = new UserImpl();
        mary.setUsername("mary");
        mary.setPassword("mary");
        mary.setName("Mary Poppins");
        mary.addRole((RoleImpl) securityDAO.findAuthority("registered_user"));
        securityDAO.createUser(mary);
        assertNotNull(securityDAO.findUser("mary"));
        UserImpl viewer = new UserImpl();
        viewer.setUsername("viewer");
        viewer.setPassword("viewer");
        viewer.setName("viewer");
        viewer.addRole((RoleImpl) securityDAO.findAuthority("registered_user"));
        securityDAO.createUser(viewer);
        assertNotNull(securityDAO.findUser("viewer"));
        OwnedEntity one = new OwnedEntity();
        one.setName("one");
        dao.create(one);
View Full Code Here

Examples of org.internna.iwebmvc.model.security.UserImpl

    @Autowired protected ContextHolder holder;
    @Autowired protected AJAXValidator validator;

    @RequestMapping(method = RequestMethod.GET)
    public String showForm(@RequestParam(required = false, value = "username") String username, ModelMap model) {
        model.addAttribute("registereduser", new UserImpl());
        model.addAttribute("availableLocales", holder.getAvailableLocales());
        return "security/registration";
    }
View Full Code Here

Examples of org.internna.iwebmvc.model.security.UserImpl

    @Autowired protected SecurityDAO securityDao;
    @Autowired protected ContextHolder holder;

    @RequestMapping(method = RequestMethod.GET)
    public String showForm(@RequestParam(required = false, value = "username") String username, ModelMap model) {
        model.addAttribute("newuser", username == null ? new UserImpl() : securityDao.findUser(username));
        model.addAttribute("authorities", holder.getAuthorities());
        model.addAttribute("availableLocales", holder.getAvailableLocales());
        return "security/template";
    }
View Full Code Here

Examples of org.internna.iwebmvc.model.security.UserImpl

    }

    @RemoteMethod
    public boolean toggle(String username) throws Exception {
        Assert.hasText(username);
        UserImpl user = dao.findUser(username);
        user.toggle();
        dao.createUser(user);
        return user.isEnabled();
    }
View Full Code Here

Examples of org.internna.iwebmvc.model.security.UserImpl

    }

    @RemoteMethod
    public boolean update(Class clazz, UpdateDataDTO[] data) throws Exception {
        for (UpdateDataDTO dto : data) {
            UserImpl user = dao.findUser(dto.getPrimaryKey());
            BeanWrapper w = new BeanWrapperImpl(user);
            w.setPropertyValue(dto.getPath(), dto.getValue());
            dao.createUser(user);
        }
        return true;
View Full Code Here

Examples of org.internna.iwebmvc.model.security.UserImpl

        Assert.notEmpty(applicationAuthorities);
        for (String authority : applicationAuthorities) securityDAO.createAuthority(authority);
    }

    protected void init() throws Exception {
        UserImpl root = null;
        try {
            root = securityDAO.findUser(user.getUsername());
        } catch (Exception ex) {
            if (log.isDebugEnabled()) log.debug("Root user [" + user.getUsername() + "] could not be found: " + ex.getMessage());
        }
View Full Code Here

Examples of org.internna.iwebmvc.model.security.UserImpl

            }
        }
        if (createRootUser) {
            if (dao.findUser(rootUserName) == null) {
                try {
                    UserImpl rootUser = new UserImpl();
                    rootUser.setName("Admin");
                    rootUser.setEmail(rootUserEmail);
                    rootUser.setTheme(rootUserTheme);
                    rootUser.setUsername(rootUserName);
                    rootUser.setSalt(rootPasswordSalt);
                    rootUser.setPassword(rootPassword);
                    rootUser.setRoles(new HashSet(dao.findAuthorities()));
                    if ((supportedLocales != null) && (!supportedLocales.isEmpty())) rootUser.setLocale(supportedLocales.get(0));
                    if (logger.isDebugEnabled()) logger.debug("Creating root user [" + rootUserName + "] with roles: " + rootUser.getRoles());
                    dao.createUser(rootUser);
                } catch (Exception creationException) {
                    if (logger.isWarnEnabled()) logger.warn("Could not create Root user [" + rootUserName + "]: " + creationException, creationException);
                }
            } else if (logger.isDebugEnabled()) logger.debug("Root user [" + rootUserName + "] already exists. Skipping creation");
View Full Code Here

Examples of org.internna.iwebmvc.model.security.UserImpl

    @Override public Object convertInbound(Class<?> paramType, InboundVariable data) throws ConversionException {
      if (!data.isNull()) {
            String value = data.getValue();
            if (StringUtils.hasText(value)) {
                value = value.substring(1, value.length() - 1);
                UserImpl user = new UserImpl();
                user.setSalt(salt);
                data.getContext().addConverted(data, instanceType, user);
                Map<String, Property> properties = getPropertyMapFromObject(user, false, true);
                for (Entry<String, String> entry : extractInboundTokens(paramType, value).entrySet()) {
                    String key = entry.getKey();
                    if (!key.startsWith("%24dwr") && !"salt".equals(key)) {
View Full Code Here

Examples of org.internna.iwebmvc.model.security.UserImpl

     *
     */
    @Override public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws ConversionException {
        try {
            if (data != null) {
                UserImpl user = (UserImpl) data;
                user.setSalt(null);
                user.setPassword(null);
            }
        } catch (Exception ex) {
            // Better safe than sorry
            return new NonNestedOutboundVariable("null");
        }
View Full Code Here

Examples of org.internna.iwebmvc.model.security.UserImpl

    @RemoteMethod
    @Transactional
    @RolesAllowed("ROLE_SECURITY_MANAGER")
    @Override public void changePassword(String username, String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        if (hasText(username) && hasText(password)) {
            UserImpl user = (UserImpl) dao.findUser(username);
            if (user != null) {
                user.setSalt(salt);
                user.setPassword(password);
                dao.updateUser(user);
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.