You need to use the CAS v3.0 protocol, or there is a hack that lets you use 
attributes with the CAS v2.0 protocol.
Since you are using the v4.0 server, I would just use the v3.0 services.

Thanks,
Carl Waldbieser
ITS System Programmer
Lafayette College

----- Original Message -----
From: "Fredy Provoste C." <[email protected]>
To: [email protected]
Sent: Tuesday, April 28, 2015 5:17:28 PM
Subject: [cas-user] phpCAS get Ldap Attributes

Hi, i'm using Cas Server 4.0.0 with ldap working. I'm trying to integrate
with a simple PHP webapp using phpCAS.

 

In my deployerConfigContext.xml i have

 

<bean id="ldapAuthenticationHandler"

      class="org.jasig.cas.authentication.LdapAuthenticationHandler"

      p:principalIdAttribute="uid"

      c:authenticator-ref="authenticator">

    <property name="principalAttributeMap">

        <map>

            <!--

               | This map provides a simple attribute resolution mechanism.

               | Keys are LDAP attribute names, values are CAS attribute
names.

               | Use this facility instead of a PrincipalResolver if LDAP is

               | the only attribute source.

               -->

            <entry key="employeeNumber" value="rut" />

            <entry key="mail" value="mail" />

            <entry key="cn" value="nombre" />

        </map>

    </property>

</bean>

 

I'm guessing the "entry keys" are the ldap attributes i will use in my PHP
webapp.

 

Using the simple example included in phpCAS 

 

 

<?php

 

require_once 'config.php';

require_once $phpcas_path . '/CAS.php';

phpCAS::setDebug();

phpCAS::client(CAS_VERSION_2_0, $cas_host, $cas_port, $cas_context);

 

phpCAS::setCasServerCACert($cas_server_ca_cert_path);

 

phpCAS::forceAuthentication();

 

if (isset($_REQUEST['logout'])) {

                phpCAS::logout();

}

 

?>

<html>

  <head>

    <title>phpCAS simple client</title>

  </head>

  <body>

    <h1>Successfull Authentication!</h1>

    <?php require 'script_info.php' ?>

    <p>the user's login is <b><?php echo phpCAS::getUser(); ?></b>.</p>

    <p>phpCAS version is <b><?php echo phpCAS::getVersion(); ?></b>.</p>

    

    <?php print_r(phpCAS::getAttributes());?>

    <p><a href="?logout=">Logout</a></p>

  </body>

</html>

 

But the method phpCAS::getAttributes() is not working.   Guess the protocol
CAS_VERSION_2_0 is not used to this purpose (get the ldap attributes).  

Thanks for any Help

 

Fredy


-- 
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

-- 
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