com.xxl.job.admin.controller.interceptor.PermissionInterceptor Java Examples

The following examples show how to use com.xxl.job.admin.controller.interceptor.PermissionInterceptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IndexController.java    From open-capacity-platform with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value="login", method=RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit=false)
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember){
	// valid
	if (PermissionInterceptor.ifLogin(request)) {
		return ReturnT.SUCCESS;
	}

	// param
	if (StringUtils.isBlank(userName) || StringUtils.isBlank(password)){
		return new ReturnT<String>(500, I18nUtil.getString("login_param_empty"));
	}
	boolean ifRem = (StringUtils.isNotBlank(ifRemember) && "on".equals(ifRemember))?true:false;

	// do login
	boolean loginRet = PermissionInterceptor.login(response, userName, password, ifRem);
	if (!loginRet) {
		return new ReturnT<String>(500, I18nUtil.getString("login_param_unvalid"));
	}
	return ReturnT.SUCCESS;
}
 
Example #2
Source File: IndexController.java    From microservices-platform with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value="login", method=RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit=false)
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember){
	// valid
	if (PermissionInterceptor.ifLogin(request)) {
		return ReturnT.SUCCESS;
	}

	// param
	if (StringUtils.isBlank(userName) || StringUtils.isBlank(password)){
		return new ReturnT<String>(500, I18nUtil.getString("login_param_empty"));
	}
	boolean ifRem = (StringUtils.isNotBlank(ifRemember) && "on".equals(ifRemember))?true:false;

	// do login
	boolean loginRet = PermissionInterceptor.login(response, userName, password, ifRem);
	if (!loginRet) {
		return new ReturnT<String>(500, I18nUtil.getString("login_param_unvalid"));
	}
	return ReturnT.SUCCESS;
}
 
Example #3
Source File: IndexController.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "login", method = RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit = false)
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember) {
    // valid
    if (PermissionInterceptor.ifLogin(request)) {
        return ReturnT.SUCCESS;
    }

    // param
    if (StrUtil.isBlank(userName) || StrUtil.isBlank(password)) {
        return new ReturnT<String>(500, I18nUtil.getString("login_param_empty"));
    }
    boolean ifRem = (StrUtil.isNotBlank(ifRemember) && "on".equals(ifRemember)) ? true : false;

    // do login
    boolean loginRet = PermissionInterceptor.login(response, userName, password, ifRem);
    if (!loginRet) {
        return new ReturnT<String>(500, I18nUtil.getString("login_param_unvalid"));
    }
    return ReturnT.SUCCESS;
}
 
Example #4
Source File: IndexController.java    From zuihou-admin-cloud with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "login", method = RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit = false)
public ReturnT<String> loginDo(HttpServletRequest request, HttpServletResponse response, String userName, String password, String ifRemember) {
	// valid
	if (PermissionInterceptor.ifLogin(request)) {
		return ReturnT.SUCCESS;
	}

	// param
	if (StrUtil.isBlank(userName) || StrUtil.isBlank(password)) {
		return new ReturnT<String>(500, I18nUtil.getString("login_param_empty"));
	}
	boolean ifRem = (StrUtil.isNotBlank(ifRemember) && "on".equals(ifRemember)) ? true : false;

	// do login
	boolean loginRet = PermissionInterceptor.login(response, userName, password, ifRem);
	if (!loginRet) {
		return new ReturnT<String>(500, I18nUtil.getString("login_param_unvalid"));
	}
	return ReturnT.SUCCESS;
}
 
Example #5
Source File: IndexController.java    From open-capacity-platform with Apache License 2.0 5 votes vote down vote up
@RequestMapping("/toLogin")
@PermessionLimit(limit=false)
public String toLogin(Model model, HttpServletRequest request) {
	if (PermissionInterceptor.ifLogin(request)) {
		return "redirect:/";
	}
	return "login";
}
 
Example #6
Source File: IndexController.java    From open-capacity-platform with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value="logout", method=RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit=false)
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response){
	if (PermissionInterceptor.ifLogin(request)) {
		PermissionInterceptor.logout(request, response);
	}
	return ReturnT.SUCCESS;
}
 
Example #7
Source File: IndexController.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
@RequestMapping("/toLogin")
@PermessionLimit(limit=false)
public String toLogin(Model model, HttpServletRequest request) {
	if (PermissionInterceptor.ifLogin(request)) {
		return "redirect:/";
	}
	return "login";
}
 
Example #8
Source File: IndexController.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value="logout", method=RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit=false)
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response){
	if (PermissionInterceptor.ifLogin(request)) {
		PermissionInterceptor.logout(request, response);
	}
	return ReturnT.SUCCESS;
}
 
Example #9
Source File: JobInfoControllerTest.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void login() throws Exception {
  MvcResult ret = mockMvc.perform(
      post("/login")
          .contentType(MediaType.APPLICATION_FORM_URLENCODED)
          .param("userName", XxlJobAdminConfig.getAdminConfig().getLoginUsername())
          .param("password", XxlJobAdminConfig.getAdminConfig().getLoginPassword())
  ).andReturn();
  cookie = ret.getResponse().getCookie(PermissionInterceptor.LOGIN_IDENTITY_KEY);
}
 
Example #10
Source File: IndexController.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
@RequestMapping("/toLogin")
@PermessionLimit(limit = false)
public String toLogin(Model model, HttpServletRequest request) {
    if (PermissionInterceptor.ifLogin(request)) {
        return "redirect:/";
    }
    return "login";
}
 
Example #11
Source File: IndexController.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "logout", method = RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit = false)
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response) {
    if (PermissionInterceptor.ifLogin(request)) {
        PermissionInterceptor.logout(request, response);
    }
    return ReturnT.SUCCESS;
}
 
Example #12
Source File: IndexController.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
@RequestMapping("/toLogin")
@PermessionLimit(limit = false)
public String toLogin(Model model, HttpServletRequest request) {
	if (PermissionInterceptor.ifLogin(request)) {
		return "redirect:/";
	}
	return "login";
}
 
Example #13
Source File: IndexController.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "logout", method = RequestMethod.POST)
@ResponseBody
@PermessionLimit(limit = false)
public ReturnT<String> logout(HttpServletRequest request, HttpServletResponse response) {
	if (PermissionInterceptor.ifLogin(request)) {
		PermissionInterceptor.logout(request, response);
	}
	return ReturnT.SUCCESS;
}