Examples of AuthenticatedUserVo


Examples of org.sete.vo.common.AuthenticatedUserVo

    protected final AuthenticatedUserVo getAuthenticatedUser(HttpServletRequest request) {
        return (AuthenticatedUserVo) request.getSession().getAttribute(WebConstants.AUTH_USER);
    }

    protected Boolean userHasPrivilege(HttpSession session, UserPrivilegeVo vo) {
        AuthenticatedUserVo userVo = (AuthenticatedUserVo)session.getAttribute(WebConstants.AUTH_USER);
        return userVo.hasPrivilege(vo);
    }
View Full Code Here

Examples of org.sete.vo.common.AuthenticatedUserVo

        AuthenticatedUserVo userVo = (AuthenticatedUserVo)session.getAttribute(WebConstants.AUTH_USER);
        return userVo.hasPrivilege(vo);
    }

    protected Boolean userHasPrivilege(HttpSession session, List<UserPrivilegeVo> vos) {
        AuthenticatedUserVo userVo = (AuthenticatedUserVo)session.getAttribute(WebConstants.AUTH_USER);
        return userVo.hasPrivilege(vos);
    }
View Full Code Here

Examples of org.sete.vo.common.AuthenticatedUserVo

            HttpServletRequest request,
            HttpServletResponse response,
            ServletContext arg3) throws ServletException, IOException {
   
    //get current user
    AuthenticatedUserVo userVo = (AuthenticatedUserVo)request.getSession().getAttribute(WebConstants.AUTH_USER);
    if(userVo == null){return;}
    //get privileges -> thus getting desired roles
    List<UserRolePrivilegeVo> privs = userVo.getUserRolePrivileges();
    HashMap<String,String> roles = new HashMap<String,String>();
   
    for(int i = 0;i<privs.size();i++){
      roles.put(privs.get(i).getRoleType().getKey(),null);
    }
View Full Code Here

Examples of org.sete.vo.common.AuthenticatedUserVo

                        HttpServletRequest request,
                        HttpServletResponse response,
                        ServletContext servletCtx) throws Exception {

        SideMenuVo menuPrivVo = new SideMenuVo();
        AuthenticatedUserVo userVo =
                            (AuthenticatedUserVo)request.getSession().getAttribute(WebConstants.AUTH_USER);

        setProjectIdeasMenuPrivileges(menuPrivVo, userVo);
        setJudgeMenuPrivileges(menuPrivVo, userVo);
        setProjectCategoryMenuPrivileges(menuPrivVo, userVo);
View Full Code Here

Examples of org.sete.vo.common.AuthenticatedUserVo

                                              HttpServletResponse response,
                                              Authentication authentication) throws IOException {

        super.onSuccessfulAuthentication(request, response, authentication);
        String loginName = ((UserDetails) authentication.getPrincipal()).getUsername();
        AuthenticatedUserVo vo = authenticationService.loadAuthenticatedUserInfo(loginName);

        // save in security context for access during other operations [e.g. audit info during save/update]
        saveAuthenticateUserInSecurityContext(authentication, vo);
        request.getSession().setAttribute(WebConstants.AUTH_USER, vo);
    }
View Full Code Here

Examples of org.sete.vo.common.AuthenticatedUserVo

* to check authorization before each exposed action therefore it's functionality is critical.
*/
public class AuthenticatedUserVoTest extends BaseTestCase {

    public void testUserHasPrivilege() throws Exception {
        AuthenticatedUserVo user = new AuthenticatedUserVo();
        user.setUserRolePrivileges(createUserRolePrivileges());

        UserPrivilegeVo allowedPriv = createUserPrivilegeVo(UserPrivilegeType.Key.MANAGE_JUDGE_SCHEDULE_KEY,
                                                            PrivilegeActionType.Key.READ_WRITE_KEY);

        assertTrue("User should have had Manage Judge Schedule Read/Write access.",
                   user.hasPrivilege(allowedPriv));

        allowedPriv = createUserPrivilegeVo(UserPrivilegeType.Key.MANAGE_ROLES_KEY,
                                            PrivilegeActionType.Key.READ_KEY);

        assertTrue("User should have had Manage Roles Read access.", user.hasPrivilege(allowedPriv));
    }
View Full Code Here

Examples of org.sete.vo.common.AuthenticatedUserVo

