.net MVC with JASIG-CAS
Using official .net Cas client and modify web.config
- Register casClientConfig Section
<configSections> <section name="casClientConfig" type="DotNetCasClient.Configuration.CasClientConfiguration, DotNetCasClient"/> <!-- Other custom sections here --> </configSections>
- Place a configuration element directly under the root element.
<casClientConfig casServerLoginUrl="https://server.example.com/cas/login" casServerUrlPrefix="https://server.example.com/cas/" serverName="https://client.example.com:8443" notAuthorizedUrl="~/NotAuthorized.aspx" cookiesRequiredUrl="~/CookiesRequired.aspx" redirectAfterValidation="true" renew="false" singleSignOut="true" ticketValidatorName="Cas20" serviceTicketManager="CacheServiceTicketManager" />
- Register CasAuthenticationModule with the ASP.NET pipeline by adding it to theandsections as demonstrated in the following configuration blocks.
<system.web> <!-- Other system.web elements here --> <httpModules> <add name="DotNetCasClient" type="DotNetCasClient.CasAuthenticationModule,DotNetCasClient"/> <!-- Other modules here --> </httpModules> </system.web>
<system.webServer> <!-- Disabled Integrated Mode configuration validation. This will allow a single deployment to run on IIS 5/6 and 7+ without errors --> <validation validateIntegratedModeConfiguration="false"/> <modules> <!-- Remove and Add the CasAuthenticationModule into the IIS7+ Integrated Pipeline. This has no effect on IIS5/6. --> <remove name="DotNetCasClient"/> <add name="DotNetCasClient" type="DotNetCasClient.CasAuthenticationModule,DotNetCasClient"/> <!-- Other modules here --> </modules> </system.webServer>
- Configure ASP.NET Forms Authentication
<system.web> <authentication mode="Forms"> <forms loginUrl="https://server.example.com/cas/login" timeout="30" defaultUrl="~/Default.aspx" cookieless="UseCookies" slidingExpiration="true" path="/ApplicationName/" /> </authentication> <!-- Other system.web elements here --> </system.web>