Package com.sparc.knappsack.components.entities

Examples of com.sparc.knappsack.components.entities.User


        wiser.stop();
    }

    @Test
    public void resetPassword_Success_Test() {
        User user = getUserWithSecurityContext();
        assertFalse(user.isPasswordExpired());
        boolean success = userControllerService.resetPassword(user);

        assertTrue(success);
        assertTrue(user.isPasswordExpired());
    }
View Full Code Here


        assertFalse(success);
    }

    @Test
    public void changePassword_Success_Test() {
        User user = getUserWithSecurityContext();
        String originalPassword = user.getPassword();
        boolean success = userControllerService.changePassword(user, "newPassword", false);

        assertTrue(success);
        assertNotSame(originalPassword, user.getPassword());

        originalPassword = user.getPassword();
        success = userControllerService.changePassword(user, "anotherNewPassword", true);

        assertTrue(success);
        assertNotSame(originalPassword, user.getPassword());
        assertTrue(user.isPasswordExpired());
    }
View Full Code Here

        if(isBlackLabeledRequest(request)) {
            return;
        }

        if (request != null && modelAndView != null && (!(modelAndView.getView() instanceof RedirectView) && !modelAndView.getViewName().startsWith("redirect:"))) {
            User user = userService.getUserFromSecurityContext();
            if (user != null) {
                ApplicationType deviceType = new UserAgentInfo(request.getHeader("User-Agent"), request.getHeader("Accept")).getApplicationType();
                // Get categories for side menu
                List<Category> categories = userService.getCategoriesForUser(user, deviceType, SortOrder.ASCENDING);
                List<MenuItem> categoryMenuItems = new ArrayList<MenuItem>();
View Full Code Here

        if (session != null) {
            SecurityContext context = (SecurityContext) session.getAttribute("SPRING_SECURITY_CONTEXT");
            if (context != null) {
                if (context.getAuthentication() != null && context.getAuthentication().getPrincipal() != null && context.getAuthentication().getPrincipal() instanceof User) {
                    User user = userService.getUserFromSecurityContext();

                    String servletPath = request.getServletPath();

                    if (!servletPath.startsWith("/auth") && !servletPath.startsWith("/resources") && !servletPath.startsWith("/static") && !servletPath.startsWith("/contacts") && user != null && !servletPath.startsWith("/getSystemNotifications")) {
                        boolean skipValidation = false;

                        if (user.isPasswordExpired() && !servletPath.startsWith("/profile/changePassword") && !servletPath.startsWith("/profile/resetPassword") && !servletPath.startsWith("/auth/forgotPassword")) {
                            response.sendRedirect(request.getContextPath() + "/profile/changePassword");
                            skipValidation = true;
                            redirect = true;
                        } else if (user.isPasswordExpired() && (servletPath.startsWith("/profile/changePassword") || servletPath.startsWith("/profile/resetPassword") || servletPath.startsWith("/auth/forgotPassword"))) {
                            skipValidation = true;
                        }

                        if (!user.isActivated() && !servletPath.startsWith("/activate") && !skipValidation) {
                            response.sendRedirect(request.getContextPath() + "/activate");
                            redirect = true;
                        }
                    }
                }
View Full Code Here

        if (response != null) {
            response.setHeader("X-Frame-Options", "DENY");
        }

        if (request != null && modelAndView != null) {
            User user = userService.getUserFromSecurityContext();
            if (user == null) {
                HttpSession session = request.getSession();
                if (session != null) {
                    SecurityContext context = (SecurityContext) session.getAttribute("SPRING_SECURITY_CONTEXT");
                    if (context != null) {
View Full Code Here

    @Autowired(required = true)
    private UserService userService;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        User user = userService.getUserFromSecurityContext();
        if (user == null || user.isSystemAdmin()) {
            return true;
        }

        String servletPath = request.getServletPath();
        Organization organization = user.getActiveOrganization();
        if (organization != null && organization.getDomainConfiguration().isDisabledDomain()) {
            if (!servletPath.startsWith("/manager/organization/accountManagement")
                    && !servletPath.startsWith("/disabled")
                    && !servletPath.startsWith("/activeOrganization")
                    && !servletPath.startsWith("/image")
View Full Code Here

        if (request != null && modelAndView != null && (!(modelAndView.getView() instanceof RedirectView) && !modelAndView.getViewName().startsWith("redirect:"))) {
            if(isBlackLabeledRequest(request)) {
                return;
            }

            User user = userService.getUserFromSecurityContext();
            if (user != null) {
                Organization organization = user.getActiveOrganization();

                if (organization != null) {
                    modelAndView.getModel().put("orgName", "Knappsack");
                    if (organizationService.isCustomBrandingEnabled(organization)) {
                        modelAndView.getModel().put("orgName", organization.getName());
View Full Code Here

        super(a);
        this.request = fi.getRequest();
    }

    public boolean isSystemAdmin() {
        User user = userService.getUserFromSecurityContext();
        return user != null && user.isSystemAdmin();
    }
View Full Code Here

        User user = userService.getUserFromSecurityContext();
        return user != null && user.isSystemAdmin();
    }

    public boolean isGroupAdmin() {
        User user = userService.getUserFromSecurityContext();
        return user != null && user.isGroupAdmin();
    }
View Full Code Here

        User user = userService.getUserFromSecurityContext();
        return user != null && user.isGroupAdmin();
    }

    public boolean isOrganizationAdmin() {
        User user = userService.getUserFromSecurityContext();
        return user != null && user.isOrganizationAdmin();
    }
View Full Code Here

TOP

Related Classes of com.sparc.knappsack.components.entities.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.