Package org.internna.iwebmvc.model.security

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


            }
        }
        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

    @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

     *
     */
    @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

    @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

    private void createNewUser(User user, String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        Collection <Role> roles = new HashSet<Role>();
        for (Role role : user.getRoles()) roles.add(role);
        user.clearRoles();
        if (user instanceof UserImpl) {
            UserImpl impl = (UserImpl) user;
            impl.setPassword(password);
        }
        dao.createUser(user);
        updateAuthorities(user, roles);
    }
View Full Code Here

TOP

Related Classes of org.internna.iwebmvc.model.security.UserImpl

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.