Is it possible to get attributes in a CAS response without phpCAS?

2.6k views Asked by At

We are using CAS on several sites with phpCAS. It returns a response with the username and a number of attributes like email and display name.

So the following echoes out all of the attributes (Full name, email, etc...)

<?php
foreach (phpCAS::getAttributes() as $key => $value) {
if (is_array($value)) {
echo '<li>', $key, ':<ol>';
foreach($value as $item) {
      echo '<li><strong>', $item, '</strong></li>';
    }
echo '</ol></li>';
} else {
    echo '<li>', $key, ': <strong>', $value, '</strong></li>';
  }
}
?>

Right now, I'm trying to see if I can do this without phpCAS so we can share it as a plugin without requiring users to have phpCAS installed.

I'm getting a response and I'm able to authenticate users so, basically, it works but I'm only getting the username in the response. What do I need to do to get those attributes without phpCAS?

If I understand correctly, this might have something to do with declaring SAML which might be requered to get attributes:

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

So, maybe my question should be, is there a way to accomplish this same thing without phpCAS?

1

There are 1 answers

0
John Gasper On

You can roll your own code. The a brief description is at https://wiki.jasig.org/display/CASUM/SAML+1.1. You'll probably need to Google a bit more as some details might be missing.