| | |
| | | this.applicationProperty = applicationProperty; |
| | | } |
| | | |
| | | @PostMapping("/bySMS") |
| | | public ResponseEntity<OtpResponseDTO> sendOtpBySMS(@RequestBody OtpSMSLoginVM login) throws ServiceException, RemoteException { |
| | | @GetMapping("/bySMS") |
| | | public ResponseEntity<OtpResponseDTO> sendOtpBySMS(@RequestParam("phone") String phone) throws ServiceException, RemoteException { |
| | | OtpWebServiceLocator locator = new OtpWebServiceLocator(); |
| | | locator.setOtpWebServicePortEndpointAddress(applicationProperty.getOtpWebServiceUrl()); |
| | | |
| | | OtpWebServicePortBindingStub otpWebServicePort = (OtpWebServicePortBindingStub) locator.getOtpWebServicePort(); |
| | | String[] result = |
| | | otpWebServicePort.sendOtpBySMS(applicationProperty.getOtpWebServicePassword(), applicationProperty.getOtpWebServiceSystemType(), login.getPhone()); |
| | | otpWebServicePort.sendOtpBySMS(applicationProperty.getOtpWebServicePassword(), applicationProperty.getOtpWebServiceSystemType(), phone); |
| | | |
| | | return new ResponseEntity<>(new OtpResponseDTO(result), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping("/byEmail") |
| | | public ResponseEntity<OtpResponseDTO> sendOtpByEmail(@RequestBody OtpEmailLoginVM login) throws RemoteException, ServiceException { |
| | | @GetMapping("/byEmail") |
| | | public ResponseEntity<OtpResponseDTO> sendOtpByEmail(@RequestParam("email") String email) throws RemoteException, ServiceException { |
| | | OtpWebServiceLocator locator = new OtpWebServiceLocator(); |
| | | locator.setOtpWebServicePortEndpointAddress(applicationProperty.getOtpWebServiceUrl()); |
| | | |
| | | OtpWebServicePortBindingStub otpWebServicePort = (OtpWebServicePortBindingStub) locator.getOtpWebServicePort(); |
| | | String[] result = |
| | | otpWebServicePort.sendOtpByEmail(applicationProperty.getOtpWebServicePassword(), applicationProperty.getOtpWebServiceSystemType(), login.getEmail()); |
| | | otpWebServicePort.sendOtpByEmail(applicationProperty.getOtpWebServicePassword(), applicationProperty.getOtpWebServiceSystemType(), email); |
| | | |
| | | return new ResponseEntity<>(new OtpResponseDTO(result), HttpStatus.OK); |
| | | } |
| | |
| | | } |
| | | |
| | | // todo: 這裡移動到認證授權的provider |
| | | @PostMapping("/byEService") |
| | | public ResponseEntity<EServiceResponse> loginByEService(@RequestBody EServiceRequestVM param) throws Exception { |
| | | return loginService.loginByEService(param); |
| | | @GetMapping("/byEService") |
| | | public ResponseEntity<EServiceResponse> loginByEService(@RequestParam("account") String account, @RequestParam("password") String password) throws Exception { |
| | | return loginService.loginByEService(account, password); |
| | | } |
| | | } |