544175985944e406a09fa4649424f952ca0c0d6c
[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 java.util.Arrays;
13
14 import edu.internet2.middleware.eduPerson.*;
15 import edu.internet2.middleware.shibboleth.common.Constants; 
16 import edu.internet2.middleware.shibboleth.aa.ShibAttribute;
17 import org.opensaml.*;
18
19 public class eduPersonAffiliation implements ShibAttribute{
20     
21
22     public SAMLAttribute toSamlAttribute(String defaultScope, Object[] values, String recipient)
23         throws SAMLException{
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            defaultScope,
42            null,
43                    10*60,
44            null,
45                    Arrays.asList(values));
46     }
47 }
48