| | |
| | | package com.xcong.excoin.common.system.controller; |
| | | |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.asymmetric.KeyType; |
| | |
| | | @ApiOperation(value = "登陆接口", notes = "登陆接口") |
| | | @PostMapping("/login") |
| | | public Result login(@RequestBody @Validated LoginDto loginDto) { |
| | | // 使用md5加密前端传来的密码 |
| | | Sign sign = SecureUtil.sign(SignAlgorithm.MD5withRSA); |
| | | byte[] pwdByte = sign.sign(loginDto.getPassword().getBytes()); |
| | | |
| | | // 将账号密码交给spring security验证,并调用userServiceDetails |
| | | UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(loginDto.getUsername(), loginDto.getPassword()); |
| | | UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(loginDto.getUsername(), SecureUtil.md5(loginDto.getPassword())); |
| | | Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authToken); |
| | | |
| | | // 获取当前验证过后的用户 |