Package net.webpasswordsafe.common.model

Examples of net.webpasswordsafe.common.model.Password


   
    private void doNewPassword()
    {
        if (clientSessionUtil.isAuthorized(Function.ADD_PASSWORD))
        {
            Password newPassword = new Password();
            newPassword.setMaxEffectiveAccessLevel(AccessLevel.GRANT);
            newPassword.addPermission(new Permission(clientSessionUtil.getLoggedInUser(), AccessLevel.GRANT));
            new PasswordDialog(newPassword, passwordSearchPanel).show();
        }
        else
        {
            MessageBox.alert(textMessages.error(), textMessages.notAuthorized(), null);
View Full Code Here


        {
            ServerSessionUtil.setIP(request.getRemoteAddr());
            boolean isAuthnValid = loginService.login(authnUsername, authnPassword);
            if (isAuthnValid)
            {
                Password password = passwordService.getPassword(Long.valueOf(passwordId));
                if (password != null)
                {
                    passwordMap.put("id", String.valueOf(password.getId()));
                    passwordMap.put("title", password.getName());
                    passwordMap.put("username", password.getUsername());
                    passwordMap.put("notes", password.getNotes());
                    passwordMap.put("tags", password.getTagsAsString());
                    passwordMap.put("active", password.isActive() ? "Y" : "N");
                    isSuccess = true;
                }
                else
                {
                    message = "Password not found";
View Full Code Here

        {
            ServerSessionUtil.setIP(request.getRemoteAddr());
            boolean isAuthnValid = loginService.login(authnUsername, authnPassword);
            if (isAuthnValid)
            {
                Password password = passwordService.getPassword(Long.valueOf(passwordId));
                if (password != null)
                {
                    currentPassword = passwordService.getCurrentPassword(password.getId());
                    isSuccess = true;
                }
                else
                {
                    message = "Password not found";
View Full Code Here

    {
        LOG.debug("updating password");
        Date now = new Date();
        String action = "update password";
        User loggedInUser = getLoggedInUser();
        Password password = passwordDAO.findAllowedPasswordById(updatePassword.getId(), loggedInUser, AccessLevel.WRITE);
        if (password != null)
        {
            if (updatePassword.getPermissions().size() > 0)
            {
                String passwordMessage = (updatePassword.getName().equals(password.getName())) ? "" : ("was: "+passwordTarget(password));
                // update simple fields
                password.setName(updatePassword.getName());
                password.setUsername(updatePassword.getUsername());
                password.setNotes(updatePassword.getNotes());
                password.setDateLastUpdate(now);
                password.setUserLastUpdate(loggedInUser);
                password.setActive(updatePassword.isActive());
                password.setMaxHistory(updatePassword.getMaxHistory());
               
                // update tags
                password.removeTags();
                for (Tag tag : updatePassword.getTags())
                {
                    Tag pTag = tagDAO.findTagByName(tag.getName());
                    if (null != pTag)
                    {
                        password.addTag(pTag);
                    }
                    else
                    {
                        password.addTag(tag);
                    }
                }
               
                // update password data, push others back in history if applicable
                PasswordData updatePasswordData = updatePassword.getCurrentPasswordData();
                String updatePasswordVal = updatePasswordData.getPassword();
                // if user entered a password value and its not the same as the current one...
                if (!"".equals(updatePasswordVal))
                {
                    String currentPasswordVal = encryptor.decrypt(password.getCurrentPasswordData().getPassword());
                    if (!updatePasswordVal.equals(currentPasswordVal))
                    {
                        updatePasswordData.setUserCreated(loggedInUser);
                        updatePasswordData.setDateCreated(now);
                        updatePasswordData.setPassword(encryptor.encrypt(updatePasswordVal));
                        password.addPasswordData(updatePasswordData);
                    }
                }
                // trim history if not infinite
                password.pruneDataHistory();
   
                // update permissions if allowed to grant
                if (passwordDAO.findAllowedPasswordById(updatePassword.getId(), loggedInUser, AccessLevel.GRANT) != null)
                {
                    // keep the permissions that haven't changed
                    password.getPermissions().retainAll(updatePassword.getPermissions());
                    // add the permissions that have changed
                    for (Permission permission : updatePassword.getPermissions())
                    {
                        if (permission.getId() == 0)
                        {
                            password.addPermission(permission);
                        }
                    }
                }
                else
                {
View Full Code Here

            ServerSessionUtil.setIP(request.getRemoteAddr());
            boolean isAuthnValid = loginService.login(authnUsername, authnPassword);
            if (isAuthnValid)
            {
                User loggedInUser = loginService.getLogin();
                Password password = new Password();
                password.setName(Utils.safeString(passwordMap.get("title")));
                password.setUsername(Utils.safeString(passwordMap.get("username")));
                PasswordData passwordDataItem = new PasswordData();
                passwordDataItem.setPassword(Utils.safeString(passwordMap.get("password")));
                password.addPasswordData(passwordDataItem);
                password.setNotes(Utils.safeString(passwordMap.get("notes")));
                password.setMaxHistory(-1);
                String active = Utils.safeString(passwordMap.get("active")).toLowerCase();
                password.setActive(active.equals("") || active.equals("true") || active.equals("yes") || active.equals("y"));
                password.addPermission(new Permission(loggedInUser, AccessLevel.GRANT));
                password.addTagsAsString(Utils.safeString(passwordMap.get("tags")));
                if (passwordService.isPasswordTaken(password.getName(), password.getUsername(), password.getId()))
                {
                    message = "Password title and username already exists";
                }
                else
                {
                    passwordService.addPassword(password);
                    passwordId = String.valueOf(password.getId());
                    isSuccess = true;
                }
            }
            else
            {
View Full Code Here

            {
                passwordId = Utils.safeString(passwordMap.get("id"));
                int iPasswordId = Utils.safeInt(passwordId);
                if (iPasswordId > 0)
                {
                    Password password = passwordService.getPassword(iPasswordId);
                    if (null != password)
                    {
                        Password updatePassword = password.cloneCopy();
                        updatePassword.setName(Utils.safeString(passwordMap.get("title")));
                        updatePassword.setUsername(Utils.safeString(passwordMap.get("username")));
                        PasswordData passwordDataItem = new PasswordData();
                        passwordDataItem.setPassword(Utils.safeString(passwordMap.get("password")));
                        updatePassword.addPasswordData(passwordDataItem);
                        updatePassword.setNotes(Utils.safeString(passwordMap.get("notes")));
                        String active = Utils.safeString(passwordMap.get("active")).toLowerCase();
                        updatePassword.setActive(active.equals("") || active.equals("true") || active.equals("yes") || active.equals("y"));
                        updatePassword.addTagsAsString(Utils.safeString(passwordMap.get("tags")));
                        if (passwordService.isPasswordTaken(updatePassword.getName(), updatePassword.getUsername(), updatePassword.getId()))
                        {
                            message = "Password title and username already exists";
                        }
                        else
                        {
View Full Code Here

    {
        String currentPasswordValue = "";
        Date now = new Date();
        String action = "get current password value";
        User loggedInUser = getLoggedInUser();
        Password password = passwordDAO.findAllowedPasswordById(passwordId, loggedInUser, AccessLevel.READ);
        if (password != null)
        {
            auditLogger.log(now, loggedInUser.getUsername(), ServerSessionUtil.getIP(), action, passwordTarget(password), true, "");
            currentPasswordValue = encryptor.decrypt(password.getCurrentPasswordData().getPassword());
            createPasswordAccessAuditEntry(password, loggedInUser);
        }
        else
        {
            auditLogger.log(now, loggedInUser.getUsername(), ServerSessionUtil.getIP(), action, passwordTarget(passwordId), false, "invalid id or no access");
View Full Code Here

    public Password getPassword(long passwordId)
    {
        Date now = new Date();
        String action = "get password";
        User loggedInUser = getLoggedInUser();
        Password password = passwordDAO.findAllowedPasswordById(passwordId, loggedInUser, AccessLevel.READ);
        if (password != null)
        {
            password.setMaxEffectiveAccessLevel(passwordDAO.getMaxEffectiveAccessLevel(password, loggedInUser));
            auditLogger.log(now, loggedInUser.getUsername(), ServerSessionUtil.getIP(), action, passwordTarget(password), true, "");
        }
        else
        {
            auditLogger.log(now, loggedInUser.getUsername(), ServerSessionUtil.getIP(), action, passwordTarget(passwordId), false, "invalid id or no access");
View Full Code Here

    {
        Date now = new Date();
        String action = "get password access audit data";
        List<PasswordAccessAudit> accessAuditList = new ArrayList<PasswordAccessAudit>(0);
        User loggedInUser = getLoggedInUser();
        Password password = passwordDAO.findAllowedPasswordById(passwordId, loggedInUser, AccessLevel.READ);
        if (null != password)
        {
            accessAuditList = passwordAccessAuditDAO.findAccessAuditByPassword(password);
            auditLogger.log(now, loggedInUser.getUsername(), ServerSessionUtil.getIP(), action, passwordTarget(password), true, "");
        }
View Full Code Here

    {
        Date now = new Date();
        String action = "get password history data";
        List<PasswordData> decryptedPasswordDataList = new ArrayList<PasswordData>(0);
        User loggedInUser = getLoggedInUser();
        Password password = passwordDAO.findAllowedPasswordById(passwordId, loggedInUser, AccessLevel.READ);
        if (null != password)
        {
            decryptedPasswordDataList = new ArrayList<PasswordData>(password.getPasswordData().size());
            for (PasswordData passwordData : password.getPasswordData())
            {
                decryptedPasswordDataList.add(new PasswordData(encryptor.decrypt(passwordData.getPassword()),
                        passwordData.getDateCreated(), passwordData.getUserCreated()));
            }
            createPasswordAccessAuditEntry(password, loggedInUser);
View Full Code Here

TOP

Related Classes of net.webpasswordsafe.common.model.Password

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.