From e28415e8f6d76ddcf0c936027669c22ed2b2e05d Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期四, 25 十一月 2021 13:48:37 +0800
Subject: [PATCH] [update] 嚴選配對、快速搜尋的滿意度調整為equal

---
 pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java b/pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java
index 35a6ce8..6d3e961 100644
--- a/pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java
+++ b/pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java
@@ -1,5 +1,6 @@
 package com.pollex.pam.security.provider;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.pollex.pam.config.ApplicationProperties;
 import com.pollex.pam.domain.Consultant;
@@ -20,6 +21,7 @@
 import org.springframework.http.converter.HttpMessageConverter;
 import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
 import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
+import org.springframework.security.authentication.AuthenticationServiceException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
@@ -30,6 +32,7 @@
 import org.springframework.web.client.RestTemplate;
 
 import javax.net.ssl.SSLContext;
+import java.security.GeneralSecurityException;
 import java.security.KeyManagementException;
 import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
@@ -63,11 +66,15 @@
                 if(E_SERVICE_LOGIN_SUCCESS_CODE.equals(eServiceResponse.getCode())){
                     return getConsultantToken(account, credentials);
                 }
+
+                throw new RuntimeException("eService login failed, eService response code = " + eServiceResponse.getCode());
             }
 
-            throw new AuthenticationCredentialsNotFoundException("");
-        } catch (Exception e) {
-            throw new AuthenticationCredentialsNotFoundException("");
+            throw new RuntimeException("eService http error!, response http status code = " + responseEntity.getStatusCode());
+        } catch (JsonProcessingException e) {
+            throw new AuthenticationServiceException("convert to json processing error!");
+        } catch (GeneralSecurityException e) {
+            throw new AuthenticationServiceException("General Security SSL error!");
         }
     }
 
@@ -86,7 +93,7 @@
         return authenticationToken;
     }
 
-    private ResponseEntity<EServiceResponse> loginByEService(String account, String paxxword) throws Exception{
+    private ResponseEntity<EServiceResponse> loginByEService(String account, String paxxword) throws JsonProcessingException, GeneralSecurityException {
         EServiceRequest dto = new EServiceRequest();
         dto.setFunc("ValidateUserLogin");
         dto.setId(account);

--
Gitblit v1.8.0