| | |
| | | import javax.servlet.http.HttpSession; |
| | | import javax.swing.*; |
| | | import java.io.IOException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.SecureRandom; |
| | | |
| | | @RequestMapping("login") |
| | | @RestController |
| | | @Api(tags = "登录") |
| | | public class LoginController { |
| | | public class LoginController extends BaseController{ |
| | | |
| | | @Autowired |
| | | private LoginService service; |
| | |
| | | public Response login(@RequestParam String userName, String password,HttpServletRequest request){ |
| | | return service.login(userName,password,request); |
| | | } |
| | | @PostMapping("loginByRSA") |
| | | @ApiOperation(value ="登录-账号密码加密") |
| | | public Response loginByRSA(@RequestParam String userName, String password,String deliveredCode,HttpServletRequest request,Integer validCode){ |
| | | return service.loginByRSA(userName,password,deliveredCode,request,validCode); |
| | | } |
| | | |
| | | @PostMapping("loginWithUKey") |
| | | @ApiOperation(value ="登录-uKey-TODO") |
| | | public Response loginWithUKey(@RequestParam String userName, String password,HttpServletRequest request){ |
| | | return service.loginWithUKey(userName,password,request); |
| | | public Response loginWithUKey(@RequestParam String userName, |
| | | @RequestParam String password, |
| | | @RequestParam String uKeyId, |
| | | HttpServletRequest request){ |
| | | return service.loginWithUKey(userName,password,uKeyId,request); |
| | | } |
| | | |
| | | @GetMapping("/getRandom") |
| | | @ApiOperation(value = "uKey校验前生成随机数") |
| | | public Response getRandom(){ |
| | | int randomNum = (int)((Math.random()*9+1)*10000); |
| | | public Response getRandom() throws NoSuchAlgorithmException { |
| | | //int randomNum = (int)((Math.random()*9+1)*10000); |
| | | SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); |
| | | int randomNum = random.nextInt(100000); |
| | | ActionUtil.getSession().setAttribute("uKeyRandom",String.valueOf(randomNum)); |
| | | return new Response().set(1,randomNum); |
| | | } |
| | |
| | | return response; |
| | | } |
| | | |
| | | @GetMapping("loginNoPass") |
| | | @ApiOperation(value = "免密登录") |
| | | public Response loginNoPass(@RequestParam int uId,HttpServletRequest request){ |
| | | return service.loginNoPass(uId,request); |
| | | } |
| | | |
| | | } |