保誠-保戶業務員媒合平台
Tomas
2023-09-14 e828225de7636d0195db2c3c9b1701a5b2f12049
pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java
@@ -58,18 +58,20 @@
                    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);