use of org.daijie.mybatis.model.User in project daijie-example by daijiejay.
the class LoginController method login.
@ApiOperation(notes = "登录", value = "登录")
@RequestMapping(value = "/login", method = RequestMethod.POST)
public ModelResult<Object> login(@RequestParam String username, @RequestParam String password) throws Exception {
// 公钥传给客户端
String publicKey = Auth.getPublicKey();
// 客户端调用登录接口时进行公钥加密后传参调用此接口
password = RSAUtil.encryptByPubKey(password, publicKey);
// 以下正式走登录流程
User user = userCloud.getUser(username).getData();
Auth.login(username, password, user.getSalt(), user.getPassword(), user);
// 加入角色权限
Auth.refreshRoles(new ArrayList<String>());
ArrayList<String> permissions = new ArrayList<String>();
permissions.add("USER");
Auth.refreshPermissions(permissions);
Auth.getPermissions();
return Result.build("登录成功", ApiResult.SUCCESS, ResultCode.CODE_200);
}
use of org.daijie.mybatis.model.User in project daijie-example by daijiejay.
the class UserService method getUser.
@Override
public ModelResult<User> getUser(@PathVariable(name = "userName") String userName) {
User user = new User();
user.setUserName(userName);
return Result.build(userMapper.selectOne(user));
}
Aggregations