        assertTrue("User should have had Manage Roles Read access.", user.hasPrivilege(allowedPriv));
    }

    public void testUserHasInvalidPrivilege() throws Exception {
        AuthenticatedUserVo user = new AuthenticatedUserVo();
        user.setUserRolePrivileges(createUserRolePrivileges());

        UserPrivilegeVo allowedPriv = createUserPrivilegeVo(UserPrivilegeType.Key.MANAGE_MY_PROFILE_KEY,
                                                            PrivilegeActionType.Key.READ_KEY);

        assertFalse("User should not ave had Manage My Profile Read access.",
                   user.hasPrivilege(allowedPriv));

        allowedPriv = createUserPrivilegeVo(UserPrivilegeType.Key.VIEW_ALL_PROJECTS_KEY,
                                            PrivilegeActionType.Key.READ_KEY);

        assertFalse("User should not have had View All Projects Read access.",
                    user.hasPrivilege(allowedPriv));
    }
View Full Code Here

Examples of org.sete.vo.common.AuthenticatedUserVo

                        HttpServletRequest request,
                        HttpServletResponse response,
                        ServletContext servletCtx) throws Exception {

        SideMenuVo menuPrivVo = new SideMenuVo();
        AuthenticatedUserVo userVo =
                            (AuthenticatedUserVo)request.getSession().getAttribute(WebConstants.AUTH_USER);

        setProjectIdeasMenuPrivileges(menuPrivVo, userVo);
        setJudgeMenuPrivileges(menuPrivVo, userVo);
        setProjectCategoryMenuPrivileges(menuPrivVo, userVo);
View Full Code Here

Examples of org.sete.vo.common.AuthenticatedUserVo

        assertFalse("User should not have had View All Projects Read access.",
                    user.hasPrivilege(allowedPriv));
    }

    public void testUserHasPrivilegeMultiples() throws Exception {
        AuthenticatedUserVo user = new AuthenticatedUserVo();
        user.setUserRolePrivileges(createUserRolePrivileges());

        List<UserPrivilegeVo> allowedPrivList = new ArrayList<UserPrivilegeVo>();
        allowedPrivList.add(createUserPrivilegeVo(UserPrivilegeType.Key.MANAGE_JUDGE_SCHEDULE_KEY,
                                                  PrivilegeActionType.Key.READ_WRITE_KEY));

        allowedPrivList.add(createUserPrivilegeVo(UserPrivilegeType.Key.MANAGE_ROLES_KEY,
                                                  PrivilegeActionType.Key.READ_KEY));

        assertTrue("User should have had access.", user.hasPrivilege(allowedPrivList));
    }
View Full Code Here

Examples of org.sete.vo.common.AuthenticatedUserVo

        assertTrue("User should have had access.", user.hasPrivilege(allowedPrivList));
    }

    public void testUserHasInvalidPrivilegeMultiples() throws Exception {
        AuthenticatedUserVo user = new AuthenticatedUserVo();
        user.setUserRolePrivileges(createUserRolePrivileges());

        List<UserPrivilegeVo> allowedPrivList = new ArrayList<UserPrivilegeVo>();
        allowedPrivList.add(createUserPrivilegeVo(UserPrivilegeType.Key.MANAGE_MY_PROFILE_KEY,
                                                  PrivilegeActionType.Key.READ_KEY));

        allowedPrivList.add(createUserPrivilegeVo(UserPrivilegeType.Key.VIEW_ALL_PROJECTS_KEY,
                                                  PrivilegeActionType.Key.READ_KEY));

        assertFalse("User should not have had access.", user.hasPrivilege(allowedPrivList));
    }
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.