Clean

Hi!

This is Mihály Héder here. I am working for MTA Sztaki Institute for Computer Science and Control, in Budapest, Hungary. 
I have made a few alterations to your code so that we can use it with our Liferay based science portal. 
The key changes are:

-the source of the http header information is  request.getHeader(headerName) instead of request.getAttribute. In our tomcat getAttribute never contains the header values. I guess you have tested with jboss or something else, where getAttribute also works

-in our setup the AAI-provided login names are eduPersonPrincipalName-s. These look like email addresses (aladar@sztaki.hu) and get rejected by Liferay ScreenNameValidator. I know that the ScreenNameValidator can be changed but our Liferay guys preferred to change value coming from AAI like aladar.at.sztaki.hu

-email is a multi-valued attribute in our setup. I made the plugin to pick the first one if there are many.

-surname and first name are sometimes missing. I made the plugin not to fail and give a dummy value instead

-if the affiliation contains ":" characters then the plugin cuts down everything but the end of the string after the last ":". This is because we use eduPersonEntitlement attributes that look like urn:geant:niif.hu:yavom:hexaa-foo-bar-baz:Super User where only the last segment has significance.

Please accept the changes if you find them useful. Also if you see any room for improvement in my code, let me know. 

Cheers
Mihály Héder