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