cad28d8d8b2702c83422049391d8e36feda9b97c
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / aaLocal / attributes / eduPersonAffiliation.java
1
2 /**
3  *  Attribute Authority & Release Policy
4  *  A specific class for eduPersonAffiliation attribute
5  *
6  * @author     Parviz Dousti (dousti@cmu.edu)
7  * @created    June, 2002
8  */
9
10 import edu.internet2.middleware.eduPerson.*;
11 import edu.internet2.middleware.shibboleth.common.Constants; 
12 import edu.internet2.middleware.shibboleth.aa.ShibAttribute;
13 import org.opensaml.*;
14
15 public class eduPersonAffiliation implements ShibAttribute{
16     
17
18     public SAMLAttribute toSamlAttribute(String defaultScope, Object[] values)
19         throws SAMLException{
20
21         String[] scopes = new String[values.length];
22
23         for(int i=0; i<values.length; i++){
24             String val = (String)values[i];
25             if(val.equalsIgnoreCase("faculty") ||
26                val.equalsIgnoreCase("student") ||
27                val.equalsIgnoreCase("staff") ||
28                val.equalsIgnoreCase("alum") ||
29                val.equalsIgnoreCase("member") ||
30                val.equalsIgnoreCase("affiliate") ||
31                val.equalsIgnoreCase("employee") )
32                 values[i] = val.toLowerCase();
33             else
34                 values[i] = "member";
35         }
36
37         return new ScopedAttribute("urn:mace:eduPerson:1.0:eduPersonAffiliation",
38                    Constants.SHIB_ATTRIBUTE_NAMESPACE_URI, 
39                    new QName("urn:mace:eduPerson:1.0",
40                              "eduPersonAffiliationType"),
41                    10*60,
42                    values,
43                    defaultScope,
44                    scopes);
45     }
46 }
47