Clearer javadoc.
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / common / ServiceProviderMapper.java
1 /*
2  * The Shibboleth License, Version 1. Copyright (c) 2002 University Corporation for Advanced Internet Development, Inc.
3  * All rights reserved Redistribution and use in source and binary forms, with or without modification, are permitted
4  * provided that the following conditions are met: Redistributions of source code must retain the above copyright
5  * notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above
6  * copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials
7  * provided with the distribution, if any, must include the following acknowledgment: "This product includes software
8  * developed by the University Corporation for Advanced Internet Development <http://www.ucaid.edu> Internet2 Project.
9  * Alternately, this acknowledegement may appear in the software itself, if and wherever such third-party
10  * acknowledgments normally appear. Neither the name of Shibboleth nor the names of its contributors, nor Internet2, nor
11  * the University Corporation for Advanced Internet Development, Inc., nor UCAID may be used to endorse or promote
12  * products derived from this software without specific prior written permission. For written permission, please contact
13  * shibboleth@shibboleth.org Products derived from this software may not be called Shibboleth, Internet2, UCAID, or the
14  * University Corporation for Advanced Internet Development, nor may Shibboleth appear in their name, without prior
15  * written permission of the University Corporation for Advanced Internet Development. THIS SOFTWARE IS PROVIDED BY THE
16  * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND WITH ALL FAULTS. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE
18  * DISCLAIMED AND THE ENTIRE RISK OF SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS WITH LICENSEE. IN NO
19  * EVENT SHALL THE COPYRIGHT OWNER, CONTRIBUTORS OR THE UNIVERSITY CORPORATION FOR ADVANCED INTERNET DEVELOPMENT, INC.
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 package edu.internet2.middleware.shibboleth.common;
27
28 import java.net.MalformedURLException;
29 import java.net.URI;
30 import java.net.URISyntaxException;
31 import java.net.URL;
32 import java.util.HashMap;
33 import java.util.Map;
34
35 import org.apache.log4j.Logger;
36 import org.w3c.dom.Element;
37 import org.w3c.dom.NodeList;
38
39 import edu.internet2.middleware.shibboleth.idp.IdPConfig;
40 import edu.internet2.middleware.shibboleth.metadata.EntitiesDescriptor;
41 import edu.internet2.middleware.shibboleth.metadata.Metadata;
42 import edu.internet2.middleware.shibboleth.metadata.EntityDescriptor;
43
44 /**
45  * Class for determining the effective relying party from the unique id of the service provider. Checks first for an
46  * exact match on the service provider, then for membership in a group of providers (perhaps a federation). Uses the
47  * default relying party if neither is found.
48  * 
49  * @author Walter Hoehn
50  */
51 public class ServiceProviderMapper {
52
53         private static Logger log = Logger.getLogger(ServiceProviderMapper.class.getName());
54         protected Map relyingParties = new HashMap();
55         private Metadata metaData;
56         private IdPConfig configuration;
57         private Credentials credentials;
58         private NameMapper nameMapper;
59
60         public ServiceProviderMapper(Element rawConfig, IdPConfig configuration, Credentials credentials,
61                         NameMapper nameMapper) throws ServiceProviderMapperException {
62
63                 this.configuration = configuration;
64                 this.credentials = credentials;
65                 this.nameMapper = nameMapper;
66
67                 NodeList itemElements = rawConfig.getElementsByTagNameNS(IdPConfig.configNameSpace, "RelyingParty");
68
69                 for (int i = 0; i < itemElements.getLength(); i++) {
70                         addRelyingParty((Element) itemElements.item(i));
71                 }
72
73                 verifyDefaultParty(configuration);
74
75         }
76
77         public void setMetadata(Metadata metadata) {
78
79                 this.metaData = metadata;
80         }
81
82         private IdPConfig getOriginConfig() {
83
84                 return configuration;
85         }
86
87         protected void verifyDefaultParty(IdPConfig configuration) throws ServiceProviderMapperException {
88
89                 // Verify we have a proper default party
90                 String defaultParty = configuration.getDefaultRelyingPartyName();
91                 if (defaultParty == null || defaultParty.equals("")) {
92                         if (relyingParties.size() != 1) {
93                                 log
94                                                 .error("Default Relying Party not specified.  Add a (defaultRelyingParty) attribute to <IdPConfig>.");
95                                 throw new ServiceProviderMapperException("Required configuration not specified.");
96                         } else {
97                                 log.debug("Only one Relying Party loaded.  Using this as the default.");
98                         }
99                 }
100                 log.debug("Default Relying Party set to: (" + defaultParty + ").");
101                 if (!relyingParties.containsKey(defaultParty)) {
102                         log.error("Default Relying Party refers to a Relying Party that has not been loaded.");
103                         throw new ServiceProviderMapperException("Invalid configuration (Default Relying Party).");
104                 }
105         }
106
107         protected RelyingParty getRelyingPartyImpl(String providerIdFromTarget) {
108
109                 // Null request, send the default
110                 if (providerIdFromTarget == null) {
111                         RelyingParty relyingParty = getDefaultRelyingParty();
112                         log.info("Using default Relying Party: (" + relyingParty.getName() + ").");
113                         return new UnknownProviderWrapper(relyingParty, providerIdFromTarget);
114                 }
115
116                 // Look for a configuration for the specific relying party
117                 if (relyingParties.containsKey(providerIdFromTarget)) {
118                         log.info("Found Relying Party for (" + providerIdFromTarget + ").");
119                         return (RelyingParty) relyingParties.get(providerIdFromTarget);
120                 }
121
122                 // Next, check to see if the relying party is in any groups
123                 RelyingParty groupParty = findRelyingPartyByGroup(providerIdFromTarget);
124                 if (groupParty != null) {
125                         log.info("Provider is a member of Relying Party (" + groupParty.getName() + ").");
126                         return new RelyingPartyGroupWrapper(groupParty, providerIdFromTarget);
127                 }
128
129                 // OK, we can't find it... just send the default
130                 RelyingParty relyingParty = getDefaultRelyingParty();
131                 log.info("Could not locate Relying Party configuration for (" + providerIdFromTarget
132                                 + ").  Using default Relying Party: (" + relyingParty.getName() + ").");
133                 return new UnknownProviderWrapper(relyingParty, providerIdFromTarget);
134         }
135
136         private RelyingParty findRelyingPartyByGroup(String providerIdFromTarget) {
137
138                 if (metaData == null) { return null; }
139
140                 EntityDescriptor provider = metaData.lookup(providerIdFromTarget);
141                 if (provider != null) {
142                         EntitiesDescriptor parent = provider.getEntitiesDescriptor();
143                         while (parent != null) {
144                                 if (relyingParties.containsKey(parent.getName())) {
145                                         log.info("Found matching Relying Party for group (" + parent.getName() + ").");
146                                         return (RelyingParty) relyingParties.get(parent.getName());
147                                 } else {
148                                         log.debug("Provider is a member of group (" + parent.getName()
149                                                         + "), but no matching Relying Party was found.");
150                                 }
151                                 parent = parent.getEntitiesDescriptor();
152                         }
153                 }
154                 return null;
155         }
156
157         public RelyingParty getDefaultRelyingParty() {
158
159                 // If there is no explicit default, pick the single configured Relying
160                 // Party
161                 String defaultParty = getOriginConfig().getDefaultRelyingPartyName();
162                 if (defaultParty == null || defaultParty.equals("")) { return (RelyingParty) relyingParties.values().iterator()
163                                 .next(); }
164
165                 // If we do have a default specified, use it...
166                 return (RelyingParty) relyingParties.get(defaultParty);
167         }
168
169         /**
170          * Returns the relying party for a legacy provider(the default)
171          */
172         public RelyingParty getLegacyRelyingParty() {
173
174                 RelyingParty relyingParty = getDefaultRelyingParty();
175                 log.info("Request is from legacy shib target.  Selecting default Relying Party: (" + relyingParty.getName()
176                                 + ").");
177                 return new LegacyWrapper((RelyingParty) relyingParty);
178
179         }
180
181         /**
182          * Returns the appropriate relying party for the supplied service provider id.
183          */
184         public RelyingParty getRelyingParty(String providerIdFromTarget) {
185
186                 if (providerIdFromTarget == null || providerIdFromTarget.equals("")) {
187                         RelyingParty relyingParty = getDefaultRelyingParty();
188                         log.info("Selecting default Relying Party: (" + relyingParty.getName() + ").");
189                         return new NoMetadataWrapper((RelyingParty) relyingParty);
190                 }
191
192                 return (RelyingParty) getRelyingPartyImpl(providerIdFromTarget);
193         }
194
195         private void addRelyingParty(Element e) throws ServiceProviderMapperException {
196
197                 log.debug("Found a Relying Party.");
198                 try {
199                         if (e.getLocalName().equals("RelyingParty")) {
200                                 RelyingParty party = new RelyingPartyImpl(e, configuration, credentials, nameMapper);
201                                 log.debug("Relying Party (" + party.getName() + ") loaded.");
202                                 relyingParties.put(party.getName(), party);
203                         }
204                 } catch (ServiceProviderMapperException exc) {
205                         log.error("Encountered an error while attempting to load Relying Party configuration.  Skipping...");
206                 }
207
208         }
209
210         /**
211          * Base relying party implementation.
212          * 
213          * @author Walter Hoehn
214          */
215         protected class RelyingPartyImpl implements RelyingParty {
216
217                 private RelyingPartyIdentityProvider identityProvider;
218                 private String name;
219                 private String overridenOriginProviderId;
220                 private URL overridenAAUrl;
221                 private URI overridenDefaultAuthMethod;
222                 private String hsNameFormatId;
223                 private IdPConfig configuration;
224                 private boolean overridenPassThruErrors = false;
225                 private boolean passThruIsOverriden = false;
226                 private boolean forceAttributePush = false;
227                 private boolean forceAttributeNoPush = false;
228                 private boolean defaultToPOST = true;
229                 private boolean wantsAssertionsSigned = false;
230                 private int preferredArtifactType = 1;
231                 private String defaultTarget;
232
233                 public RelyingPartyImpl(Element partyConfig, IdPConfig globalConfig, Credentials credentials,
234                                 NameMapper nameMapper) throws ServiceProviderMapperException {
235
236                         configuration = globalConfig;
237
238                         // Get party name
239                         name = ((Element) partyConfig).getAttribute("name");
240                         if (name == null || name.equals("")) {
241                                 log.error("Relying Party name not set.  Add a (name) attribute to <RelyingParty>.");
242                                 throw new ServiceProviderMapperException("Required configuration not specified.");
243                         }
244                         log.debug("Loading Relying Party: (" + name + ").");
245
246                         // Process overrides for global configuration data
247                         String attribute = ((Element) partyConfig).getAttribute("providerId");
248                         if (attribute != null && !attribute.equals("")) {
249                                 log.debug("Overriding providerId for Relying Pary (" + name + ") with (" + attribute + ").");
250                                 overridenOriginProviderId = attribute;
251                         }
252
253                         attribute = ((Element) partyConfig).getAttribute("AAUrl");
254                         if (attribute != null && !attribute.equals("")) {
255                                 log.debug("Overriding AAUrl for Relying Pary (" + name + ") with (" + attribute + ").");
256                                 try {
257                                         overridenAAUrl = new URL(attribute);
258                                 } catch (MalformedURLException e) {
259                                         log.error("(AAUrl) attribute to is not a valid URL.");
260                                         throw new ServiceProviderMapperException("Configuration is invalid.");
261                                 }
262                         }
263
264                         attribute = ((Element) partyConfig).getAttribute("defaultAuthMethod");
265                         if (attribute != null && !attribute.equals("")) {
266                                 log.debug("Overriding defaultAuthMethod for Relying Pary (" + name + ") with (" + attribute + ").");
267                                 try {
268                                         overridenDefaultAuthMethod = new URI(attribute);
269                                 } catch (URISyntaxException e1) {
270                                         log.error("(defaultAuthMethod) attribute to is not a valid URI.");
271                                         throw new ServiceProviderMapperException("Configuration is invalid.");
272                                 }
273                         }
274
275                         attribute = ((Element) partyConfig).getAttribute("passThruErrors");
276                         if (attribute != null && !attribute.equals("")) {
277                                 log.debug("Overriding passThruErrors for Relying Pary (" + name + ") with (" + attribute + ").");
278                                 overridenPassThruErrors = Boolean.valueOf(attribute).booleanValue();
279                                 passThruIsOverriden = true;
280                         }
281
282                         // SSO profile defaulting
283                         attribute = ((Element) partyConfig).getAttribute("defaultToPOSTProfile");
284                         if (attribute != null && !attribute.equals("")) {
285                                 defaultToPOST = Boolean.valueOf(attribute).booleanValue();
286                         }
287                         if (defaultToPOST) {
288                                 log.debug("Relying party defaults to POST profile.");
289                         } else {
290                                 log.debug("Relying party defaults to Artifact profile.");
291                         }
292
293                         // Relying Party wants assertions signed?
294                         attribute = ((Element) partyConfig).getAttribute("signAssertions");
295                         if (attribute != null && !attribute.equals("")) {
296                                 wantsAssertionsSigned = Boolean.valueOf(attribute).booleanValue();
297                         }
298                         if (wantsAssertionsSigned) {
299                                 log.debug("Relying party wants SAML Assertions to be signed.");
300                         } else {
301                                 log.debug("Relying party does not want SAML Assertions to be signed.");
302                         }
303
304                         // Set a default target for use in artifact redirects
305                         defaultTarget = ((Element) partyConfig).getAttribute("defaultTarget");
306
307                         // Determine whether or not we are forcing attribute push on or off
308                         String forcePush = ((Element) partyConfig).getAttribute("forceAttributePush");
309                         String forceNoPush = ((Element) partyConfig).getAttribute("forceAttributeNoPush");
310
311                         if (forcePush != null && Boolean.valueOf(forcePush).booleanValue() && forceNoPush != null
312                                         && Boolean.valueOf(forceNoPush).booleanValue()) {
313                                 log.error("Invalid configuration:  Attribute push is forced to ON and OFF for this relying "
314                                                 + "party.  Turning off forcing in favor of profile defaults.");
315                         } else {
316                                 forceAttributePush = Boolean.valueOf(forcePush).booleanValue();
317                                 forceAttributeNoPush = Boolean.valueOf(forceNoPush).booleanValue();
318                                 log.debug("Attribute push forcing is set to (" + forceAttributePush + ").");
319                                 log.debug("No attribute push forcing is set to (" + forceAttributeNoPush + ").");
320                         }
321
322                         attribute = ((Element) partyConfig).getAttribute("preferredArtifactType");
323                         if (attribute != null && !attribute.equals("")) {
324                                 log.debug("Overriding AAUrl for Relying Pary (" + name + ") with (" + attribute + ").");
325                                 try {
326                                         preferredArtifactType = Integer.parseInt(attribute);
327                                 } catch (NumberFormatException e) {
328                                         log.error("(preferredArtifactType) attribute to is not a valid integer.");
329                                         throw new ServiceProviderMapperException("Configuration is invalid.");
330                                 }
331                                 log.debug("Preferred artifact type: (" + preferredArtifactType + ").");
332                         }
333
334                         // Load and verify the name format that the HS should use in
335                         // assertions for this RelyingParty
336                         NodeList hsNameFormats = ((Element) partyConfig).getElementsByTagNameNS(IdPConfig.configNameSpace,
337                                         "HSNameFormat");
338                         // If no specification. Make sure we have a default mapping
339                         if (hsNameFormats.getLength() < 1) {
340                                 if (nameMapper.getNameIdentifierMappingById(null) == null) {
341                                         log.error("Relying Party HS Name Format not set.  Add a <HSNameFormat> element to <RelyingParty>.");
342                                         throw new ServiceProviderMapperException("Required configuration not specified.");
343                                 }
344
345                         } else {
346                                 // We do have a specification, so make sure it points to a
347                                 // valid Name Mapping
348                                 if (hsNameFormats.getLength() > 1) {
349                                         log.warn("Found multiple HSNameFormat specifications for Relying Party (" + name
350                                                         + ").  Ignoring all but the first.");
351                                 }
352
353                                 hsNameFormatId = ((Element) hsNameFormats.item(0)).getAttribute("nameMapping");
354                                 if (hsNameFormatId == null || hsNameFormatId.equals("")) {
355                                         log.error("HS Name Format mapping not set.  Add a (nameMapping) attribute to <HSNameFormat>.");
356                                         throw new ServiceProviderMapperException("Required configuration not specified.");
357                                 }
358
359                                 if (nameMapper.getNameIdentifierMappingById(hsNameFormatId) == null) {
360                                         log.error("Relying Party HS Name Format refers to a name mapping that is not loaded.");
361                                         throw new ServiceProviderMapperException("Required configuration not specified.");
362                                 }
363                         }
364
365                         // Load the credential for signing
366                         String credentialName = ((Element) partyConfig).getAttribute("signingCredential");
367                         Credential signingCredential = credentials.getCredential(credentialName);
368                         if (signingCredential == null) {
369                                 if (credentialName == null || credentialName.equals("")) {
370                                         log.error("Relying Party credential not set.  Add a (signingCredential) "
371                                                         + "attribute to <RelyingParty>.");
372                                         throw new ServiceProviderMapperException("Required configuration not specified.");
373                                 } else {
374                                         log.error("Relying Party credential invalid.  Fix the (signingCredential) attribute "
375                                                         + "on <RelyingParty>.");
376                                         throw new ServiceProviderMapperException("Required configuration is invalid.");
377                                 }
378
379                         }
380
381                         // Initialize and Identity Provider object for this use by this relying party
382                         identityProvider = new RelyingPartyIdentityProvider(overridenOriginProviderId != null
383                                         ? overridenOriginProviderId
384                                         : configuration.getProviderId(), signingCredential);
385
386                 }
387
388                 public String getProviderId() {
389
390                         return name;
391                 }
392
393                 public String getName() {
394
395                         return name;
396                 }
397
398                 public IdentityProvider getIdentityProvider() {
399
400                         return identityProvider;
401                 }
402
403                 public boolean isLegacyProvider() {
404
405                         return false;
406                 }
407
408                 public String getHSNameFormatId() {
409
410                         return hsNameFormatId;
411                 }
412
413                 public URI getDefaultAuthMethod() {
414
415                         if (overridenDefaultAuthMethod != null) {
416                                 return overridenDefaultAuthMethod;
417                         } else {
418                                 return configuration.getDefaultAuthMethod();
419                         }
420                 }
421
422                 public URL getAAUrl() {
423
424                         if (overridenAAUrl != null) {
425                                 return overridenAAUrl;
426                         } else {
427                                 return configuration.getAAUrl();
428                         }
429                 }
430
431                 public boolean passThruErrors() {
432
433                         if (passThruIsOverriden) {
434                                 return overridenPassThruErrors;
435                         } else {
436                                 return configuration.passThruErrors();
437                         }
438                 }
439
440                 public boolean forceAttributePush() {
441
442                         return forceAttributePush;
443                 }
444
445                 public boolean forceAttributeNoPush() {
446
447                         return forceAttributeNoPush;
448                 }
449
450                 public boolean defaultToPOSTProfile() {
451
452                         return defaultToPOST;
453                 }
454
455                 public boolean wantsAssertionsSigned() {
456
457                         return wantsAssertionsSigned;
458                 }
459
460                 public int getPreferredArtifactType() {
461
462                         return preferredArtifactType;
463                 }
464
465                 public String getDefaultTarget() {
466
467                         return defaultTarget;
468                 }
469
470                 /**
471                  * Default identity provider implementation.
472                  * 
473                  * @author Walter Hoehn
474                  */
475                 protected class RelyingPartyIdentityProvider implements IdentityProvider {
476
477                         private String providerId;
478                         private Credential credential;
479
480                         public RelyingPartyIdentityProvider(String providerId, Credential credential) {
481
482                                 this.providerId = providerId;
483                                 this.credential = credential;
484                         }
485
486                         /*
487                          * @see edu.internet2.middleware.shibboleth.common.IdentityProvider#getProviderId()
488                          */
489                         public String getProviderId() {
490
491                                 return providerId;
492                         }
493
494                         /*
495                          * @see edu.internet2.middleware.shibboleth.common.IdentityProvider#getSigningCredential()
496                          */
497                         public Credential getSigningCredential() {
498
499                                 return credential;
500                         }
501                 }
502
503         }
504
505         /**
506          * Relying party implementation wrapper for relying parties that are groups.
507          * 
508          * @author Walter Hoehn
509          */
510         class RelyingPartyGroupWrapper implements RelyingParty {
511
512                 private RelyingParty wrapped;
513                 private String providerId;
514
515                 RelyingPartyGroupWrapper(RelyingParty wrapped, String providerId) {
516
517                         this.wrapped = wrapped;
518                         this.providerId = providerId;
519                 }
520
521                 public String getName() {
522
523                         return wrapped.getName();
524                 }
525
526                 public boolean isLegacyProvider() {
527
528                         return false;
529                 }
530
531                 public IdentityProvider getIdentityProvider() {
532
533                         return wrapped.getIdentityProvider();
534                 }
535
536                 public String getProviderId() {
537
538                         return providerId;
539                 }
540
541                 public String getHSNameFormatId() {
542
543                         return wrapped.getHSNameFormatId();
544                 }
545
546                 public URL getAAUrl() {
547
548                         return wrapped.getAAUrl();
549                 }
550
551                 public URI getDefaultAuthMethod() {
552
553                         return wrapped.getDefaultAuthMethod();
554                 }
555
556                 public boolean passThruErrors() {
557
558                         return wrapped.passThruErrors();
559                 }
560
561                 public boolean forceAttributePush() {
562
563                         return wrapped.forceAttributePush();
564                 }
565
566                 public boolean forceAttributeNoPush() {
567
568                         return wrapped.forceAttributeNoPush();
569                 }
570
571                 public boolean defaultToPOSTProfile() {
572
573                         return wrapped.defaultToPOSTProfile();
574                 }
575
576                 public boolean wantsAssertionsSigned() {
577
578                         return wrapped.wantsAssertionsSigned();
579                 }
580
581                 public int getPreferredArtifactType() {
582
583                         return wrapped.getPreferredArtifactType();
584                 }
585
586                 public String getDefaultTarget() {
587
588                         return wrapped.getDefaultTarget();
589                 }
590         }
591
592         /**
593          * Relying party implementation wrapper for anonymous service providers.
594          * 
595          * @author Walter Hoehn
596          */
597         protected class UnknownProviderWrapper implements RelyingParty {
598
599                 protected RelyingParty wrapped;
600                 protected String providerId;
601
602                 protected UnknownProviderWrapper(RelyingParty wrapped, String providerId) {
603
604                         this.wrapped = wrapped;
605                         this.providerId = providerId;
606                 }
607
608                 public String getName() {
609
610                         return wrapped.getName();
611                 }
612
613                 public IdentityProvider getIdentityProvider() {
614
615                         return wrapped.getIdentityProvider();
616                 }
617
618                 public String getProviderId() {
619
620                         return providerId;
621                 }
622
623                 public String getHSNameFormatId() {
624
625                         return wrapped.getHSNameFormatId();
626                 }
627
628                 public boolean isLegacyProvider() {
629
630                         return wrapped.isLegacyProvider();
631                 }
632
633                 public URL getAAUrl() {
634
635                         return wrapped.getAAUrl();
636                 }
637
638                 public URI getDefaultAuthMethod() {
639
640                         return wrapped.getDefaultAuthMethod();
641                 }
642
643                 public boolean passThruErrors() {
644
645                         return wrapped.passThruErrors();
646                 }
647
648                 public boolean forceAttributePush() {
649
650                         return false;
651                 }
652
653                 public boolean forceAttributeNoPush() {
654
655                         return false;
656                 }
657
658                 public boolean defaultToPOSTProfile() {
659
660                         return true;
661                 }
662
663                 public boolean wantsAssertionsSigned() {
664
665                         return wrapped.wantsAssertionsSigned();
666                 }
667
668                 public int getPreferredArtifactType() {
669
670                         return wrapped.getPreferredArtifactType();
671                 }
672
673                 public String getDefaultTarget() {
674
675                         return wrapped.getDefaultTarget();
676                 }
677         }
678
679         /**
680          * Relying party wrapper for Shibboleth &lt;=1.1 service providers.
681          * 
682          * @author Walter Hoehn
683          */
684         class LegacyWrapper extends UnknownProviderWrapper implements RelyingParty {
685
686                 LegacyWrapper(RelyingParty wrapped) {
687
688                         super(wrapped, null);
689                 }
690
691                 public boolean isLegacyProvider() {
692
693                         return true;
694                 }
695
696                 public String getHSNameFormatId() {
697
698                         return ((RelyingParty) wrapped).getHSNameFormatId();
699                 }
700
701                 public URL getAAUrl() {
702
703                         return ((RelyingParty) wrapped).getAAUrl();
704                 }
705
706                 public URI getDefaultAuthMethod() {
707
708                         return ((RelyingParty) wrapped).getDefaultAuthMethod();
709                 }
710         }
711
712         /**
713          * Relying party wrapper for providers for which we have no metadata
714          * 
715          * @author Walter Hoehn
716          */
717         class NoMetadataWrapper extends UnknownProviderWrapper implements RelyingParty {
718
719                 NoMetadataWrapper(RelyingParty wrapped) {
720
721                         super(wrapped, null);
722                 }
723
724                 public String getHSNameFormatId() {
725
726                         return ((RelyingParty) wrapped).getHSNameFormatId();
727                 }
728
729                 public URL getAAUrl() {
730
731                         return ((RelyingParty) wrapped).getAAUrl();
732                 }
733
734                 public URI getDefaultAuthMethod() {
735
736                         return ((RelyingParty) wrapped).getDefaultAuthMethod();
737                 }
738         }
739 }