MVC4 Single Sign-on three CAS client configuration

Source: Internet
Author: User
Tags ticket

The previous blog explains the configuration of the CAS server, this blog for everyone to talk about the CAS client configuration!

The first step to build a project

Create a new MVC project on your own.

Second Step Add reference

After you have downloaded the file from the beginning of the previous blog, copy the DotNetCasClient.dll file from the Dotnet-client-1.0.2-bin file to the Bin folder and add the DotNetCasClient.dll reference.

Third Step add view

Create a new controller in the controller named HomeController, and then add a corresponding view for the index inside! You can see the---- Login Instance of the blog MVC series. In the inside there is a very detailed explanation!

Fourth step to modify the configuration file

Below is I set up the project configuration file, according to this configuration file for modification can be, a total of 6 places need to be modified! The instructions for each node have been written!

<span style= "FONT-SIZE:18PX;" ><configuration> <!--cas start-up <configSections> <!--define casclientconfig--> <sectionname = "Casclientconfig" type= "dotnetcasclient.configuration.casclientconfiguration,dotnetcasclient"/> </ Configsections> <!--CAs Close-up <!-cas start-up <!--CAS configuration casclientconfig--> <!--casserverlogin    The URL requires a URL to the CAs login form. ServerName requires host name hosting this application server. This is used to generate a URL that will be sent to the CAS server redirection. The CAS server must be able to resolve this host name.    Is the address of your application to be sure to write the address of the current application!    Casserverurlprefix requires the URL of the CAS server application root. Ticketvalidatorname requires the ticket validator to verify that the CAS ticket uses a specific protocol name.  Valid values are CAS10 CAS20 saml11,. Singlesignout enables the application to receive CAS single-point-of-departure information when the user's logon session ends. This causes the application to be compromised by the user's session.    The default is true. The other is optional--<casclientconfig casserverloginurl= "Http://192.168.24.247:8089/cas/login" casserverurlprefix= "    http://192.168.24.247:8089/cas/"Servername=" http://localhost:1255 "redirectaftervalidation=" true "renew=" false " Singlesignout= "true" TicketvalidatorName= "CAS20" serviceticketmanager= "Cacheserviceticketmanager"/> <!-cas End--<appSettings> <addke Y= "Webpages:version" value= "2.0.0.0"/> <addkey= "webpages:enabled" value= "false"/> <addkey= " Preserveloginurl "value=" true "/> <addkey=" clientvalidationenabled "value=" true "/> <addkey=" Unobtrusivejavascriptenabled "value=" true "/> </appSettings> <system.web> <!-cas start configuration asp.netf      Orms the authentication section so that it points to a property that defines the login URL of the Casclientconfig casserverloginurlcas server.      The CAs login URL is also very important in both locations. Defaulturl the relative address of the default login jump--<authenticationmode= "Forms" > <formsloginurl= "http://192.168.24.247:8089/c              As/login "timeout=" "Defaulturl=" ~/home/index "cookieless=" UseCookies " Slidingexpiration= "true"/> <!--path= "/netcasclient"-</authentication> <authorization > <denyusers= "?" /></authorization><!-cas End--   

Fifth step look at the effect

After modifying the configuration file, you can test it! Just press CTRL + F5 to start!  If he goes directly to the CAs login interface, and the address bar http://192.168.24.247:8089/cas/login?service=http%3a%2f%2flocalhost%3a1255%2f Contains a service= ... of things. Then it means success! Enter the user name password if you enter the index page to indicate that your client configuration is successful!


So the configuration of the single sign-on client is done here!


MVC4 Single Sign-on three CAS client configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.