Setup: Windows server 2008, tomcat 5.5, cas 3.4.6, maven 2.2.1
1) Follow instructions to get your maven working: 

https://wiki.jasig.org/display/CASUM/Best+Practice+-+Setting+Up+CAS+Locally+using+the+Maven2+WAR+Overlay+Method

2)You require to know your ad ldap CN, sAMAccountName, DC, ldap:// link, etc 
throughout this process. I was struggling with these for awhile until I 
installed Apache Directory Studio. After you install this, open it up and 
create a new LDAP connection- use the server machine's name as the hostname and 
hit hte test button- if your machine sees this machine, it will pass. Go to the 
next step and enter your username and password that is in AD. You can test this 
as well. Once you're in, you'll be able to find your "Users" group under a 
section. This section title should show you what CN you should be using.For 
example in mine it showed the CN=Users group in the following style:

DC=temp1, DC=temp2, DC=temp3, DC=com
|
|
|
     CN=Users
     |
        username1
        username2
        casadmin

These "DC" Values you'll want to use in your code as well as the CN value. 

3) 

Add this line in the dependancys of your pom.xml file:

<dependency> 
<groupId>org.jasig.cas</groupId> 
<artifactId>cas-server-support-ldap</artifactId> 
<version>${cas.version}</version> <type>jar</type> <scope>runtime</scope> 
</dependency>

and change your version number to whatever version you want (I used 3.4.6)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Replace the code that you created in the config file in the tutorial:

<bean class="org.jasig.cas.adaptors.generic.AcceptUsersAuthenticationHandler">
   <property name="users">
      <map>
         <entry>
            <key>
               <value>scott</value>
            </key>
            <value>secret</value>
         </entry>
      </map>
   </property>
</bean>

with the bindldap code. (Note: to login by user display name replace 
sAMAccountName with CN):

<bean class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler" >
       <property name="filter" value="sAMAccountName=%u" />
       <property name="searchBase" 
value="CN=Users,dc=temp1,dc=temp2,dc=temp3,dc=com" />
       <property name="contextSource" ref="contextSource" />
</bean>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Add at the bottom of the same config file right before </beans> add the code: 
(Note: The username should already be in Active Directory and the domain name 
will consist of your combined DC= values used above. For example: If you have 
aser name casadmin with password test and your above connection string looked 
like: value="CN=Users,dc=temp1,dc=temp2,dc=temp3,dc=com" />
Than you'll want to have the "userDn" value="[email protected]" 
and the password as "test" 

<bean id="contextSource" 
class="org.springframework.ldap.core.support.LdapContextSource">
        <property name="pooled" value="false"/>
        <property name="urls">
                <list>
                    <value>ldap://temp1.temp2.temp3.com/</value>
                </list>
        </property>
        <property name="userDn" value="ReplaceWithUserName@ReplaceWithDomain"/> 
 
        <property name="password" value="ReplaceWithPassword"/>
        <property name="baseEnvironmentProperties">
                <map>
                <entry>
                <key>                   
<value>java.naming.security.authentication</value>
                </key>
                <value>simple</value>
                </entry>
                </map>
        </property>
</bean>

4) Save this file and build with Maven to create your new war file

5) Deploy this war file

6) Go to the same login address as you did in the maven installation tutorial 
and test. 

7) (Optional) To get your Logfile working, in your folder you're using to build 
with Maven, create the file path **FOLDER**\src\main\webapp\WEB-INF\classes

In this location, copy the log4j.xml file that is in your exploded folder from 
your maven tutorial and change "cas.log" text in the file to something more 
meaningful example: C:\\Users\\UserName\\Desktop\\cas.log and also change all 
"WARN" and "INFO" values to "DEBUG"

This will allow for your CAS log to show your debugging. 
-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to