使用单点登录。我们已经实现了CAS。单点登录有效,但单点登录无效。
在web. config中,CAS的配置如下:
<section name="casClientConfig" type="DotNetCasClient.Configuration.CasClientConfiguration, DotNetCasClient"/>
<casClientConfig
casServerLoginUrl="http://aus-vc-bdpu-tl1.argous.com:8100/cas/login"
casServerUrlPrefix=" http://au-vc-bdpu-tl1.argous.com:8100/cas"
serverName="http://localhost:53124/"
cookiesRequiredUrl="~/CookiesRequired.aspx"
redirectAfterValidation="true" gateway="false" renew="false" singleSignOut="true"
ticketTimeTolerance="50000000"
ticketValidatorName="Saml11" proxyTicketManager="CacheProxyTicketManager"
serviceTicketManager="CacheServiceTicketManager"
gatewayStatusCookieName="CasGatewayStatus"/>
我添加了以下代码以清除注销功能上的cookie:
ClearAuthCookie();
string redirectPage = System.Configuration.ConfigurationSettings.AppSettings["CASurl"];
Response.Redirect(redirectPage, true);
public static void ClearAuthCookie()
{
HttpContext current = HttpContext.Current;
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName);
cookie.Expires = DateTime.Now.AddMonths(-1);
cookie.Domain = FormsAuthentication.CookieDomain;
cookie.Path = FormsAuthentication.FormsCookiePath;
current.Response.Cookies.Add(cookie);
}
我有两个问题:
(1)在注销时,页面被重定向到所需的页面,但是如果我通过返回按钮返回到我的应用程序主页并单击各种链接,页面会导航到链接,而不是要求用户登录。因此注销不成功。
(2)当用户使用单点登录在另一个应用程序上并且如果他从另一个应用程序注销时,用户仍然可以访问我们的网站的父应用程序。因此单点退出不起作用
请你能建议我在这里错过了什么来工作吗?
您现在可能已经弄清楚了-但是您必须为此使用的命令是:
CasAuthentication.SingleSignOut();
这将创建重定向到CAS服务器以进行服务器注销并删除本地身份验证Cookeies
另见SO答案