Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

The purpose of this tutorial is to outline the steps required to set up the ExampleWebsite ASP.NET web application, located at https://source.jasig.org/cas-clients/dotnet-client/trunk/ExampleWebSite/

System Environment

  1. Microsoft Visual Studio 2010 Professional Edition
  2. Windows 7 Professional AnkhSVN - Subversion Support for Visual Studio
  3. Internet Information Services 6 [Full Pack] (May be installed in "Windows Features")
  4. A git client such as GitExtensions

Set up the CAS Server

Follow the instructions at this link to setup an instance of the CAS server. Additional software may be required.

Set up ExampleWebsite in Visual Studio

Open the “DotNetCasClient.vs2010.sln” solution file. Visual Studio will download the artifacts to the project folder.

Image Removed

  • Navigate to where you have the ExampleWebsite project and open it. 
  • Right click on the ExampleWebsite app and selecting Select as Startup Project.
  • Right click on the DotNetCasClient app and select Build.
  • Add a Web.config file to the ExampleWebsite. Copy the contents of web.config.sample file into Web.config and modify the following sections:

...

  • Expand the node Certificates – Current User,Trusted Root Certification Authorities and then Certificates.
  • Make sure both certificates exist in the list. Also, copy all certificates and put them in Certificates – Local Computer - Trusted Root Certification Authorities.  This is required for IIS to validate and authenticate requests.

Configure CAS Server Credentials

You should configure the CAS server credentials so they match the ExampleWebsite accounts, which are defined in App_Data\UserRoles.xml.

  1. Locate the bean entry: $CATALINA_HOME/webapps/cas/WEB-INF/deployerConfigContext.xml

  2. Locate the bean entry: <bean class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />
  3. Replace it with the following:
Code Block
languagehtml/xml
titleCAS Server Credentials
<bean class="org.jasig.cas.adaptors.generic.AcceptUsersAuthenticationHandler">
  <property name="users">
    <map>
      <entry>
        <key><value>admin</value></key>
        <value>admin</value>
      </entry>
      <entry>
        <key><value>bob</value></key>
        <value>bob</value>
       </entry>
   </map>
  </property>
</bean>
Info
titleMaven Dependency

If you have not followed the WAR Overlay Method to deploy CAS, you need to make sure the following dependency is properly declared inside the cas pom.xml file.

Code Block
languagehtml/xml
<dependency>
 <groupId>org.jasig.cas</groupId>
 <artifactId>cas-server-support-generic</artifactId>
 <version>${cas.version}</version>
 <type>jar</type>
 <scope>runtime</scope>
</dependency>


Run

First, make sure you have the CAS server up and running and you can log into CAS using the above credentials.

For the web application, you can launch the project by pressing F5 in the Visual Studio Environment.  You should be redirected to: http://localhost:3273/ExampleWebSite/Default.aspx(after you have published the artifacts) you can browse to "https://<full-machine-name>" and you should be presented with the default page of the Example Website. 

Info
titleHTTPS & IIS

You may have to configure IIS server bindings, so access to https://<full-machine-name> can be granted.

 

Use the links on the left-hand side (i.e “Administrators Role Only”) to test the authentication mechanism. You should be redirected to CAS and after authenticating successfully with (i.e. admin/admin), you should be returned to the website and section allowed for admins onlyadmins only.