use the new session manager interface
[java-idp.git] / tests / edu / internet2 / middleware / shibboleth / aa / attrresolv / ScopeTestConnector.java
1 /*
2  * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package edu.internet2.middleware.shibboleth.aa.attrresolv;
18
19 import java.security.Principal;
20
21 import javax.naming.directory.Attributes;
22 import javax.naming.directory.BasicAttribute;
23 import javax.naming.directory.BasicAttributes;
24
25 import org.apache.log4j.Logger;
26 import org.w3c.dom.Element;
27
28 import edu.internet2.middleware.shibboleth.aa.attrresolv.provider.BaseDataConnector;
29
30 /**
31  * <code>DataConnectorPlugIn</code> implementation for use in unit testing.
32  * 
33  * @author Walter Hoehn
34  */
35 public class ScopeTestConnector extends BaseDataConnector implements DataConnectorPlugIn {
36
37         private static Logger log = Logger.getLogger(ScopeTestConnector.class.getName());
38
39         public ScopeTestConnector(Element e) throws ResolutionPlugInException {
40
41                 super(e);
42         }
43
44         /**
45          * @see edu.internet2.middleware.shibboleth.aa.attrresolv.DataConnectorPlugIn#resolve(java.security.Principal,
46          *      java.lang.String, java.lang.String, edu.internet2.middleware.shibboleth.aa.attrresolv.Dependencies)
47          */
48         public Attributes resolve(Principal principal, String requester, String responder, Dependencies depends) {
49
50                 log.debug("Resolving connector: (" + getId() + ")");
51                 log.debug(getId() + " resolving for principal: (" + principal.getName() + ")");
52
53                 BasicAttributes attributes = new BasicAttributes();
54                 attributes.put(new BasicAttribute("eduPersonPrincipalName", principal.getName()));
55                 attributes.put(new BasicAttribute("foo", "bar@example.com"));
56                 return attributes;
57         }
58 }