| | |
| | | return getConsultantTokenAndRecordLoginTime(account, credentials); |
| | | } |
| | | else { |
| | | throw new EServiceErrorException(eServiceResponse.getMsg()); |
| | | log.debug("account:{},error:{}",account,eServiceResponse.getMsg()); |
| | | throw new EServiceErrorException("帳號密碼錯誤"); |
| | | } |
| | | } |
| | | |
| | | throw new RuntimeException("eService http error!, response http status code = " + responseEntity.getStatusCode()); |
| | | } catch (GeneralSecurityException e) { |
| | | log.error("General Security SSL error!",e); |
| | | throw new RuntimeException("General Security SSL error!"); |
| | | } |
| | | } |
| | | |
| | | private UsernamePasswordAuthenticationToken getConsultantTokenAndRecordLoginTime(String account, String credential) throws ConsultantDisableException { |
| | | Consultant consultant = consultantRepository.findOneByAgentNo(account).orElseThrow(() -> new UsernameNotFoundException("該顧問資料並不存在於媒合平台系統中")); |
| | | Consultant consultant = consultantRepository.findOneByAgentNo(account).orElseThrow(() -> new UsernameNotFoundException("帳號密碼錯誤")); |
| | | |
| | | List<GrantedAuthority> grantedAuths = Arrays.asList(new SimpleGrantedAuthority("ROLE_USER")); |
| | | UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(account, credential, grantedAuths); |