|
@ -199,7 +199,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
if (null == authenticatedClient) {
|
|
|
throw new InvalidRequestException("client_id");
|
|
|
}
|
|
|
logger.info("login:登录进入4");
|
|
|
logger.info("login:登录进入4"+authenticatedClient.getClientId());
|
|
|
|
|
|
TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
|
|
|
oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
|
|
|
OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
|
|
@ -209,15 +210,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
/*如果是移动端登陆则移除之前的token,
|
|
|
在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
|
|
|
实现同一账号只能在一处登陆*/
|
|
|
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
// if (request.getHeader("login-device") != null && request.getHeader("login-device").equals("mobile")) {
|
|
|
// tokenStore.removeAccessToken(token.getValue());
|
|
|
// tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
|
|
|
// token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
|
|
|
// }
|
|
|
// if (token == null) {
|
|
|
// throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
|
|
|
// }
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
|
|
|
tokenStore.removeAccessToken(token.getValue());
|
|
|
tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
|
|
|
token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
|
|
|
}
|
|
|
if (token == null) {
|
|
|
throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
|
|
|
}
|
|
|
WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
|
|
|
wlyyUserSimple.setAccessToken(token.getValue());
|
|
|
wlyyUserSimple.setTokenType(token.getTokenType());
|
|
@ -650,7 +651,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
在网关处通过HTTP状态码告知前端是过期 还是账号在别处登陆
|
|
|
实现同一账号只能在一处登陆*/
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
if (request.getHeader("login-device") != null && request.getHeader("login-device").equals("mobile")) {
|
|
|
if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
|
|
|
tokenStore.removeAccessToken(token.getValue());
|
|
|
tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
|
|
|
token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
|
|
@ -1511,15 +1512,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
/*如果是移动端登陆则移除之前的token,
|
|
|
在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
|
|
|
实现同一账号只能在一处登陆*/
|
|
|
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
// if (request.getHeader("login-device") != null && request.getHeader("login-device").equals("mobile")) {
|
|
|
// tokenStore.removeAccessToken(token.getValue());
|
|
|
// tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
|
|
|
// token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
|
|
|
// }
|
|
|
// if (token == null) {
|
|
|
// throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
|
|
|
// }
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
|
|
|
tokenStore.removeAccessToken(token.getValue());
|
|
|
tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
|
|
|
token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
|
|
|
}
|
|
|
if (token == null) {
|
|
|
throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
|
|
|
}
|
|
|
WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
|
|
|
wlyyUserSimple.setAccessToken(token.getValue());
|
|
|
wlyyUserSimple.setTokenType(token.getTokenType());
|