d0dadd4dcf6906c7a5f189fae323e879b5acbc73
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / idp / RequestSpecificProtocolSupport.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.idp;
18
19 import java.net.URI;
20 import java.security.Principal;
21 import java.util.Collection;
22 import java.util.List;
23 import java.util.Map;
24
25 import javax.servlet.http.HttpServletRequest;
26 import javax.servlet.http.HttpServletResponse;
27 import javax.xml.namespace.QName;
28
29 import org.apache.log4j.Logger;
30 import org.opensaml.InvalidCryptoException;
31 import org.opensaml.SAMLAssertion;
32 import org.opensaml.SAMLAttribute;
33 import org.opensaml.SAMLException;
34 import org.opensaml.SAMLResponse;
35 import org.opensaml.saml2.metadata.EntitiesDescriptor;
36 import org.opensaml.saml2.metadata.EntityDescriptor;
37 import org.opensaml.saml2.metadata.RoleDescriptor;
38 import org.opensaml.saml2.metadata.provider.MetadataFilter;
39 import org.opensaml.saml2.metadata.provider.MetadataProviderException;
40 import org.opensaml.security.TrustEngine;
41 import org.opensaml.security.X509EntityCredential;
42 import org.opensaml.xml.XMLObject;
43 import org.w3c.dom.Element;
44
45 import edu.internet2.middleware.shibboleth.aa.AAAttribute;
46 import edu.internet2.middleware.shibboleth.aa.AAException;
47 import edu.internet2.middleware.shibboleth.aa.arp.ArpProcessingException;
48 import edu.internet2.middleware.shibboleth.artifact.ArtifactMapper;
49 import edu.internet2.middleware.shibboleth.common.RelyingParty;
50 import edu.internet2.middleware.shibboleth.common.RelyingPartyMapper;
51
52 /**
53  * IdPProtocolSupport implementation that offers functionality that is specific to a particular request.
54  * 
55  * @author Walter Hoehn
56  */
57 public class RequestSpecificProtocolSupport implements IdPProtocolSupport {
58
59         IdPProtocolSupport wrapped;
60
61         RequestSpecificProtocolSupport(GeneralProtocolSupport generalSupport, HttpServletRequest request,
62                         HttpServletResponse response) {
63
64                 wrapped = generalSupport;
65         }
66
67         public void addMetadataProvider(Element element) {
68
69                 wrapped.addMetadataProvider(element);
70         }
71
72         public void destroy() {
73
74                 wrapped.destroy();
75         }
76
77         public ArtifactMapper getArtifactMapper() {
78
79                 return wrapped.getArtifactMapper();
80         }
81
82         public IdPConfig getIdPConfig() {
83
84                 return wrapped.getIdPConfig();
85         }
86
87         public Collection<? extends SAMLAttribute> getReleaseAttributes(Principal principal, RelyingParty relyingParty,
88                         String requester) throws AAException {
89
90                 return wrapped.getReleaseAttributes(principal, relyingParty, requester);
91         }
92
93         public Collection<? extends SAMLAttribute> getReleaseAttributes(Principal principal, RelyingParty relyingParty,
94                         String requester, Collection<URI> attributeNames) throws AAException {
95
96                 return wrapped.getReleaseAttributes(principal, relyingParty, requester, attributeNames);
97         }
98
99         public RelyingPartyMapper getRelyingPartyMapper() {
100
101                 return wrapped.getRelyingPartyMapper();
102         }
103
104         public Logger getTransactionLog() {
105
106                 return wrapped.getTransactionLog();
107         }
108
109         public TrustEngine<X509Credential> getTrustEngine() {
110
111                 return wrapped.getTrustEngine();
112         }
113
114         public int providerCount() {
115
116                 return wrapped.providerCount();
117         }
118
119         public Collection<? extends SAMLAttribute> resolveAttributes(Principal principal, String requester,
120                         String responder, Map<String, AAAttribute> attributeSet) throws ArpProcessingException {
121
122                 return wrapped.resolveAttributes(principal, requester, responder, attributeSet);
123         }
124
125         public Collection<? extends SAMLAttribute> resolveAttributesNoPolicies(Principal principal, String requester,
126                         String responder, Map<String, AAAttribute> attributeSet) {
127
128                 return wrapped.resolveAttributesNoPolicies(principal, requester, responder, attributeSet);
129         }
130
131         public void signAssertions(SAMLAssertion[] assertions, RelyingParty relyingParty) throws InvalidCryptoException,
132                         SAMLException {
133
134                 wrapped.signAssertions(assertions, relyingParty);
135         }
136
137         public void signResponse(SAMLResponse response, RelyingParty relyingParty) throws SAMLException {
138
139                 wrapped.signResponse(response, relyingParty);
140         }
141
142         public EntitiesDescriptor getEntitiesDescriptor(String name) throws MetadataProviderException {
143
144                 return wrapped.getEntitiesDescriptor(name);
145         }
146
147         public EntityDescriptor getEntityDescriptor(String entityID) throws MetadataProviderException {
148
149                 return wrapped.getEntityDescriptor(entityID);
150         }
151
152         public XMLObject getMetadata() throws MetadataProviderException {
153
154                 return wrapped.getMetadata();
155         }
156
157         public MetadataFilter getMetadataFilter() {
158
159                 return wrapped.getMetadataFilter();
160         }
161
162         public List<RoleDescriptor> getRole(String entityID, QName roleName) throws MetadataProviderException {
163
164                 return wrapped.getRole(entityID, roleName);
165         }
166
167         public RoleDescriptor getRole(String entityID, QName roleName, String supportedProtocol)
168                         throws MetadataProviderException {
169
170                 return wrapped.getRole(entityID, roleName, supportedProtocol);
171         }
172
173         public boolean requireValidMetadata() {
174
175                 return wrapped.requireValidMetadata();
176         }
177
178         public void setMetadataFilter(MetadataFilter newFilter) throws MetadataProviderException {
179
180                 wrapped.setMetadataFilter(newFilter);
181         }
182
183         public void setRequireValidMetadata(boolean requireValidMetadata) {
184
185                 wrapped.setRequireValidMetadata(requireValidMetadata);
186         }
187
188 }