Package com.sishuok.es.sys.user.entity

Examples of com.sishuok.es.sys.user.entity.User


            return true;
        }

        String username = (String) subject.getPrincipal();
        //此处注意缓存 防止大量的查询db
        User user = userService.findByUsername(username);
        //把当前用户放到session中
        request.setAttribute(Constants.CURRENT_USER, user);
        //druid监控需要
        ((HttpServletRequest)request).getSession().setAttribute(Constants.CURRENT_USERNAME, username);
View Full Code Here


    }


    @Override
    protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
        User user = (User) request.getAttribute(Constants.CURRENT_USER);
        if (user == null) {
            return true;
        }

        if (Boolean.TRUE.equals(user.getDeleted()) || user.getStatus() == UserStatus.blocked) {
            getSubject(request, response).logout();
            saveRequestAndRedirectToLogin(request, response);
            return false;
        }
        return true;
View Full Code Here

        saveRequestAndRedirectToLogin(request, response);
        return true;
    }

    protected void redirectToLogin(ServletRequest request, ServletResponse response) throws IOException {
        User user = (User) request.getAttribute(Constants.CURRENT_USER);
        String url = null;
        if (Boolean.TRUE.equals(user.getDeleted())) {
            url = getUserNotfoundUrl();
        } else if (user.getStatus() == UserStatus.blocked) {
            url = getUserBlockedUrl();
        } else {
            url = getUserUnknownErrorUrl();
        }
View Full Code Here

     * @return
     */
    @Override
    public String getSuccessUrl() {
        String username = (String) SecurityUtils.getSubject().getPrincipal();
        User user = userService.findByUsername(username);
        if (user != null && Boolean.TRUE.equals(user.getAdmin())) {
            return getAdminDefaultSuccessUrl();
        }
        return getDefaultSuccessUrl();
    }
View Full Code Here

            OnlineSession onlineSession = (OnlineSession) session;
            request.setAttribute(ShiroConstants.ONLINE_SESSION, onlineSession);
            //把user id设置进去
            boolean isGuest = onlineSession.getUserId() == null || onlineSession.getUserId() == 0L;
            if (isGuest == true) {
                User user = (User) request.getAttribute(Constants.CURRENT_USER);
                if (user != null) {
                    onlineSession.setUserId(user.getId());
                    onlineSession.setUsername(user.getUsername());
                    onlineSession.markAttributeChanged();
                }
            }

            if (onlineSession.getStatus() == OnlineSession.OnlineStatus.force_logout) {
View Full Code Here

        //模拟一个假的NotificationApi
        excelDataService.setNotificationApi(Mockito.mock(NotificationApi.class));
        //移除异步支持
        AopProxyUtils.removeAsync(excelDataService);

        user = new User();
        user.setId(1L);
        user.setUsername("zhang");
    }
View Full Code Here

        //模拟一个假的NotificationApi
        excelDataService.setNotificationApi(Mockito.mock(NotificationApi.class));
        //移除异步支持
        AopProxyUtils.removeAsync(excelDataService);

        user = new User();
        user.setId(1L);
        user.setUsername("zhang");
    }
View Full Code Here

    }


    @Test(expected = LockedAccountException.class)
    public void testLoginFailWithSysBlocked() {
        User user = createUser(username, password);
        userService.changeStatus(user, user, UserStatus.blocked, "sql");

        UsernamePasswordToken upToken = new UsernamePasswordToken(username, password);
        Subject subject = SecurityUtils.getSubject();
        subject.login(upToken);
View Full Code Here

        subject.login(upToken);
    }


    private User createUser(String username, String password) {
        User user = new User();
        user.setUsername(username);
        user.setEmail(email);
        user.setMobilePhoneNumber(mobilePhoneNumber);
        user.setPassword(password);
        userService.saveAndFlush(user);
        return user;
    }
View Full Code Here

    @Test
    public void testClearDeletedAuthRelationForDefaultGroup() {
        executeSqlScript("sql/intergration-test-defualt-user-group-data.sql", false);

        User user = userService.findOne(1L);
        Set<String> roles = userAuthService.findStringRoles(user);
        Assert.assertEquals(1, roles.size());

        groupService.delete(1L);
        clear();
View Full Code Here

TOP

Related Classes of com.sishuok.es.sys.user.entity.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.