Package net.webpasswordsafe.common.model

Examples of net.webpasswordsafe.common.model.User


    @Override
    public boolean authenticate(String username, String password)
    {
        boolean isValid = false;
        User user = userDAO.findActiveUserByUsername(username);
        if (null != user)
        {
            isValid = digester.check(password, user.getAuthnPasswordValue());
        }
        LOG.debug("LocalAuthenticator: login success for "+username+"? "+isValid);
        return isValid;
    }
View Full Code Here


    @Override
    @Transactional(propagation=Propagation.REQUIRED, readOnly=true)
    public User getLogin()
    {
        String username = ServerSessionUtil.getUsername();
        User user = userDAO.findActiveUserByUsername(username);
        if (null != user)
        {
            user.setRoles(ServerSessionUtil.getRoles());
        }
        LOG.debug("logged in user="+((null==user) ? "null":user.getUsername()));
        return user;
    }
View Full Code Here

        Date now = new Date();
        String message = "";
        username = trimUsername(username);
        if (authenticator.authenticate(username, password))
        {
            User user = userDAO.findActiveUserByUsername(username);
            if (null != user)
            {
                isValidLogin = true;
                user.setLastLogin(now);
                userDAO.makePersistent(user);
                ServerSessionUtil.setUsername(username);
                ServerSessionUtil.setRoles(roleRetriever.retrieveRoles(user));
            }
            else
View Full Code Here

    @Override
    @Transactional(propagation=Propagation.REQUIRED, readOnly=true)
    public Map<Function, Boolean> getLoginAuthorizations(Set<Function> functions)
    {
        LOG.debug("inside getLoginAuthorizations");
        User loggedInUser = getLogin();
        // if passed null, load everything
        if (null==functions)
        {
            LOG.debug("functions was passed null");
            functions = new HashSet<Function>(Arrays.asList(Function.values()));
View Full Code Here

    @Override
    @Transactional(propagation=Propagation.REQUIRED, readOnly=true)
    public List<Map<String, Object>> getLoginReports()
    {
        LOG.debug("inside getLoginReports");
        User loggedInUser = getLogin();
        List<Map<String, Object>> reportList = new ArrayList<Map<String,Object>>();
        for (Map<String, Object> report : reportConfig.getReports())
        {
            if (authorizer.isAuthorized(loggedInUser, Constants.VIEW_REPORT_PREFIX+(String)report.get(Constants.NAME)))
            {
View Full Code Here

    private void doAddUser()
    {
        if (clientSessionUtil.isAuthorized(Function.ADD_USER))
        {
            displayUserDialog(new User());
        }
        else
        {
            MessageBox.alert(textMessages.error(), textMessages.notAuthorized(), null);
        }
View Full Code Here

    @Override
    @Transactional(propagation=Propagation.REQUIRED)
    public void changePassword(String password)
    {
        Date now = new Date();
        User loggedInUser = getLoggedInUser();
        if (null != loggedInUser)
        {
            loggedInUser.updateAuthnPasswordValue(digester.digest(password));
            userDAO.makePersistent(loggedInUser);
            auditLogger.log(now, loggedInUser.getUsername(), ServerSessionUtil.getIP(), "change password", "", true, "");
        }
        else
        {
            auditLogger.log(now, "", ServerSessionUtil.getIP(), "change password", "", false, "not logged in");
            throw new RuntimeException("Not logged in");
View Full Code Here

    @Override
    @Transactional(propagation=Propagation.REQUIRED)
    public void addUser(User newUser)
    {
        Date now = new Date();
        User loggedInUser = getLoggedInUser();
        if (authorizer.isAuthorized(loggedInUser, Function.ADD_USER.name()))
        {
            addUserInternal(newUser);
        }
        else
View Full Code Here

    @Transactional(propagation=Propagation.REQUIRED)
    private void addUserInternal(User newUser)
    {
        Date now = new Date();
        // create base user
        User user = new User();
        user.setUsername(newUser.getUsername());
        user.setFullname(newUser.getFullname());
        user.setEmail(newUser.getEmail());
        user.setActiveFlag(newUser.isActiveFlag());
        user.updateAuthnPasswordValue(digester.digest(newUser.getAuthnPasswordValue()));
        user.setDateCreated(now);
        userDAO.makePersistent(user);
        newUser.setId(user.getId());
       
        // assign user to everyone group
        Group everyoneGroup = getEveryoneGroup();
        everyoneGroup.addUser(user);
       
View Full Code Here

    @Transactional(propagation=Propagation.REQUIRED)
    public void updateUser(User updateUser)
    {
        Date now = new Date();
        String action = "update user";
        User loggedInUser = getLoggedInUser();
        if (authorizer.isAuthorized(loggedInUser, Function.UPDATE_USER.name()))
        {
            // update base user
            User user = userDAO.findById(updateUser.getId());
            user.setFullname(updateUser.getFullname());
            user.setEmail(updateUser.getEmail());
            user.setActiveFlag(updateUser.isActiveFlag());
            if (!updateUser.getAuthnPasswordValue().equals(""))
            {
                user.updateAuthnPasswordValue(digester.digest(updateUser.getAuthnPasswordValue()));
            }
           
            // remove old groups
            for (Group oldGroup : user.getGroups())
            {
                Group group = groupDAO.findById(oldGroup.getId());
                group.removeUser(user);
            }
View Full Code Here

TOP

Related Classes of net.webpasswordsafe.common.model.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.