*** empty log message ***
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / aaLocal / attributes / eduPersonPrincipalName.java
1 import edu.internet2.middleware.eduPerson.*;
2 import edu.internet2.middleware.shibboleth.common.Constants; 
3 import edu.internet2.middleware.shibboleth.aa.ShibAttribute;
4 import org.opensaml.*;
5
6 public class eduPersonPrincipalName implements ShibAttribute{
7     
8
9     public SAMLAttribute toSamlAttribute(String defaultScope, Object[] values)
10         throws SAMLException{
11
12         String scopes[] = new String[1];
13         String vals[] = new String[1];
14         String eppn = (String)values[0];
15
16         int x = eppn.indexOf("@") ;
17         System.out.println("EPPN: "+eppn+"    @ at "+x);
18         if(x > 0){
19             vals[0] = eppn.substring(0,x-1);
20             scopes[0] = eppn.substring(x+1);
21         }else{
22             vals[0] = eppn;
23             scopes[0] = defaultScope;
24         }
25         return new ScopedAttribute("urn:mace:eduPerson:1.0:eduPersonPrincipalName",
26                                  Constants.SHIB_ATTRIBUTE_NAMESPACE_URI, 
27                                  new QName("urn:mace:eduPerson:1.0",
28                                            "eduPersonPrincipalNameType"),
29                                  10*60,
30                                  vals,
31                                  defaultScope,
32                                  scopes);
33
34     }
35
36 }
37