LoginController.java
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.server.web.controller;
import com.alibaba.fastjson.JSONObject;
import com.server.shiro.persistent.bean.SysUser;
import com.server.shiro.persistent.service.LoginService;
import com.server.utils.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(BaseController.OSS_NAMESPACE + "/login")
public class LoginController {
@Autowired
private LoginService loginService;
/**
* 登录
*
* @return
*/
@PostMapping("/auth")
public JSONObject authLogin(@RequestParam String username,@RequestParam String password) {
// CommonUtil.hasAllRequired(requestJson, "username,password");
JSONObject obj=new JSONObject();
obj.put("username",username);
obj.put("password", MD5.md5(MD5.md5(password)));
return loginService.authLogin(obj);
}
/**
* 查询当前登录用户的信息
*
* @return
*/
@PostMapping("/getInfo")
public SysUser getInfo() {
return loginService.getInfo();
}
/**
* 登出
*
* @return
*/
@GetMapping("/logout")
public void logout() {
loginService.logout();
}
}