diff --git a/modules/casserver/config-templates/module_casserver.php b/modules/casserver/config-templates/module_casserver.php
index a7097b7868020dbb691e3ad1af0be115302c2c8f..007034f5c4d7e44800dfe8e640b4ec051c189cd6 100644
--- a/modules/casserver/config-templates/module_casserver.php
+++ b/modules/casserver/config-templates/module_casserver.php
@@ -18,6 +18,7 @@ $config = array (
 	'ticketcache' => 'ticketcache',
 
 	'attrname' => 'mail', // 'eduPersonPrincipalName',
+	#'attributes' => TRUE, // enable transfer of attributes
 	
 );
 
diff --git a/modules/casserver/www/serviceValidate.php b/modules/casserver/www/serviceValidate.php
index ab1073954ab3574a9ea3e0614a96143f366eacc0..23df67a20f5120463c6ba3f57b1784003a3f795c 100644
--- a/modules/casserver/www/serviceValidate.php
+++ b/modules/casserver/www/serviceValidate.php
@@ -37,9 +37,10 @@ try {
 	$ticketcontent = retrieveTicket($ticket, $path);
 	
 	$usernamefield = $casconfig->getValue('attrname', 'eduPersonPrincipalName');
+	$dosendattributes = $casconfig->getValue('attributes', FALSE);;
 	
 	if (array_key_exists($usernamefield, $ticketcontent)) {
-		returnResponse('YES', $ticketcontent[$usernamefield][0]);
+		returnResponse('YES', $ticketcontent[$usernamefield][0], $dosendattributes ? $ticketcontent : array());
 	} else {
 		returnResponse('NO');
 	}
@@ -49,12 +50,21 @@ try {
 	returnResponse('NO', $e->getMessage());
 }
 
-function returnResponse($value, $content = '') {
+function returnResponse($value, $content = '', $attributes = array()) {
 	if ($value === 'YES') {
+		$attributesxml = "";
+		foreach ($attributes as $attributename => $attributelist) {
+			$attr = htmlentities($attributename);
+			foreach ($attributelist as $attributevalue) {
+				$attributesxml .= "<cas:$attr>" . htmlentities($attributevalue) . "</cas:$attr>";
+			}
+		}
+		if (sizeof($attributes)) $attributesxml = '<cas:attributes>' . $attributesxml . '</cas:attributes>';
 		echo '<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
     <cas:authenticationSuccess>
-	<cas:user>' . htmlentities($content) . '</cas:user>
-    </cas:authenticationSuccess>
+	<cas:user>' . htmlentities($content) . '</cas:user>' .
+	$attributesxml .
+    '</cas:authenticationSuccess>
 </cas:serviceResponse>';
 
 	} else {