Commit 769b4aa0 authored by 周健威's avatar 周健威

添加数据中心验证代码

parent 53a367a5
...@@ -72,9 +72,7 @@ public class AuthController { ...@@ -72,9 +72,7 @@ public class AuthController {
if (requestType == null || requestType.trim().equals("")) { if (requestType == null || requestType.trim().equals("")) {
requestType = RequestTypeConstants.BASE; requestType = RequestTypeConstants.BASE;
} }
final String token; String token = null;
String name = "";
OAuthService service = (OAuthService)request.getSession().getAttribute("oauthv20service"); OAuthService service = (OAuthService)request.getSession().getAttribute("oauthv20service");
if(service==null){ if(service==null){
...@@ -90,14 +88,15 @@ public class AuthController { ...@@ -90,14 +88,15 @@ public class AuthController {
Token EMPTY_TOKEN = null; Token EMPTY_TOKEN = null;
Verifier verifier = new Verifier(request.getParameter("code")); Verifier verifier = new Verifier(request.getParameter("code"));
Token accessTokeToken = service.getAccessToken(EMPTY_TOKEN, verifier); Token accessTokeToken = service.getAccessToken(EMPTY_TOKEN, verifier);
if(accessTokeToken.getAccess_token() != null) {
OAuthClient restClient=new OAuthClient("https://gdxm.upyuns.com/sign/api/oauth/v20/me"); OAuthClient restClient=new OAuthClient("https://gdxm.upyuns.com/sign/api/oauth/v20/me");
UserInfo userInfo=restClient.getUserInfo(accessTokeToken.getAccess_token()); UserInfo userInfo=restClient.getUserInfo(accessTokeToken.getAccess_token());
JwtAuthenticationRequest authenticationRequest = new JwtAuthenticationRequest(userInfo.getUsername(), null, JwtAuthenticationRequest.CHECKPASS_NO); JwtAuthenticationRequest authenticationRequest = new JwtAuthenticationRequest(userInfo.getUsername(), null, JwtAuthenticationRequest.CHECKPASS_NO);
if (RequestTypeConstants.APP.equals(requestType)) { if (RequestTypeConstants.APP.equals(requestType)) {
token = appAuthService.login(authenticationRequest); token = appAuthService.login(authenticationRequest);
} else { } else {
token = authService.login(authenticationRequest); token = authService.login(authenticationRequest);
}
} }
return new ObjectRestResponse<String>().data(token); return new ObjectRestResponse<String>().data(token);
} }
......
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