public ActionResult Verify() { //回调地址 var callBackUrl = RequestUtils.GetString("CallBackUrl"); //根据CallBack地址 先拿到请求是属于哪一个客户端 var webAppInfo = _webAppManager.GetWebAppInfoByUrl(callBackUrl); if (webAppInfo == null) { _logger.ErrorFormat("WebAppInfo:WebAppInfo is null. CallBackUrl is {0}", callBackUrl); //如果该系统不存在,那么直接提示错误,或者其他信息 return(Redirect(UrlUtils.GetErrorUrl())); } //生成WebAppId,并缓存 var cacheKey = _webAppManager.GetCacheKey(webAppInfo.WebAppId); //获取TGC,如果TGC不存在,直接跳转到登陆页面 var account = _ticketGrantingManager.GetTicketGranting(); //如果账号为空,直接跳转到登陆页面 if (account == null) { return(Redirect(UrlUtils.GetLoginUrl(cacheKey, callBackUrl))); } //如果账号不为空,代表登陆过,那么就生成Ticket var ticket = _ticketManager.CreateTicket(account.AccountId, account.Code); var url = UrlUtils.GetClientVerifyTicketUrl(webAppInfo, ticket, callBackUrl); return(Redirect(url)); }