| | |
| | | ResponseEntity<EServiceResponse> responseEntity = loginByEService(account, credentials); |
| | | if(HttpStatus.OK.equals(responseEntity.getStatusCode())) { |
| | | EServiceResponse eServiceResponse = responseEntity.getBody(); |
| | | log.debug("eService response = {}", eServiceResponse); |
| | | |
| | | if(E_SERVICE_LOGIN_SUCCESS_CODE.equals(eServiceResponse.getCode())){ |
| | | loginRecordService.saveEServiceLoginSuccessRecord(account); |
| | |
| | | } |
| | | |
| | | private UsernamePasswordAuthenticationToken getConsultantToken(String account, String credential) { |
| | | Consultant consultant = consultantRepository.findOneByAgentNo(account).orElseThrow(() -> new UsernameNotFoundException("consultant is not in db, consultant agentNo = " + account)); |
| | | Consultant consultant = consultantRepository.findOneByAgentNo(account).orElseThrow(() -> new UsernameNotFoundException("該顧問資料並不存在於媒合平台系統中")); |
| | | |
| | | List<GrantedAuthority> grantedAuths = Arrays.asList(new SimpleGrantedAuthority("ROLE_USER")); |
| | | UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(account, credential, grantedAuths); |