|
|
|
|
@ -1,9 +1,7 @@ |
|
|
|
|
package org.springblade.auth.granter; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.yawei.pso.SSOResponse; |
|
|
|
|
import com.yawei.pso.TicketManager; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.springblade.auth.constant.AuthConstant; |
|
|
|
|
import org.springblade.auth.service.BladeUserDetails; |
|
|
|
|
import org.springblade.auth.utils.TokenUtil; |
|
|
|
|
@ -19,17 +17,13 @@ import org.springframework.security.core.Authentication; |
|
|
|
|
import org.springframework.security.core.authority.AuthorityUtils; |
|
|
|
|
import org.springframework.security.oauth2.common.exceptions.InvalidGrantException; |
|
|
|
|
import org.springframework.security.oauth2.common.exceptions.InvalidRequestException; |
|
|
|
|
import org.springframework.security.oauth2.common.exceptions.UnauthorizedUserException; |
|
|
|
|
import org.springframework.security.oauth2.common.exceptions.UserDeniedAuthorizationException; |
|
|
|
|
import org.springframework.security.oauth2.provider.*; |
|
|
|
|
import org.springframework.security.oauth2.provider.token.AbstractTokenGranter; |
|
|
|
|
import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author ytl |
|
|
|
|
@ -61,6 +55,7 @@ public class YaweiTokenGranter extends AbstractTokenGranter { |
|
|
|
|
Map<String, String> parameters = new LinkedHashMap<>(tokenRequest.getRequestParameters()); |
|
|
|
|
// 金宏来源
|
|
|
|
|
String ssoToken = parameters.get("SSOToken"); |
|
|
|
|
ssoToken = "3JORfctchfvnMgitTjT7g2NWNZJNMaFTy6GLppUSBy7W1ga5b2BsC4RlnHplxDd8DxBKW9Ep0uBzqzm9YK3ioSHUIHI63dQb9qT31PPJLUIAG4Z25dVKPYEfGY3J1xQVqo+5NudKeSmPmAilF4oDLTJTQsW5IuVjrQk4K+ILX+xvkZSsS1fkDvQQVq2hj/rl2YnlCad18sK4azKwPbpzdKCpox55/kmeUJpm0hi5k3+Gg8lx42OrY+74/R/1kZqG"; |
|
|
|
|
R<UserInfo> result; |
|
|
|
|
BladeUserDetails bladeUserDetails; |
|
|
|
|
|
|
|
|
|
@ -84,7 +79,7 @@ public class YaweiTokenGranter extends AbstractTokenGranter { |
|
|
|
|
TicketManager tm; |
|
|
|
|
try { |
|
|
|
|
tm = ssoResp.CreatePSOTicket(); |
|
|
|
|
result = userClient.userInfo(StringPool.EMPTY, tm.getUserName()); |
|
|
|
|
result = userClient.userInfo(StringPool.EMPTY, tm.getUserID()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
// result = userClient.userInfo(StringPool.EMPTY, "jiangzx");
|
|
|
|
|
throw new InvalidGrantException("SSOToken解析失败!"); |
|
|
|
|
|