Commit b59e6aa3 authored by huyuchen's avatar huyuchen

cas修改

parent 7aaf5d78
...@@ -23,7 +23,6 @@ import org.springframework.web.client.RestTemplate; ...@@ -23,7 +23,6 @@ import org.springframework.web.client.RestTemplate;
import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -57,20 +56,15 @@ public class PasswordDecoderFilter extends UsernamePasswordAuthenticationFilter ...@@ -57,20 +56,15 @@ public class PasswordDecoderFilter extends UsernamePasswordAuthenticationFilter
username = username != null ? username : ""; username = username != null ? username : "";
username = username.trim(); username = username.trim();
String tgt = "";
if (Common.isNotNull(result)) { if (Common.isNotNull(result)) {
try { try {
for (Cookie cookie : request.getCookies()) {
tgt = cookie.getValue();
break;
}
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>(); MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("service", CASproperties.CLIENT_LOGIN_PAGE); wholeForm.add("service", CASproperties.CLIENT_LOGIN_PAGE);
HttpEntity<MultiValueMap<String,Object>> entity = new org.springframework.http.HttpEntity<>(wholeForm,headers); HttpEntity<MultiValueMap<String,Object>> entity = new org.springframework.http.HttpEntity<>(wholeForm,headers);
ResponseEntity<String> obj = restTemplate.exchange(CASproperties.SPRING_SECURITY_CAS_SERVER + "/" + tgt, HttpMethod.POST, entity, String.class); ResponseEntity<String> obj = restTemplate.exchange(CASproperties.SPRING_SECURITY_CAS_SERVER + "/" + result, HttpMethod.POST, entity, String.class);
if (obj.getStatusCode().value() == 200) { if (obj.getStatusCode().value() == 200) {
String st = obj.getBody(); String st = obj.getBody();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment