<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Reference_Guide.ent">
%BOOK_ENTITIES;
]>
<section id="chap-Reference_Guide-SSO_Single_Sign_On">
	<title>SSO - Single Sign On</title>
	<section id="sect-Reference_Guide-Single_Sign_On-Overview">
		<title>Overview</title>
		<para>
			&PRODUCT; provides some form of Single Sign On (<literal>SSO</literal>) as an integration and aggregation platform.
		</para>
		<para>
			When logging into the portal users gain access to many systems through portlets using a single identity. In many cases, however, the portal infrastructure must be integrated with other SSO enabled systems. There are many different Identity Management solutions available. In most cases each SSO framework provides a unique way to plug into a Java EE application.
		</para>
		<section id="sect-Reference_Guide-Overview_of_SSO-Prerequisite">
			<title>Prerequisites</title>
			<para>
				In this tutorial, the SSO server is installed in a Tomcat installation. Tomcat can be obtained from <ulink type="http" url="http://tomcat.apache.org">http://tomcat.apache.org</ulink>.
			</para>
			<para>
				All the packages required for setup can be found in a zip file located at: <ulink type="http" url="http://repository.jboss.org/maven2/org/gatein/sso/sso-packaging">http://repository.jboss.org/maven2/org/gatein/sso/sso-packaging</ulink>. In this document we will call the directory where the file is extracted $GATEIN_SSO_HOME.
			</para>
			<para>
				Users are advised to not run any portal extensions that could override the data when manipulating the <filename>gatein.ear</filename> file directly.
			</para>
			<para>
				Remove <literal>$JBOSS_HOME/server/default/deploy/gatein-sample-extension.ear</literal> and <literal>$JBOSS_HOME/server/default/deploy/gatein-sample-portal.ear</literal> which are packaged by default with &PRODUCT;.
			</para>
		</section>

	</section>
	
	<section id="sect-Reference_Guide-Single_Sign_On-CAS_Central_Authentication_Service">
		<title>CAS - Central Authentication Service</title>
		<para>
			This Single Sign On plugin enables seamless integration between &PRODUCT; and the CAS Single Sign On Framework. Details about CAS can be found <ulink url="http://www.ja-sig.org/products/cas/">here</ulink>.
		</para>
		<para>
			The integration consists of two parts; the first part consists of installing or configuring a CAS server, the second part consists of setting up the portal to use the CAS server.
		</para>
		<section id="sect-Reference_Guide-CAS_Central_Authentication_Service-CAS_server">
			<title>CAS server</title>
			<para>
				First, set up the server to authenticate against the portal login module. In this example the CAS server will be installed on Tomcat.
			</para>
			<section id="sect-Reference_Guide-CAS_server-Obtaining_CAS">
				<title>Obtaining CAS</title>
				<para>
					CAS can be downloaded from <ulink type="http" url="http://www.jasig.org/cas/download">http://www.jasig.org/cas/download</ulink>.
				</para>
				<para>
					Extract the downloaded file into a suitable location. This location will be referred to as <literal>$CAS_HOME</literal> in the following example.
				</para>
			</section>
			
			<section id="sect-Reference_Guide-CAS_server-Modifying_CAS_server">
				<title>Modifying CAS server</title>
				<para>
					To configure the web archive as desired, the simplest way is to make the necessary changes directly in CAS codebase.
				</para>
            <note>
               <para>
                  To complete these instructions, and perform the final build step, you will need the Apache Maven 2.
                  You can get it <ulink type="http" url="http://maven.apache.org/download.html">here</ulink>.
               </para>
            </note>
				<para>
					First, we need to change the default authentication handler with the one provided by &PRODUCT;.
				</para>
				<para>
					The CAS Server Plugin makes secure authentication callbacks to a RESTful service installed on the remote GateIn server in order to authenticate a user.
				</para>
				<para>
					In order for the plugin to function correctly, it needs to be properly configured to connect to this service. This configuration is done via the <filename>cas.war/WEB-INF/deployerConfigContext.xml </filename> file.
				</para>
				<procedure>
					<step>
						<para>
							Open <filename>CAS_HOME/cas-server-webapp/src/main/webapp/WEB-INF/deployerConfigContext.xml</filename>
						</para>
					</step>
					<step>
						<para>
							Replace: 
<programlisting> &#60;!--
  | Whereas CredentialsToPrincipalResolvers identify who it is some Credentials might authenticate, 
  | AuthenticationHandlers actually authenticate credentials.  Here e declare the AuthenticationHandlers that
  | authenticate the Principals that the CredentialsToPrincipalResolvers identified.  CAS will try these handlers in turn
  | until it finds one that both supports the Credentials presented and succeeds in authenticating.
  +--&#62;
 &#60;property name=&#34;authenticationHandlers&#34;&#62;
   &#60;list&#62;
     &#60;!--
      | This is the authentication handler that authenticates services by means of callback via SSL, thereby validating
      | a server side SSL certificate.
      +--&#62;
     &#60;bean class=&#34;org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler&#34;
           p:httpClient-ref=&#34;httpClient&#34; /&#62;
     &#60;!--
      | This is the authentication handler declaration that every CAS deployer will need to change before deploying CAS 
      | into production.  The default SimpleTestUsernamePasswordAuthenticationHandler authenticates UsernamePasswordCredentials
      | where the username equals the password.  You will need to replace this with an AuthenticationHandler that implements your
      | local authentication strategy.  You might accomplish this by coding a new such handler and declaring
      | edu.someschool.its.cas.MySpecialHandler here, or you might use one of the handlers provided in the adaptors modules.
      +--&#62;
     &#60;bean
        class=&#34;org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler&#34; /&#62;
   &#60;/list&#62;
 &#60;/property&#62;
</programlisting>
						</para>
					</step>
					<step>
						<para>
							With the following (Make sure to set the host, port and context with the values corresponding to your portal). Also available in <filename>GATEIN_SSO_HOME/cas/plugin/WEB-INF/deployerConfigContext.xml</filename>.
						</para>
						<para>
							
<programlisting>&#60;!--
 | Whereas CredentialsToPrincipalResolvers identify who it is some Credentials might authenticate, 
 | AuthenticationHandlers actually authenticate credentials.  Here we declare the AuthenticationHandlers that
 | authenticate the Principals that the CredentialsToPrincipalResolvers identified.  CAS will try these handlers in turn
 | until it finds one that both supports the Credentials presented and succeeds in authenticating.
 +--&#62;
 &#60;property name=&#34;authenticationHandlers&#34;&#62;
   &#60;list&#62;
     &#60;!--
      | This is the authentication handler that authenticates services by means of callback via SSL, thereby validating
      | a server side SSL certificate.
      +--&#62;
     &#60;bean class=&#34;org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler&#34;
           p:httpClient-ref=&#34;httpClient&#34; /&#62;
     &#60;!--
      | This is the authentication handler declaration that every CAS deployer will need to change before deploying CAS 
      | into production.  The default SimpleTestUsernamePasswordAuthenticationHandler authenticates UsernamePasswordCredentials
      | where the username equals the password.  You will need to replace this with an AuthenticationHandler that implements your
      | local authentication strategy.  You might accomplish this by coding a new such handler and declaring
      | edu.someschool.its.cas.MySpecialHandler here, or you might use one of the handlers provided in the adaptors modules.
      +--&#62;
     &#60;!-- Integrates with the Gatein Authentication Service to perform authentication --&#62;
     &#60;!--
      | Note: Modify the Plugin Configuration based on the actual information of a GateIn instance.
      | The instance can be anywhere on the internet...Not necessarily on localhost where CAS is running 
      +--&#62;
     &#60;bean class=&#34;org.gatein.sso.cas.plugin.AuthenticationPlugin&#34;&#62;
        &#60;property name=&#34;gateInHost&#34;&#62;&#60;value&#62;localhost&#60;/value&#62;&#60;/property&#62;
        &#60;property name=&#34;gateInPort&#34;&#62;&#60;value&#62;8080&#60;/value&#62;&#60;/property&#62;
        &#60;property name=&#34;gateInContext&#34;&#62;&#60;value&#62;portal&#60;/value&#62;&#60;/property&#62;
     &#60;/bean&#62;
   &#60;/list&#62;
 &#60;/property&#62;
</programlisting>
						</para>
					</step>
					<step>
						<para>
							Copy <filename>GATEIN_SSO_HOME/cas/plugin/WEB-INF/lib/sso-cas-plugin-&#60;VERSION&#62;.jar</filename> and <filename>GATEIN_SSO_HOME/cas/plugin/WEB-INF/lib/commons-httpclient-&#60;VERSION&#62;.jar</filename> into the <filename>CAS_HOME/cas-server-webapp/src/main/webapp/WEB-INF/lib</filename> created directory.
						</para>
					</step>
					<step>
						<para>
							Get an installation of Tomcat and extract it into a suitable location (which will be called <filename>TOMCAT_HOME</filename> for these instructions). 
						</para>
						<para>
							Change the default port to avoid a conflict with the default &PRODUCT; (for testing purposes). Edit <filename>TOMCAT_HOME/conf/server.xml</filename> and replace the 8080 port to 8888.
							<note>
								<para>
									If &PRODUCT; is running on the same machine as Tomcat, other ports need to be changed in addition to 8080 in order to avoid port conflicts.
                           They can be changed to any free port. For example, you can change admin port from 8005 to 8805, and AJP port from 8009 to 8809.
								</para>
							</note>
						</para>
					</step>
					<step>
						<para>
							Go to <filename>CAS_HOME/cas-server-webapp</filename> and execute the command:
<programlisting>mvn install
</programlisting>
						</para>
					</step>
					<step>
						<para>
							Copy <filename>CAS_HOME/cas-server-webapp/target/cas.war</filename> into <filename>TOMCAT_HOME/webapps</filename>.
						</para>
						<para>
							Tomcat should start and be accessible at <ulink type="http" url="http://localhost:8888/cas">http://localhost:8888/cas</ulink>. Note that at this stage login won't be available.
						</para>
						<mediaobject>
							<imageobject>
								<imagedata fileref="images/AuthenticationAndIdentity/SSO/cas.png" format="PNG" width="444" />
							</imageobject>
						</mediaobject>
					</step>
				</procedure>
			</section>

		</section>
		
		<section id="sect-Reference_Guide-CAS_Central_Authentication_Service-Setup_the_CAS_client">
			<title>Setup the CAS client</title>
			<procedure>
				<step>
					<para>
						Copy all libraries from <filename>GATEIN_SSO_HOME/cas/gatein.ear/lib</filename> into <filename>JBOSS_HOME/server/default/deploy/gatein.ear/lib</filename> (Or in Tomcat, into $<filename>GATEIN_HOME/lib</filename>)
					</para>
				</step>
				<step>
					<itemizedlist>
						<listitem>
							<para>
							In JBoss AS, edit <filename>gatein.ear/META-INF/gatein-jboss-beans.xml</filename> and uncomment this section:
							</para>
<programlisting>&#60;authentication&#62;
  &#60;login-module code=&#34;org.gatein.sso.agent.login.SSOLoginModule&#34; flag=&#34;required&#34;&#62;
  &#60;/login-module&#62;      
  &#60;login-module code=&#34;org.exoplatform.services.security.j2ee.JbossLoginModule&#34; flag=&#34;required&#34;&#62;
    &#60;module-option name=&#34;portalContainerName&#34;&#62;portal&#60;/module-option&#62;
    &#60;module-option name=&#34;realmName&#34;&#62;gatein-domain&#60;/module-option&#62;
  &#60;/login-module&#62;
&#60;/authentication&#62;
</programlisting>

						</listitem>
						<listitem>
							<para>
							In Tomcat, edit <filename>GATEIN_HOME/conf/jaas.conf</filename> and uncomment this section:
							</para>			
<programlisting>org.gatein.sso.agent.login.SSOLoginModule required
org.exoplatform.services.security.j2ee.TomcatLoginModule required
portalContainerName=portal
realmName=gatein-domain
</programlisting>
						</listitem>
					</itemizedlist>
				</step>
				<step>
					<para>
						The installation can be tested at this point:
					</para>
					<procedure>
						<step>
							<para>
								Start (or restart) &PRODUCT;, and (assuming the CAS server on Tomcat is running) direct your browser to <ulink type="http" url="http://localhost:8888/cas">http://localhost:8888/cas</ulink>.
							</para>
						</step>
						<step>
							<para>
								Login with the username <literal>root</literal> and the password <literal>gtn</literal> (or any account created through the portal).
							</para>
						</step>
					</procedure>
				</step>
			</procedure>
		</section>
		
		<section id="sect-Reference_Guide-CAS_Central_Authentication_Service-Redirect_to_CAS">
			<title>Redirect to CAS</title>
			<para>
				To utilize the Central Authentication Service, &PRODUCT; needs to redirect all user authentication to the CAS server.
			</para>
			<para>
				Information about where the CAS is hosted must be properly configured within the &PRODUCT; instance. The required configuration is done by modifying three files: 
				<itemizedlist>
					<listitem>
						<para>
						In the <filename>gatein.ear/web.war/groovy/groovy/webui/component/UIBannerPortlet.gtml</filename> file modify the 'Sign In' link as follows:
<programlisting>
<![CDATA[
<!--
<a class="Login" onclick="$signInAction"><%=_ctx.appRes("UILoginForm.label.Signin")%></a>
-->
<a class="Login" href="/portal/sso"><%=_ctx.appRes("UILoginForm.label.Signin")%></a>
]]>
</programlisting>
						</para>
					</listitem>
					<listitem>
						<para>
						In the <filename>gatein.ear/web.war/groovy/portal/webui/component/UILogoPortlet.gtmpl</filename> file modify the 'Sign In' link as follows:
<programlisting>
<![CDATA[
<!--
<a onclick="$signInAction"><%=_ctx.appRes("UILogoPortlet.action.signin")%></a>
-->
<a href="/portal/sso"><%=_ctx.appRes("UILogoPortlet.action.signin")%></a> 
]]>
</programlisting>
						</para>
					</listitem>
					<listitem>
						<para>
							Replace the entire contents of <filename>gatein.ear/02portal.war/login/jsp/login.jsp</filename> with:
						</para>							
<programlisting>&#60;html&#62;
  &#60;head&#62;
    &#60;script type=&#34;text/javascript&#34;&#62;
     window.location = &#39;/portal/sso&#39;;
    &#60;/script&#62;
  &#60;/head&#62;
  &#60;body&#62;
  &#60;/body&#62;
&#60;/html&#62;
</programlisting>
					</listitem>
					<listitem>
						<para>
							Add the following Filters at the top of the filter chain in <filename>gatein.ear/02portal.war/WEB-INF/web.xml</filename>:

							
<programlisting>
<![CDATA[
	<filter>
		<filter-name>LoginRedirectFilter</filter-name>
		<filter-class>org.gatein.sso.agent.filter.LoginRedirectFilter</filter-class>
		<init-param>                                 
		  <!-- This should point to your SSO authentication server -->                                                                                              
		  <param-name>LOGIN_URL</param-name>   
		  <!--
		      If casRenewTicket param value of InitiateLoginServlet is:  not specified or false
		  -->
		  <param-value>http://localhost:8888/cas/login?service=http://localhost:8080/portal/private/classic</param-value>
		  <!--
		      If casRenewTicket param value of InitiateLoginServlet is : true
		  -->
		  <!--
		  <param-value>http://localhost:8888/cas/login?service=http://localhost:8080/portal/private
		  /classic&amp;renew=true</param-value>      		  
		  -->
		</init-param>
	</filter>
	<filter>
		<filter-name>CASLogoutFilter</filter-name>                                                                                              
		<filter-class>org.gatein.sso.agent.filter.CASLogoutFilter</filter-class>                                                      
		<init-param>                                 
		  <!-- This should point to your JOSSO authentication server -->                                                                                              
		  <param-name>LOGOUT_URL</param-name>                                                                                                
		  <param-value>http://localhost:8888/cas/logout</param-value>                                                                                                         
		</init-param>                                                                                                                              
	</filter>   
	
	<!-- Mapping the filters at the very top of the filter chain -->
	<filter-mapping>
	  <filter-name>LoginRedirectFilter</filter-name>
	  <url-pattern>/*</url-pattern>	         
	</filter-mapping>
	<filter-mapping>
	  <filter-name>CASLogoutFilter</filter-name>
	  <url-pattern>/*</url-pattern>
	</filter-mapping>
]]>  
</programlisting>
						</para>
					</listitem>
					<listitem>
						<para>
							Replace the <literal>InitiateLoginServlet</literal> declaration in <filename>gatein.ear/02portal.war/WEB-INF/web.xml</filename> with:
<programlisting>&#60;servlet&#62;
  &#60;servlet-name&#62;InitiateLoginServlet&#60;/servlet-name&#62;
  &#60;servlet-class&#62;org.gatein.sso.agent.GenericSSOAgent&#60;/servlet-class&#62;
  &#60;init-param&#62;
    &#60;param-name&#62;ssoServerUrl&#60;/param-name&#62;
    &#60;param-value&#62;http://localhost:8888/cas&#60;/param-value&#62;
  &#60;/init-param&#62;    
  &#60;init-param&#62;
    &#60;param-name&#62;casRenewTicket&#60;/param-name&#62;
    &#60;param-value&#62;false&#60;/param-value&#62;
  &#60;/init-param&#62;
&#60;/servlet&#62;
</programlisting>
						</para>
					</listitem>
				</itemizedlist>
			</para>
			<para>
				Once these changes have been made, all links to the user authentication pages will redirect to the CAS centralized authentication form.
			</para>
		</section>

	</section>
	
	<section id="sect-Reference_Guide-Single_Sign_On-JOSSO">
		<title>JOSSO</title>
		<para>
			This Single Sign On plugin enables seamless integration between &PRODUCT; and the JOSSO Single Sign On Framework. Details about JOSSO can be found <ulink url="http://www.josso.org">here</ulink>.
		</para>
		<para>
			Setting up this integration involves two steps. The first step is to install or configure a JOSSO server, and the second is to set up the portal to use the JOSSO server.
		</para>
		<section id="sect-Reference_Guide-JOSSO-JOSSO_server">
			<title>JOSSO server</title>
			<para>
				This section details setting up the JOSSO server to authenticate against the &PRODUCT; login module.
			</para>
			<para>
				In this example the JOSSO server will be installed on Tomcat.
			</para>
			<section id="sect-Reference_Guide-JOSSO_server-Obtaining_JOSSO">
				<title>Obtaining JOSSO</title>
				<para>
					JOSSO can be downloaded from <ulink type="http" url="http://sourceforge.net/projects/josso/files/">http://sourceforge.net/projects/josso/files/</ulink>. Use the package that embeds Apache Tomcat. The integration was tested with JOSSO-1.8.1.
				</para>
				<para>
					Once downloaded, extract the package into what will be called <filename>JOSSO_HOME</filename> in this example.
				</para>
			</section>
			
			<section id="sect-Reference_Guide-JOSSO_server-Modifying_JOSSO_server">
				<title>Modifying JOSSO server</title>
				<procedure>
					<step>
						<para>
							Copy the files from <filename>GATEIN_SSO_HOME/josso/plugin</filename> into the Tomcat directory (<filename>JOSSO_HOME</filename>).
						</para>
						<para>
							This action should replace or add the following files to the <filename>JOSSO_HOME/webapps/josso/WEB-INF/lib</filename> directory:
						</para>
						<itemizedlist>
							<listitem>
								<para>
									<filename>JOSSO_HOME/lib/josso-gateway-config.xml</filename>
								</para>
							</listitem>
							<listitem>
								<para>
									<filename>JOSSO_HOME/lib/josso-gateway-gatein-stores.xml</filename>
								</para>
							</listitem>
						</itemizedlist>
						<para>
							and
						</para>
						<itemizedlist>
							<listitem>
								<para>
									<filename>JOSSO_HOME/webapps/josso/WEB-INF/classes/gatein.properties</filename>
								</para>
							</listitem>
						</itemizedlist>
					</step>
					<step>
						<para>
							Edit <filename>TOMCAT_HOME/conf/server.xml</filename> and replace the 8080 port to 8888 to change the default Tomcat port and avoid a conflict with the default &PRODUCT; port (for testing purposes).
							<note>
								<title>Port Conflicts</title>
								<para>
                           If &PRODUCT; is running on the same machine as Tomcat, other ports need to be changed in addition to 8080 in order to avoid port conflicts.
                           They can be changed to any free port. For example, you can change admin port from 8005 to 8805, and AJP port from 8009 to 8809.
								</para>
							</note>
						</para>
					</step>
					<step>
						<para>
							Tomcat should now start and allow access to <ulink type="http" url="http://localhost:8888/josso/signon/login.do">http://localhost:8888/josso/signon/login.do</ulink> but at this stage login will not be available.
						</para>
						<mediaobject>
							<imageobject>
								<imagedata fileref="images/AuthenticationAndIdentity/SSO/opensso.png" format="PNG" width="444" />
							</imageobject>
						</mediaobject>
					</step>
				</procedure>
			</section>

		</section>
		
		<section id="sect-Reference_Guide-JOSSO-Setup_the_JOSSO_client">
			<title>Setup the JOSSO client</title>
			<procedure>
				<step>
					<para>
						Copy the library files from <filename>GATEIN_SSO_HOME/josso/gatein.ear/lib</filename> into <filename>gatein.ear/lib</filename> (or into <filename>GATEIN_HOME/lib</filename> if &PRODUCT; is  running in Tomcat)
					</para>
				</step>
            <step>
               <para>
                  Copy the file <filename>GATEIN_SSO_HOME/josso/gatein.ear/portal.war/WEB-INF/classes/josso-agent-config.xml</filename> into <filename>gatein.ear/02portal.war/WEB-INF/classes</filename> (or into <filename>GATEIN_HOME/webapps/portal.war/WEB-INF/classes</filename>, or <filename>GATEIN_HOME/conf</filename> if &PRODUCT; is  running in Tomcat)
               </para>
            </step>
				<step>
					<itemizedlist>
						<listitem>
							<para>
								In JBoss AS, edit <filename>gatein.ear/META-INF/gatein-jboss-beans.xml</filename> and uncomment this section:
							</para>
<programlisting>&#60;authentication&#62;
  &#60;login-module code=&#34;org.gatein.sso.agent.login.SSOLoginModule&#34; flag=&#34;required&#34;&#62;
  &#60;/login-module&#62;      
  &#60;login-module code=&#34;org.exoplatform.services.security.j2ee.JbossLoginModule&#34; flag=&#34;required&#34;&#62;
    &#60;module-option name=&#34;portalContainerName&#34;&#62;portal&#60;/module-option&#62;
    &#60;module-option name=&#34;realmName&#34;&#62;gatein-domain&#60;/module-option&#62;
  &#60;/login-module&#62;
&#60;/authentication&#62;
</programlisting>
						</listitem>
						<listitem>
							<para>
								In Tomcat, edit <filename>GATEIN_HOME/conf/jaas.conf</filename> and uncomment this section:
							</para>
<programlisting>org.gatein.sso.agent.login.SSOLoginModule required
org.exoplatform.services.security.j2ee.TomcatLoginModule requiredtm	
portalContainerName=portal
realmName=gatein-domain
</programlisting>
						</listitem>
					</itemizedlist>
				</step>
				<step>
					<para>
						The installation can be tested at this point.
					</para>
					<procedure>
						<step>
							<para>
								Start (or restart) &PRODUCT;, and (assuming the JOSSO server on Tomcat is running) direct your browser to <ulink type="http" url="http://localhost:8888/josso/signon/login.do">http://localhost:8888/josso/signon/login.do</ulink>.
							</para>
						</step>
						<step>
							<para>
								Login with the username <literal>root</literal> and the password <literal>gtn</literal> or any account created through the portal.
							</para>
						</step>
					</procedure>
				</step>
			</procedure>
		</section>
		
		<section id="sect-Reference_Guide-JOSSO-Setup_the_portal_to_redirect_to_JOSSO">
			<title>Setup the portal to redirect to JOSSO</title>
			<para>
				The next part of the process is to redirect all user authentication to the JOSSO server.
			</para>
			<para>
				Information about where the JOSSO server is hosted must be properly configured within the &PRODUCT; instance. The required configuration is done by modifying four files: 
				<itemizedlist>
					<listitem>
						<para>
						In the <filename>gatein.ear/web.war/groovy/groovy/webui/component/UIBannerPortlet.gtml</filename> file modify the 'Sign In' link as follows:
<programlisting>
<![CDATA[
<!--
<a class="Login" onclick="$signInAction"><%=_ctx.appRes("UILoginForm.label.Signin")%></a>
-->
<a class="Login" href="/portal/sso"><%=_ctx.appRes("UILoginForm.label.Signin")%></a>
]]>
</programlisting>
						</para>
					</listitem>
					<listitem>
						<para>
						In the <filename>gatein.ear/web.war/groovy/portal/webui/component/UILogoPortlet.gtmpl</filename> file modify the 'Sign In' link as follows:
<programlisting>
<![CDATA[
<!--
<a onclick="$signInAction"><%=_ctx.appRes("UILogoPortlet.action.signin")%></a>
-->
<a href="/portal/sso"><%=_ctx.appRes("UILogoPortlet.action.signin")%></a> 
]]>
</programlisting>
						</para>
					</listitem>
					<listitem>
						<para>
							Replace the entire contents of <filename>gatein.ear/02portal.war/login/jsp/login.jsp</filename> with:
						</para>							
<programlisting>&#60;html&#62;
  &#60;head&#62;
    &#60;script type=&#34;text/javascript&#34;&#62;
     window.location = &#39;/portal/sso&#39;;
    &#60;/script&#62;
  &#60;/head&#62;
  &#60;body&#62;
  &#60;/body&#62;
&#60;/html&#62;
</programlisting>
					</listitem>
					<listitem>
						<para>
							Add the following Filters at the top of the filter chain in <filename>gatein.ear/02portal.war/WEB-INF/web.xml</filename>:

							
<programlisting>
<![CDATA[
  <filter>
      <filter-name>LoginRedirectFilter</filter-name>
      <filter-class>org.gatein.sso.agent.filter.LoginRedirectFilter</filter-class>
      <init-param>                                 
		<!-- This should point to your SSO authentication server -->                                                                                              
		<param-name>LOGIN_URL</param-name>                                                                                                
		<param-value>http://localhost:8888/josso/signon/login.do?josso_back_to=http://localhost:8080/portal
		/private/classic</param-value>                                                                                                         
      </init-param>
  </filter>
  <filter>
      <filter-name>JOSSOLogoutFilter</filter-name>                                                                                              
      <filter-class>org.gatein.sso.agent.filter.JOSSOLogoutFilter</filter-class>                                                      
      <init-param>                                 
        <!-- This should point to your JOSSO authentication server -->                                                                                              
        <param-name>LOGOUT_URL</param-name>                                                                                                
        <param-value>http://localhost:8888/josso/signon/logout.do</param-value>                                                                                                         
      </init-param>                                                                                                                              
  </filter>   
  
  <!-- filters should be placed at the very top of the filter chain -->
  <filter-mapping>
	  <filter-name>LoginRedirectFilter</filter-name>
	  <url-pattern>/*</url-pattern>	         
  </filter-mapping>	
  <filter-mapping>
     <filter-name>JOSSOLogoutFilter</filter-name>
     <url-pattern>/*</url-pattern>
  </filter-mapping>
]]> 
</programlisting>
						</para>
					</listitem>
					<listitem>
						<para>
						Replace the <literal>InitiateLoginServlet</literal> declaration in <filename>gatein.ear/02portal.war/WEB-INF/web.xml</filename> with:
						</para>					
<programlisting>&#60;servlet&#62;
  &#60;servlet-name&#62;InitiateLoginServlet&#60;/servlet-name&#62;
  &#60;servlet-class&#62;org.gatein.sso.agent.GenericSSOAgent&#60;/servlet-class&#62;
  &#60;init-param&#62;
    &#60;param-name&#62;ssoServerUrl&#60;/param-name&#62;
    &#60;param-value&#62;http://localhost:8888/josso/signon/login.do&#60;/param-value&#62;
  &#60;/init-param&#62;    
&#60;/servlet&#62;
</programlisting>
					</listitem>
					<listitem>
						<para>
							Remove the <literal>PortalLoginController</literal> servlet declaration and mapping in <filename>gatein.ear/02portal.war/WEB-INF/web.xml</filename>
						</para>
					</listitem>
				</itemizedlist>
			</para>
			<para>
				From now on, all links redirecting to the user authentication pages will redirect to the JOSSO centralized authentication form.
			</para>
		</section>

	</section>
	
	<section id="sect-Reference_Guide-Single_Sign_On-OpenSSO_The_Open_Web_SSO_project">
		<title>OpenSSO - The Open Web SSO project</title>
		<para>
			This Single Sign On plugin enables seamless integration between &PRODUCT; and the OpenSSO Single Sign On Framework. Details about OpenSSO can be found <ulink url="https://opensso.dev.java.net/">here</ulink>.
		</para>
		<para>
			Setting up this integration involves two steps. The first step is to install or configure an OpenSSO server, and the second is to set up the portal to use the OpenSSO server.
		</para>
		<section id="sect-Reference_Guide-OpenSSO_The_Open_Web_SSO_project-OpenSSO_server">
			<title>OpenSSO server</title>
			<para>
				 This section details the setting up of OpenSSO server to authenticate against the &PRODUCT; login module.
			</para>
			<para>
				In this example the OpenSSO server will be installed on Tomcat.
			</para>
			<section id="sect-Reference_Guide-OpenSSO_server-Obtaining_OpenSSO">
				<title>Obtaining OpenSSO</title>
				<para>
					OpenSSO can be downloaded from <ulink type="http" url="https://opensso.dev.java.net/public/use/index.html">https://opensso.dev.java.net/public/use/index.html</ulink>.
				</para>
				<para>
					Once downloaded, extract the package into a suitable location. This location will be referred to as <filename>OPENSSO_HOME</filename> in this example.
				</para>
			</section>
			
			<section id="sect-Reference_Guide-OpenSSO_server-Modifying_OpenSSO_server">
				<title>Modifying OpenSSO server</title>
				<para>
					 To configure the web server as desired, it is simpler to directly modify the sources. 
				</para>
				<para>
					The first step is to add the &PRODUCT; Authentication Plugin:
				</para>
				<para>
					The plugin makes secure authentication callbacks to a RESTful service installed on the remote &PRODUCT; server in order to authenticate a user.
				</para>
				<para>
					In order for the plugin to function correctly, it needs to be properly configured to connect to this service. This configuration is done via the <filename>opensso.war/config/auth/default/AuthenticationPlugin.xml</filename> file.
				</para>
				<procedure>
					<step>
						<para>
							Obtain a copy of Tomcat and extract it into a suitable location (this location will be referred to as <filename>TOMCAT_HOME</filename> in this example).
						</para>
					</step>
					<step>
						<para>
							Change the default port to avoid a conflict with the default &PRODUCT; port (for testing purposes). Do this by editing <filename>TOMCAT_HOME/conf/server.xml</filename> and replacing the 8080 port to 8888.
							<note>
								<para>
                           If &PRODUCT; is running on the same machine as Tomcat, other ports need to be changed in addition to 8080 in order to avoid port conflicts.
                           They can be changed to any free port. For example, you can change admin port from 8005 to 8805, and AJP port from 8009 to 8809.
								</para>
							</note>
						</para>
					</step>
					<step>
						<para>
							Ensure the <filename>TOMCAT_HOME/webapps/opensso/config/auth/default/AuthenticationPlugin.xml</filename> file looks like this: 
<programlisting>
&#60;?xml version=&#39;1.0&#39; encoding=&#34;UTF-8&#34;?&#62;

&#60;!DOCTYPE ModuleProperties PUBLIC &#34;=//iPlanet//Authentication Module Properties XML Interface 1.0 DTD//EN&#34;
          &#34;jar://com/sun/identity/authentication/Auth_Module_Properties.dtd&#34;&#62;

&#60;ModuleProperties moduleName=&#34;AuthenticationPlugin&#34; version=&#34;1.0&#34; &#62;
  &#60;Callbacks length=&#34;2&#34; order=&#34;1&#34; timeout=&#34;60&#34;
             header=&#34;GateIn OpenSSO Login&#34; &#62;    
    &#60;NameCallback&#62;
      &#60;Prompt&#62;
		Username
      &#60;/Prompt&#62;
    &#60;/NameCallback&#62;
    &#60;PasswordCallback echoPassword=&#34;false&#34; &#62;
      &#60;Prompt&#62;
		Password
      &#60;/Prompt&#62;
    &#60;/PasswordCallback&#62;
  &#60;/Callbacks&#62;
&#60;/ModuleProperties&#62;
</programlisting>
						</para>
					</step>
					<step>
						<para>
							Copy <filename>GATEIN_SSO_HOME/opensso/plugin/WEB-INF/lib/sso-opensso-plugin-&#60;VERSION&#62;.jar</filename>, <filename>GATEIN_SSO_HOME/opensso/plugin/WEB-INF/lib/commons-httpclient-&#60;VERSION&#62;.jar</filename>, and <filename>GATEIN_SSO_HOME/opensso/plugin/WEB-INF/lib/commons-logging-&#60;VERSION&#62;.jar</filename> into the Tomcat directory at <filename>TOMCAT_HOME/webapps/opensso/WEB-INF/lib</filename>.
						</para>
					</step>
					<step>
						<para>
							Copy <filename>GATEIN_SSO_HOME/opensso/plugin/WEB-INF/classes/gatein.properties</filename> into <filename>TOMCAT_HOME/webapps/opensso/WEB-INF/classes</filename>
						</para>
					</step>

					<step>
						<para>
							Tomcat should start and be able to access <ulink type="http" url="http://localhost:8888/opensso/UI/Login?realm=gatein">http://localhost:8888/opensso/UI/Login?realm=gatein</ulink>. Login will not be available at this point.
						</para>
						<mediaobject>
							<imageobject>
								<imagedata fileref="images/AuthenticationAndIdentity/SSO/opensso-shot.png" format="PNG" />
							</imageobject>
						</mediaobject>
					</step>
            </procedure>

            <para>Configure "gatein" realm:</para>
            <procedure>
               <step>
                     <para>Direct your browser to <ulink type="http" url="http://localhost:8888/opensso">http://localhost:8888/opensso</ulink></para>
               </step>
               <step>
                     <para>Create default configuration</para>
               </step>
               <step>
                     <para>Login as <literal>amadmin</literal> and then go to tab "Configuration" -> tab "Authentication" -> link "Core" ->
                        add new value and fill in the class name "org.gatein.sso.opensso.plugin.AuthenticationPlugin".
                        This step is really important. Without it AuthenticationPlugin is not available among other OpenSSO authentication modules.
                     </para>
               </step>
               <step>
                  <para>Go to tab "Access control" and create new realm called "gatein".</para>
               </step>
               <step>
                  <para>Go to "gatein" realm and click on "Authentication" tab. At the bottom in the section "Authentication chaining" click on "ldapService".
                     Here change the selection from "Datastore", which is the default module in the authentication chain, to "AuthenticationPlugin".
                     This enables authentication of "gatein" realm by using GateIn REST service instead of the OpenSSO LDAP server.</para>
               </step>
               <step>
                  <para>
                     Go to "Advanced properties" and change UserProfile from "Required" to "Dynamic". This step is needed
                     because &PRODUCT; users are not in OpenSSO Datastore (LDAP server), so their profiles can't be obtained
                     if "Required" is active. By using "Dynamic" all new users are automatically
                     created in OpenSSO datastore after successful authentication.
                  </para>
               </step>
               <step>
                  <para>
                     Increase the user privileges to allow REST access. Go to "Access control" ->
                     Top level realm -> "Privileges" tab -> All authenticated users, and check the last two checkboxes:
                     <itemizedlist>
                        <listitem><para>Read and write access only for policy properties</para></listitem>
                        <listitem><para>Read and write access to all realm and policy properties</para></listitem>
                     </itemizedlist>
                  </para>
               </step>
               <step>
                  <para>Do the same for "gatein" realm.</para>
               </step>
            </procedure>
            <para>TODO: The above OpenSSO manual configuration could be replaced by configuration files prepared in advance</para>
         </section>
		</section>
		
		<section id="sect-Reference_Guide-OpenSSO_The_Open_Web_SSO_project-Setup_the_OpenSSO_client">
			<title>Setup the OpenSSO client</title>
			<procedure>
				<step>
					<para>
						Copy all libraries from <filename>GATEIN_SSO_HOME/opensso/gatein.ear/lib</filename> into <filename>JBOSS_HOME/server/default/deploy/gatein.ear/lib</filename> (Or, in Tomcat, into <filename>GATEIN_HOME/lib</filename>)
					</para>
				</step>
				<step>
					<itemizedlist>
						<listitem>
							<para>
								In JBoss AS, edit gatein.ear/META-INF/gatein-jboss-beans.xml and uncomment this section
							</para>
<programlisting>&#60;authentication&#62;
  &#60;login-module code=&#34;org.gatein.sso.agent.login.SSOLoginModule&#34; flag=&#34;required&#34;&#62;
  &#60;/login-module&#62;      
  &#60;login-module code=&#34;org.exoplatform.services.security.j2ee.JbossLoginModule&#34; flag=&#34;required&#34;&#62;
    &#60;module-option name=&#34;portalContainerName&#34;&#62;portal&#60;/module-option&#62;
    &#60;module-option name=&#34;realmName&#34;&#62;gatein-domain&#60;/module-option&#62;
  &#60;/login-module&#62;
&#60;/authentication&#62;
</programlisting>

						</listitem>
						<listitem>
							<para>
								If you are running GateIn in Tomcat, edit $GATEIN_HOME/conf/jaas.conf and uncomment this section
							</para>
<programlisting>org.gatein.sso.agent.login.SSOLoginModule required
org.exoplatform.services.security.j2ee.TomcatLoginModule required
portalContainerName=portal
realmName=gatein-domain
</programlisting>

						</listitem>
					</itemizedlist>
					<para>
						At this point the installation can be tested: 
					</para>
					<procedure>
						<step>
							<para>
								Access &PRODUCT; by going to <ulink type="http" url="http://localhost:8888/opensso/UI/Login?realm=gatein">http://localhost:8888/opensso/UI/Login?realm=gatein</ulink> (assuming that the OpenSSO server using Tomcat is still running).
							</para>
						</step>
						<step>
							<para>
								Login with the username <literal>root</literal> and the password <literal>gtn</literal> or any account created through the portal.
							</para>
						</step>
					</procedure>
					</step>
			</procedure>
		</section>
		
		<section id="sect-Reference_Guide-OpenSSO_The_Open_Web_SSO_project-Setup_the_portal_to_redirect_to_OpenSSO">
			<title>Setup the portal to redirect to OpenSSO</title>
			<para>
				The next part of the process is to redirect all user authentication to the OpenSSO server.
			</para>
			<para>
				Information about where the OpenSSO server is hosted must be properly configured within the Enterprise Portal Platform instance. The required configuration is done by modifying three files:
				<itemizedlist>
					<listitem>
						<para>
						In the <filename>gatein.ear/web.war/groovy/groovy/webui/component/UIBannerPortlet.gtml</filename> file modify the 'Sign In' link as follows:
<programlisting>
<![CDATA[
<!--
<a class="Login" onclick="$signInAction"><%=_ctx.appRes("UILoginForm.label.Signin")%></a>
-->
<a class="Login" href="/portal/sso"><%=_ctx.appRes("UILoginForm.label.Signin")%></a>
]]>
</programlisting>
						</para>
					</listitem>
					<listitem>
						<para>
						In the <filename>gatein.ear/web.war/groovy/portal/webui/component/UILogoPortlet.gtmpl</filename> file modify the 'Sign In' link as follows:
<programlisting>
<![CDATA[
<!--
<a onclick="$signInAction"><%=_ctx.appRes("UILogoPortlet.action.signin")%></a>
-->
<a href="/portal/sso"><%=_ctx.appRes("UILogoPortlet.action.signin")%></a> 
]]>
</programlisting>
						</para>
					</listitem>
					<listitem>
						<para>
							Replace the entire contents of <filename>gatein.ear/02portal.war/login/jsp/login.jsp</filename> with:
						</para>							
<programlisting>&#60;html&#62;
  &#60;head&#62;
    &#60;script type=&#34;text/javascript&#34;&#62;
     window.location = &#39;/portal/sso&#39;;
    &#60;/script&#62;
  &#60;/head&#62;
  &#60;body&#62;
  &#60;/body&#62;
&#60;/html&#62;
</programlisting>
					</listitem>
					<listitem>
						<para>
							Add the following Filters at the top of the filter chain in <filename>gatein.ear/02portal.war/WEB-INF/web.xml</filename>:

							
<programlisting>
<![CDATA[
  <filter>
      <filter-name>LoginRedirectFilter</filter-name>
      <filter-class>org.gatein.sso.agent.filter.LoginRedirectFilter</filter-class>
      <init-param>                                 
	<!-- This should point to your SSO authentication server -->                                                                                              
	<param-name>LOGIN_URL</param-name>                                                                                                
	<param-value>http://localhost:8888/opensso/UI/Login?realm=gatein&amp;goto=http://localhost:8080
	/portal/private/classic</param-value>                                                                                                         
      </init-param>
  </filter>
  <filter>	
      <filter-name>OpenSSOLogoutFilter</filter-name>                                                                                              
      <filter-class>org.gatein.sso.agent.filter.OpenSSOLogoutFilter</filter-class>                                                      
      <init-param>                                 
        <!-- This should point to your OpenSSO authentication server -->                                                                                              
        <param-name>LOGOUT_URL</param-name>                                                                                                
        <param-value>http://localhost:8888/opensso/UI/Logout</param-value>                                                                                                         
      </init-param>                                                                                                                              
  </filter>   
  
  <!-- place the filters at the top of the filter chain -->
  <filter-mapping>
	  <filter-name>LoginRedirectFilter</filter-name>
	  <url-pattern>/*</url-pattern>	         
  </filter-mapping>
  <filter-mapping>
     <filter-name>OpenSSOLogoutFilter</filter-name>
     <url-pattern>/*</url-pattern>
  </filter-mapping>
]]> 
</programlisting>
						</para>
					</listitem>
					<listitem>
						<para>
						Replace the <literal>InitiateLoginServlet</literal> declaration in <filename>gatein.ear/02portal.war/WEB-INF/web.xml</filename> with:
						</para>					
<programlisting>&#60;servlet&#62;
  &#60;servlet-name&#62;InitiateLoginServlet&#60;/servlet-name&#62;
  &#60;servlet-class&#62;org.gatein.sso.agent.GenericSSOAgent&#60;/servlet-class&#62;
  &#60;init-param&#62;
    &#60;param-name&#62;ssoServerUrl&#60;/param-name&#62;
    &#60;param-value&#62;http://localhost:8888/opensso&#60;/param-value&#62;
  &#60;/init-param&#62; 
  &#60;init-param&#62;
    &#60;param-name&#62;ssoCookieName&#60;/param-name&#62;
    &#60;param-value&#62;iPlanetDirectoryPro&#60;/param-value&#62;
  &#60;/init-param&#62;   
&#60;/servlet&#62;
</programlisting>
					</listitem>
				</itemizedlist>
			</para>
			<para>
				From now on, all links redirecting to the user authentication pages will redirect to the OpenSSO centralized authentication form.
			</para>
		</section>

	</section>

	<section id="sect-Reference_Guide-Single_Sign_On-SPNEGO">
		<title>SPNEGO</title>
		<para>SPNEGO (Simple and Protected GSSAPI Negotiation Mechanism) is
			used to authenticate transparently through the web browser after the
			user has been authenticated when logging-in his session.</para>
		<para>A typical use case is the following:</para>
		<procedure>
			<step>
				<para>Users logs into his desktop (Such as a Windows machine).</para>
			</step>
			<step>
				<para>The desktop login is governed by Active Directory domain.</para>
			</step>
			<step>
				<para>User then uses his browser (IE/Firefox) to access a web
					application (that uses JBoss Negotiation) hosted on JBoss EPP.</para>
			</step>
			<step>
				<para>The Browser transfers the desktop sign on information to the
					web application.</para>
			</step>
			<step>
				<para>JBoss EAP/AS uses background GSS messages with the Active
					Directory (or any Kerberos Server) to validate the user.</para>
			</step>
			<step>
				<para>The User has seamless SSO into the web application.</para>
			</step>
		</procedure>

		<section id="sect-Reference_Guide-Single_Sign_On-SPNEGO-Configuration">
			<title>Configuration</title>
			<para>GateIn uses JBoss Negotiation to enable SPNEGO based desktop
				SSO for the Portal. Here are the steps to integrate SPNEGO with
				GateIn.</para>
			<procedure>
				<step>
					<para>
						Activate the Host authentication

						Under conf/login-config.xml, add the following host login module:
						<programlisting><![CDATA[<!-- SPNEGO domain -->
  <application-policy name="host">
   <authentication>
      <login-module code="com.sun.security.auth.module.Krb5LoginModule"
         flag="required">
         <module-option name="storeKey">true</module-option>
         <module-option name="useKeyTab">true</module-option>                                                     
         <module-option name="principal">HTTP/server.local.network@LOCAL.NETWORK</module-option>             
         <module-option name="keyTab">/home/user/krb5keytabs/jboss.keytab</module-option>
         <module-option name="doNotPrompt">true</module-option>
         <module-option name="debug">true</module-option>
      </login-module>
   </authentication>
 </application-policy>
]]></programlisting>
						the 'keyTab' value should point to the keytab file that was
						generated by the kadmin kerberos tool. See the Setting up your
						Kerberos Development Environment guide for more details.
					</para>
				</step>
				<step>
					<para>
						Extend the core authentication mechanisms to support
						SPNEGO

						Under
						deployers/jbossweb.deployer/META-INF/war-deployers-jboss-beans.xml,
						add 'SPNEGO' authenticators property

						<programlisting><![CDATA[<property name="authenticators">
         <map keyClass="java.lang.String" valueClass="java.lang.String">
            <entry>
               <key>BASIC</key>
               <value>org.apache.catalina.authenticator.BasicAuthenticator</value>
            </entry>
            <entry>
               <key>CLIENT-CERT</key>
               <value>org.apache.catalina.authenticator.SSLAuthenticator</value>
            </entry>
            <entry>
               <key>DIGEST</key>
               <value>org.apache.catalina.authenticator.DigestAuthenticator</value>
            </entry>
            <entry>
               <key>FORM</key>
               <value>org.apache.catalina.authenticator.FormAuthenticator</value>
            </entry>
            <entry>
               <key>NONE</key>
               <value>org.apache.catalina.authenticator.NonLoginAuthenticator</value>
            </entry>

        <!-- Add this entry -->
        <entry>
          <key>SPNEGO</key>
          <value>org.jboss.security.negotiation.NegotiationAuthenticator</value>
        </entry>
         </map>         
      </property>]]></programlisting>

					</para>
				</step>
				<step>
					<para>Add the JBoss Negotiation binary

						copy $GATEIN_SSO_HOME/spnego/jboss-negotiation-2.0.3.GA.jar to lib
</para>
				</step>
				<step>
					<para>Add the Gatein SSO module binaries

						Add $GATEIN_SSO_HOME/spnego/gatein.ear/lib/sso-agent.jar, and $GATEIN_SSO_HOME/spnego/gatein.ear/lib/sso-spnego.jar to deploy/gatein.ear/lib
</para>
				</step>
				<step>
					<para>
						Activate SPNEGO LoginModule for GateIn

						Modify deploy/gatein.ear/META-INF/gatein-jboss-beans.xml, so that it
						looks like this:

						<programlisting><![CDATA[<deployment xmlns="urn:jboss:bean-deployer:2.0">
  <application-policy xmlns="urn:jboss:security-beans:1.0" name="gatein-domain">
    <!-- Uncomment this for Kerberos based SSO integration -->
    <authentication>
      <login-module
         code="org.gatein.sso.spnego.SPNEGOLoginModule"
         flag="requisite">
         <module-option name="password-stacking">useFirstPass</module-option>
         <module-option name="serverSecurityDomain">host</module-option>
      </login-module>      
      <login-module
         code="org.gatein.sso.agent.login.SPNEGORolesModule"
         flag="required">
      <module-option name="password-stacking">useFirstPass</module-option>
      <module-option name="portalContainerName">portal</module-option>
      <module-option name="realmName">gatein-domain</module-option>
      </login-module>      
   </authentication>
  </application-policy>
</deployment>]]></programlisting>
					</para>
				</step>
				<step>
					<para>
						Integrate SPNEGO support into the Portal web archive

						Switch GateIn authentication mechanism from the default "FORM"
						based to "SPNEGO" based authentication as follows:

						Modify gatein.ear/02portal.war/WEB-INF/web.xml

						<programlisting><![CDATA[    <!--
    <login-config>
      <auth-method>FORM</auth-method> 
      <realm-name>gatein-domain</realm-name> 
        <form-login-config>
          <form-login-page>/initiatelogin</form-login-page> 
            <form-error-page>/errorlogin</form-error-page>
      </form-login-config>
    </login-config>
    -->
    <login-config>
      <auth-method>SPNEGO</auth-method>
      <realm-name>SPNEGO</realm-name>    
    </login-config>]]></programlisting>


						Integrate request pre-processing needed for SPNEGO via filters.
						Add the following filters to the web.xml at the top of the Filter
						chain:

						<programlisting><![CDATA[   <filter>
      <filter-name>LoginRedirectFilter</filter-name>
      <filter-class>org.gatein.sso.agent.filter.LoginRedirectFilter</filter-class>
      <init-param>                                 
        <!-- This should point to your SSO authentication server -->                                                                                              
        <param-name>LOGIN_URL</param-name>                                                                                                
        <param-value>/portal/private/classic</param-value>                                                                                                         
      </init-param>
    </filter>
    <filter>
        <filter-name>SPNEGOFilter</filter-name>
        <filter-class>org.gatein.sso.agent.filter.SPNEGOFilter</filter-class>
    </filter>
    
    <filter-mapping>
      <filter-name>LoginRedirectFilter</filter-name>
      <url-pattern>/*</url-pattern>             
    </filter-mapping>
    <filter-mapping>                                           
        <filter-name>SPNEGOFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>]]></programlisting>
					</para>
				</step>
				<step>
					<para>
						Modify the Portal's 'Sign In' link to perform SPNEGO
						authentication

						Modify the 'Sign In' link on
						gatein.war/web.war/groovy/groovy/webui/component/UIBannerPortlet.gtmpl
						as follows:

						<programlisting><![CDATA[<!--
<a onclick="$signInAction"><%=_ctx.appRes("UILoginForm.label.Signin")%></a>
-->
<a href="/portal/sso"><%=_ctx.appRes("UILoginForm.label.Signin")%></a>]]></programlisting>
					</para>
				</step>
				<step>
					<para>
						Start the GateIn Portal
						<programlisting>sudo ./run.sh -Djava.security.krb5.realm=LOCAL.NETWORK -Djava.security.krb5.kdc=server.local.network -c spnego -b server.local.network</programlisting>
					</para>
				</step>
				<step>
					<para>Login to Kerberos
						<programlisting>kinit -A demo</programlisting>
						You should be able to click the 'Sign In' link on the GateIn Portal
						and the 'demo' user from the GateIn portal should be automatically
						logged in</para>
				</step>
			</procedure>
		</section>
	</section>
</section>

