From 3fc853cc1e861f455888a92ff0c9995270d2ba2c Mon Sep 17 00:00:00 2001 From: root Date: Mon, 25 Jul 2011 20:14:02 +0200 Subject: imported 1.1.2 --- .../common/ShibbolethConfigurationException.html | 102 +- .../shibboleth/common/package-frame.html | 4 +- .../shibboleth/common/package-summary.html | 6 +- .../shibboleth/wayf/DiscoveryResponseBuilder.html | 61 - .../shibboleth/wayf/DiscoveryResponseImpl.html | 63 - .../wayf/DiscoveryResponseUnmarshaller.html | 51 - .../shibboleth/wayf/DiscoveryServiceHandler.html | 2021 ++++++++++---------- .../middleware/shibboleth/wayf/HandlerConfig.html | 446 ++--- .../middleware/shibboleth/wayf/IdPSite.html | 455 ++--- .../middleware/shibboleth/wayf/IdPSiteSet.html | 1144 +++++------ .../shibboleth/wayf/IdPSiteSetEntry.html | 116 +- .../wayf/LogbackConfigurationChangeListener.html | 146 +- .../shibboleth/wayf/LogbackLoggingService.html | 130 +- .../middleware/shibboleth/wayf/Version.html | 64 +- .../middleware/shibboleth/wayf/WayfException.html | 96 +- .../middleware/shibboleth/wayf/WayfService.html | 724 ++++--- .../middleware/shibboleth/wayf/XMLConstants.html | 71 +- .../shibboleth/wayf/idpdisco/Description.html | 71 + .../wayf/idpdisco/DescriptionBuilder.html | 58 + .../shibboleth/wayf/idpdisco/DescriptionImpl.html | 61 + .../wayf/idpdisco/DescriptionMarshaller.html | 46 + .../wayf/idpdisco/DescriptionUnmarshaller.html | 39 + .../shibboleth/wayf/idpdisco/DiscoHints.html | 82 + .../wayf/idpdisco/DiscoHintsBuilder.html | 57 + .../shibboleth/wayf/idpdisco/DiscoHintsImpl.html | 94 + .../wayf/idpdisco/DiscoHintsMarshaller.html | 41 + .../wayf/idpdisco/DiscoHintsUnmarshaller.html | 58 + .../shibboleth/wayf/idpdisco/DisplayName.html | 70 + .../wayf/idpdisco/DisplayNameBuilder.html | 58 + .../shibboleth/wayf/idpdisco/DisplayNameImpl.html | 48 + .../wayf/idpdisco/DisplayNameMarshaller.html | 46 + .../wayf/idpdisco/DisplayNameUnmarshaller.html | 38 + .../shibboleth/wayf/idpdisco/DomainHint.html | 69 + .../wayf/idpdisco/DomainHintBuilder.html | 58 + .../shibboleth/wayf/idpdisco/DomainHintImpl.html | 73 + .../wayf/idpdisco/DomainHintMarshaller.html | 52 + .../wayf/idpdisco/DomainHintUnmarshaller.html | 52 + .../shibboleth/wayf/idpdisco/GeolocationHint.html | 70 + .../wayf/idpdisco/GeolocationHintBuilder.html | 58 + .../wayf/idpdisco/GeolocationHintImpl.html | 76 + .../wayf/idpdisco/GeolocationHintMarshaller.html | 52 + .../wayf/idpdisco/GeolocationHintUnmarshaller.html | 47 + .../shibboleth/wayf/idpdisco/IPHint.html | 69 + .../shibboleth/wayf/idpdisco/IPHintBuilder.html | 58 + .../shibboleth/wayf/idpdisco/IPHintImpl.html | 76 + .../shibboleth/wayf/idpdisco/IPHintMarshaller.html | 52 + .../wayf/idpdisco/IPHintUnmarshaller.html | 52 + .../shibboleth/wayf/idpdisco/InformationURL.html | 70 + .../wayf/idpdisco/InformationURLBuilder.html | 58 + .../wayf/idpdisco/InformationURLImpl.html | 68 + .../wayf/idpdisco/InformationURLMarshaller.html | 38 + .../wayf/idpdisco/InformationURLUnmarshaller.html | 37 + .../shibboleth/wayf/idpdisco/LocalizedName.html | 58 + .../wayf/idpdisco/LocalizedNameImpl.html | 89 + .../wayf/idpdisco/LocalizedNameMarshaller.html | 69 + .../wayf/idpdisco/LocalizedNameUnmarshaller.html | 76 + .../shibboleth/wayf/idpdisco/LocalizedURI.html | 58 + .../shibboleth/wayf/idpdisco/LocalizedURIImpl.html | 89 + .../wayf/idpdisco/LocalizedURIMarshaller.html | 69 + .../wayf/idpdisco/LocalizedURIUnmarshaller.html | 76 + .../middleware/shibboleth/wayf/idpdisco/Logo.html | 99 + .../shibboleth/wayf/idpdisco/LogoBuilder.html | 58 + .../shibboleth/wayf/idpdisco/LogoImpl.html | 123 ++ .../shibboleth/wayf/idpdisco/LogoMarshaller.html | 75 + .../shibboleth/wayf/idpdisco/LogoUnmarshaller.html | 81 + .../wayf/idpdisco/PrivacyStatementURL.html | 70 + .../wayf/idpdisco/PrivacyStatementURLBuilder.html | 60 + .../wayf/idpdisco/PrivacyStatementURLImpl.html | 72 + .../idpdisco/PrivacyStatementURLMarshaller.html | 38 + .../idpdisco/PrivacyStatementURLUnmarshaller.html | 38 + .../shibboleth/wayf/idpdisco/UIInfo.html | 119 ++ .../shibboleth/wayf/idpdisco/UIInfoBuilder.html | 55 + .../shibboleth/wayf/idpdisco/UIInfoImpl.html | 115 ++ .../shibboleth/wayf/idpdisco/UIInfoMarshaller.html | 41 + .../wayf/idpdisco/UIInfoUnmarshaller.html | 61 + .../shibboleth/wayf/idpdisco/package-frame.html | 195 ++ .../shibboleth/wayf/idpdisco/package-summary.html | 352 ++++ .../middleware/shibboleth/wayf/package-frame.html | 4 +- .../shibboleth/wayf/package-summary.html | 6 +- .../middleware/shibboleth/wayf/plugins/Plugin.html | 320 ++-- .../shibboleth/wayf/plugins/PluginContext.html | 64 +- .../wayf/plugins/PluginMetadataParameter.html | 62 +- .../wayf/plugins/WayfRequestHandled.html | 36 +- .../shibboleth/wayf/plugins/package-frame.html | 4 +- .../shibboleth/wayf/plugins/package-summary.html | 6 +- .../wayf/plugins/provider/BindingFilter.html | 354 ++-- .../wayf/plugins/provider/ListFilter.html | 374 ++-- .../wayf/plugins/provider/SamlCookiePlugin.html | 1090 +++++------ .../wayf/plugins/provider/package-frame.html | 4 +- .../wayf/plugins/provider/package-summary.html | 6 +- 90 files changed, 8298 insertions(+), 4020 deletions(-) delete mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseBuilder.html delete mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseImpl.html delete mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/Description.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHints.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayName.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHint.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHint.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHint.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURL.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedName.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURI.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/Logo.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURL.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfo.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoBuilder.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoImpl.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoMarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoUnmarshaller.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/package-frame.html create mode 100644 doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/package-summary.html (limited to 'doc/src-xref/edu') diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/common/ShibbolethConfigurationException.html b/doc/src-xref/edu/internet2/middleware/shibboleth/common/ShibbolethConfigurationException.html index 195e695..969edeb 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/common/ShibbolethConfigurationException.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/common/ShibbolethConfigurationException.html @@ -1,63 +1,63 @@ - + ShibbolethConfigurationException xref
View Javadoc
 
-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.common;
-18  
-19  /**
-20   * Signals that the a Shibboleth component has been given insufficient or improper runtime configuration paramerts.
-21   * 
-22   * @author Walter Hoehn (wassa@columbia.edu)
-23   */
-24  public class ShibbolethConfigurationException extends Exception {
-25  
-26      /**
-27       * 'Required' Serial ID.
-28       */
-29      private static final long serialVersionUID = 3052563354463892233L;
-30  
-31      /**
-32       * Build an object embedding a String message.  Normally called for detected errors.
-33       * 
-34       * @param message - Text (in US English) describing the reason for raising the exception.
-35       */
-36      public ShibbolethConfigurationException(String message) {
-37          super(message);
-38          }
-39  
-40      /**
-41       * Build an object which embeds an message an exception. 
-42       * Normally called to pass on errors found at a lower level.
-43       * 
-44       * @param message - Text (in US English) describing the reasdon for raising the exception.
-45       * @param t - Cause for the failure as returned by the lower level component. 
-46       */
-47      public ShibbolethConfigurationException(String message, Throwable t) {
-48          super(message,t);
-49      }
-50  }
+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.common;
+18  
+19  /**
+20   * Signals that the a Shibboleth component has been given insufficient or improper runtime configuration paramerts.
+21   * 
+22   * @author Walter Hoehn (wassa@columbia.edu)
+23   */
+24  public class ShibbolethConfigurationException extends Exception {
+25  
+26      /**
+27       * 'Required' Serial ID.
+28       */
+29      private static final long serialVersionUID = 3052563354463892233L;
+30  
+31      /**
+32       * Build an object embedding a String message.  Normally called for detected errors.
+33       * 
+34       * @param message - Text (in US English) describing the reason for raising the exception.
+35       */
+36      public ShibbolethConfigurationException(String message) {
+37          super(message);
+38          }
+39  
+40      /**
+41       * Build an object which embeds an message an exception. 
+42       * Normally called to pass on errors found at a lower level.
+43       * 
+44       * @param message - Text (in US English) describing the reasdon for raising the exception.
+45       * @param t - Cause for the failure as returned by the lower level component. 
+46       */
+47      public ShibbolethConfigurationException(String message, Throwable t) {
+48          super(message,t);
+49      }
+50  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/common/package-frame.html b/doc/src-xref/edu/internet2/middleware/shibboleth/common/package-frame.html index 6a60a72..08902be 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/common/package-frame.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/common/package-frame.html @@ -2,8 +2,8 @@ - - Shibboleth Discovery Service 1.1.1 Reference Package edu.internet2.middleware.shibboleth.common + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.common diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/common/package-summary.html b/doc/src-xref/edu/internet2/middleware/shibboleth/common/package-summary.html index 75321a1..4ce0496 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/common/package-summary.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/common/package-summary.html @@ -2,8 +2,8 @@ - - Shibboleth Discovery Service 1.1.1 Reference Package edu.internet2.middleware.shibboleth.common + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.common @@ -62,6 +62,6 @@
- Copyright © 2006-2009 Internet2. All Rights Reserved. + Copyright © 2006-2010 Internet2. All Rights Reserved. \ No newline at end of file diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseBuilder.html deleted file mode 100644 index 07ceb25..0000000 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseBuilder.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - -DiscoveryResponseBuilder xref - - - -
View Javadoc
-
-1   /*
-2    * Copyright [2006] [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  /**
-18   * 
-19   */
-20  
-21  package edu.internet2.middleware.shibboleth.wayf;
-22  
-23  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
-24  import org.opensaml.common.xml.SAMLConstants;
-25  
-26  /**
-27   * Builder of {@link org.opensaml.saml2.metadata.impl.SingleLogoutServiceImpl}.
-28   */
-29  public class DiscoveryResponseBuilder extends AbstractSAMLObjectBuilder<DiscoveryResponseImpl> {
-30  
-31      /**
-32       * Constructor
-33       */
-34      public DiscoveryResponseBuilder() {
-35  
-36      }
-37  
-38      /** {@inheritDoc} */
-39      public DiscoveryResponseImpl buildObject() {
-40          return buildObject(SAMLConstants.SAML20MD_NS, DiscoveryResponseImpl.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
-41      }
-42  
-43      /** {@inheritDoc} */
-44      public DiscoveryResponseImpl buildObject(String namespaceURI, String localName, String namespacePrefix) {
-45          return new DiscoveryResponseImpl(namespaceURI, localName, namespacePrefix);
-46      }
-47  }
-
-
- - diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseImpl.html deleted file mode 100644 index 92c9612..0000000 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseImpl.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - -DiscoveryResponseImpl xref - - - -
View Javadoc
-
-1   /*
-2    * Copyright [2006] [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  /**
-18   * 
-19   */
-20  
-21  package edu.internet2.middleware.shibboleth.wayf;
-22  
-23  import org.opensaml.saml2.metadata.IndexedEndpoint;
-24  import org.opensaml.saml2.metadata.impl.IndexedEndpointImpl;
-25  
-26  /**
-27   * This plugs into the standard opensaml2 parser framework to allow us to get use <code> DiscoverResponse </code>
-28   * elements in our extensions.
-29   */
-30  public class DiscoveryResponseImpl extends IndexedEndpointImpl implements IndexedEndpoint {
-31  
-32      /** Namespace for Discovery Service metadata extensions. */
-33      
-34      public static final String METADATA_NS = "urn:oasis:names:tc:SAML:profiles:SSO:idp-discovery-protocol";
-35      /** Name of the element inside the Extensions. */
-36      
-37      protected static final String DEFAULT_ELEMENT_LOCAL_NAME = "DiscoveryResponse";
-38      
-39      /**
-40       * Constructor.
-41       * 
-42       * @param namespaceURI the Uri
-43       * @param elementLocalName the local name
-44       * @param namespacePrefix the prefix
-45       */
-46      protected DiscoveryResponseImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
-47          super(namespaceURI, elementLocalName, namespacePrefix);
-48      }
-49  }
-
-
- - diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseUnmarshaller.html deleted file mode 100644 index 45cb6f2..0000000 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryResponseUnmarshaller.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - -DiscoveryResponseUnmarshaller xref - - - -
View Javadoc
-
-1   /*
-2    * Copyright [2006] [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  /**
-18   * 
-19   */
-20  
-21  package edu.internet2.middleware.shibboleth.wayf;
-22  
-23  import org.opensaml.saml2.metadata.impl.IndexedEndpointUnmarshaller;
-24  import org.opensaml.xml.XMLObject;
-25  import org.opensaml.xml.io.UnmarshallingException;
-26  import org.w3c.dom.Attr;
-27  
-28  /**
-29   * A thread safe Unmarshaller for {@link org.opensaml.saml2.metadata.SingleLogoutService} objects.
-30   */
-31  public class DiscoveryResponseUnmarshaller extends IndexedEndpointUnmarshaller {
-32  
-33      /** {@inheritDoc} */
-34      protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
-35          super.processAttribute(samlObject, attribute);
-36      }
-37  }
-
-
- - diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryServiceHandler.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryServiceHandler.html index a9e9e2f..cb90575 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryServiceHandler.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/DiscoveryServiceHandler.html @@ -1,1016 +1,1029 @@ - + DiscoveryServiceHandler xref
View Javadoc
 
-1   /**
-2    * Copyright [2006] [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  package edu.internet2.middleware.shibboleth.wayf;
-17  
-18  import java.io.IOException;
-19  import java.io.UnsupportedEncodingException;
-20  import java.net.MalformedURLException;
-21  import java.net.URL;
-22  import java.net.URLDecoder;
-23  import java.net.URLEncoder;
-24  import java.util.ArrayList;
-25  import java.util.Collection;
-26  import java.util.Comparator;
-27  import java.util.Date;
-28  import java.util.HashSet;
-29  import java.util.Hashtable;
-30  import java.util.List;
-31  import java.util.Locale;
-32  import java.util.Map;
-33  import java.util.Set;
-34  import java.util.TreeSet;
-35  
-36  import javax.servlet.RequestDispatcher;
-37  import javax.servlet.ServletException;
-38  import javax.servlet.http.HttpServletRequest;
-39  import javax.servlet.http.HttpServletResponse;
-40  
-41  import org.opensaml.saml2.common.Extensions;
-42  import org.opensaml.saml2.metadata.EntityDescriptor;
-43  import org.opensaml.saml2.metadata.RoleDescriptor;
-44  import org.opensaml.saml2.metadata.SPSSODescriptor;
-45  import org.opensaml.samlext.idpdisco.DiscoveryResponse;
-46  import org.opensaml.xml.XMLObject;
-47  import org.slf4j.Logger;
-48  import org.slf4j.LoggerFactory;
-49  import org.w3c.dom.Element;
-50  import org.w3c.dom.NodeList;
-51  
-52  import edu.internet2.middleware.shibboleth.common.ShibbolethConfigurationException;
-53  import edu.internet2.middleware.shibboleth.wayf.plugins.Plugin;
-54  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginContext;
-55  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginMetadataParameter;
-56  import edu.internet2.middleware.shibboleth.wayf.plugins.WayfRequestHandled;
-57  
-58  /**
-59    * Specific handler for each version of the Discovery Service. 
-60    */
-61  public class DiscoveryServiceHandler {
-62  
-63      /*
-64       * Protcol parameters - Old.
-65       */
-66      /**
-67       * Shire is the SP Assertion Consumer endpoint.
-68       */
-69      private static final String SHIRE_PARAM_NAME = "shire";
-70      /**
-71       * TargetName is where we are trying to get to.
-72       */
-73      private static final String TARGET_PARAM_NAME = "target";
-74      /**
-75       * time is to do with replay attack.
-76       */
-77      private static final String TIME_PARAM_NAME = "time";
-78      /**
-79       * This is the ID (in the metadata) of the SP.
-80       */
-81      private static final String PROVIDERID_PARAM_NAME = "providerId";
-82      
-83      /*
-84       * Protocol parameters - New
-85       */
-86      /**
-87       * The SP id.
-88       */
-89      private static final String ENTITYID_PARAM_NAME = "entityID";
-90      /**
-91       * Where to send the request back to.
-92       */
-93      private static final String RETURN_PARAM_NAME = "return";
-94      /**
-95       * "return" is an invalid attribute, so we use returnX.
-96       */
-97      private static final String RETURN_ATTRIBUTE_NAME = "returnX";
-98      /**
-99       * Alternatively the index of where to send the address back to.
-100      */
-101     private static final String RETURN_INDEX_NAME = "returnIndex";
-102     
-103     /**
-104      * What value to put the ID of the selected metadata into.
-105      */
-106     private static final String RETURNID_PARAM_NAME = "returnIDParam";
-107     
-108     /**
-109      * What returnIDParam defaults to.
-110      */
-111     private static final String RETURNID_DEFAULT_VALUE = "entityID";
-112     /**
-113      * Whether we are allowed to interact.
-114      */
-115     private static final String ISPASSIVE_PARAM_NAME = "isPassive";
-116     
-117     /**
-118      * Whether we understand this or not.
-119      */
-120     private static final String POLICY_PARAM_NAME = "policy";
-121 
-122     /**
-123      * The only policy we know about.
-124      */
-125     private static final String KNOWN_POLICY_NAME 
-126         = "urn:oasis:names:tc:SAML:profiles:SSO:idp-discoveryprotocol:single";
-127     
-128     /**
-129      * Mandatory Serialization constant.
-130      */
-131     private static final  Logger LOG = LoggerFactory.getLogger(DiscoveryServiceHandler.class.getName());
-132 
-133     /**
-134      * The location defines the last part of the URL which distinguished this handler. 
-135      */
-136     private final String location;
-137     
-138     /**
-139      * If isDefault is true then if there is a mismatch then this handler is used.  
-140      */
-141     private final boolean isDefault;
-142     
-143     /**
-144      * Config handles detailed behavior.
-145      */
-146     private final HandlerConfig config;
-147     
-148     /**
-149      * The list of all the metadata providers that this discovery handler believes in.
-150      */
-151     private final List <IdPSiteSet> siteSets;
-152     
-153     /**
-154      * The list of all the plugins that this hanlder has had configured.
-155      */
-156     private final List <Plugin> plugins;
-157     
-158     /**
-159      * Constructor to create and configure the handler.
-160      * @param config - DOM Element with configuration information.
-161      * @param federations - Supplies all known providers which will be included if so configured.
-162      * @param plugins - Supplies all known plugins which will be included if configured in. 
-163      * @param defaultConfig - The default configurations.
-164      * @throws ShibbolethConfigurationException - if we find something odd in the config file. 
-165      */
-166     protected DiscoveryServiceHandler(Element config, 
-167                                       Hashtable <String, IdPSiteSet> federations,
-168                                       Hashtable <String, Plugin> plugins, 
-169                                       HandlerConfig defaultConfig) throws ShibbolethConfigurationException
-170     {
-171         siteSets = new ArrayList <IdPSiteSet>(federations.size());
-172         this.plugins = new ArrayList <Plugin>(plugins.size());
-173 
-174         //
-175         // Collect the Configuration from the XML
-176         //
-177         
-178         this.config = new HandlerConfig(config, defaultConfig);
-179         
-180         location = config.getAttribute("location");
-181         
-182         if (location == null || location.equals("")) {
-183                 
-184                 LOG.error("DiscoveryService must have a location specified");
-185                 throw new ShibbolethConfigurationException("DiscoveryService must have a location specified");  
-186         }
-187         
-188         //
-189         // Is this the default WAYF?
-190         //
-191         
-192         String attribute = config.getAttribute("default");
-193         if (attribute != null && !attribute.equals("")) {
-194                 isDefault = Boolean.valueOf(attribute).booleanValue();
-195         } else {
-196                 isDefault = false;
-197         }
-198         
-199         //
-200         // Which federations (sitesets) do we care about?
-201         //
-202         
-203         NodeList list = config.getElementsByTagName("Federation");
-204                 
-205         for (int i = 0; i < list.getLength(); i++ ) {
-206                     
-207             attribute = ((Element) list.item(i)).getAttribute("identifier");
-208                     
-209                 IdPSiteSet siteset = federations.get(attribute);
-210                 
-211                 if (siteset == null) {
-212                     LOG.error("Handler " + location + ": could not find metadata for <Federation> with identifier " + attribute + ".");
-213                     throw new ShibbolethConfigurationException(
-214                            "Handler " + location + ": could not find metadata for  <Federation> identifier " + attribute + ".");
-215                 }
-216                 
-217                 siteSets.add(siteset);
-218         }
-219 
-220         if (siteSets.size() == 0) {
-221             //
-222             // No Federations explicitly named pick em all
-223             //
-224             siteSets.addAll(federations.values());
-225         }
-226         
-227         //
-228         // Now, which plugins?
-229         //
-230 
-231         list = config.getElementsByTagName("PluginInstance");
-232         
-233         for (int i = 0; i < list.getLength(); i++ ) {
-234                     
-235             attribute = ((Element) list.item(i)).getAttribute("identifier");
-236                     
-237                 Plugin plugin = plugins.get(attribute);
-238                 
-239                 if (plugin == null) {
-240                     LOG.error("Handler " + location + ": could not find plugin for identifier " + attribute);
-241                     throw new ShibbolethConfigurationException(
-242                               "Handler " + location + ": could not find plugin for identifier " + attribute);
-243                 }
-244                 
-245                 this.plugins.add(plugin);
-246         }
-247 
-248         //
-249         // So now tell every IdPSite about every plugin.
-250         //
-251         // Note that there is only one idpsite per metadatafile per WAYF and that the discovery 
-252         // services share them, so the data explosion is only number(IdpSites) * number(Plugins) not
-253         // number(IdpSites) * number(Plugins) * number(DiscoverHandlers)
-254         
-255         for (IdPSiteSet site: siteSets) {
-256             for (Plugin plugin: this.plugins) {
-257                 site.addPlugin(plugin);
-258             }
-259         }
-260     }
-261     
-262     
-263     //
-264     // Standard Beany Methods
-265     //
-266     /**
-267      * The 'Name' of the service. the path used to identify the ServiceHandler.
-268      * @return the path used to identify the ServiceHandler.
-269      */
-270     
-271     protected String getLocation() {
-272         return location;
-273     }
-274 
-275     /**
-276      * Whether this is the default service.
-277      * @return is it?
-278      */
-279     protected boolean isDefault() {
-280         return isDefault;
-281     }
-282     
-283     //
-284     // Now the bits that deal with the user request
-285     //
-286 
-287     public void doGet(HttpServletRequest req, HttpServletResponse res) {
-288         
-289         String policy = req.getParameter(POLICY_PARAM_NAME);
-290         
-291         if (null != policy && !KNOWN_POLICY_NAME.equals(policy)) {
-292             //
-293             // unknown policy
-294             //
-295             LOG.error("Unknown policy " + policy);
-296             handleError(req, res, "Unknown policy " + policy);
-297             return;
-298         }
-299         
-300         //
-301         // Decide how to route the request based on query string
-302         //
-303         String requestType = req.getParameter("action");
-304         
-305         if (requestType == null || requestType.equals("")) {
-306             requestType = "lookup";
-307         }
-308         
-309         try {
-310 
-311             if (requestType.equals("search")) {
-312                     
-313                 String parameter = req.getParameter("string"); 
-314                 if (parameter != null && parameter.equals("")) {
-315                         parameter = null;
-316                 }
-317                 handleLookup(req, res, parameter);
-318                     
-319             } else if (requestType.equals("selection")) {
-320                     
-321                 handleSelection(req, res);
-322             } else {
-323                 handleLookup(req, res, null);
-324             }
-325         } catch (WayfException we) {
-326             LOG.error("Error processing DS request:", we);
-327             handleError(req, res, we.getLocalizedMessage());
-328         } catch (WayfRequestHandled we) {
-329             //
-330             // Yuck - a sucess path involving an exception
-331             //
-332         }
-333 
-334     }
-335         
-336     /**
-337      * When the WAYF user has selected something we look it up, tell the plugins and then dispatch to the Idp.
-338      *  
-339      * @param req - standard J2EE stuff
-340      * @param res - standard J2EE stuff
-341      * @throws WayfRequestHandled - if one of the plugins has done the dispatch
-342      * @throws WayfException - if we had an errors
-343      */
-344     private void handleSelection(HttpServletRequest req, 
-345                                  HttpServletResponse res) throws WayfRequestHandled, WayfException 
-346      {
-347             
-348         String idpName = req.getParameter("origin");
-349         LOG.debug("Processing handle selection: " + idpName);
-350 
-351         String sPName = getSPId(req);
-352 
-353         if (idpName == null || idpName.equals("")) {
-354             handleLookup(req, res, null);
-355             return;
-356         }
-357 
-358         if (getValue(req, SHIRE_PARAM_NAME) == null) {
-359             //
-360             // 2.0 protocol
-361             //
-362             setupReturnAddress(sPName, req);
-363         }
-364         //
-365         // Notify plugins
-366         //
-367         IdPSite site = null; 
-368         
-369         for (Plugin plugin:plugins) {
-370             for (IdPSiteSet idPSiteSet: siteSets) {
-371                 PluginMetadataParameter param = idPSiteSet.paramFor(plugin);
-372                 plugin.selected(req, res, param, idpName);
-373                 if (site == null && idPSiteSet.containsIdP(idpName)) {
-374                     site = idPSiteSet.getSite(idpName);
-375                 }
-376             }
-377         }
-378         
-379         if (site == null) {
-380             handleLookup(req, res, null);
-381         } else {
-382             forwardRequest(req, res, site);
-383         }
-384     }
-385 
-386 
-387     /**
-388      * This sets up the parameter RETURN_ATTRIBUTE_NAME with the return address 
-389      * harvested from the reqest.
-390      * <ul><le>If a "return" parameter is present we check in the metadata for spoofing 
-391      *         and then set up from there </le>
-392      *     <le>If "returnID" is specified we get this from the metadata</le>
-393      *     <le>If nothing is provided we get the default from the metadata (if provided)</le>
-394      *     <le>Otherwise we whine</le>
-395      * </ul>     
-396      * @param spName - the name of the Service provider.
-397      * @param req - The request.
-398      * @throws WayfException - if we spot spoofing or there is no defaumlt 
-399      */
-400     private void setupReturnAddress(String spName, HttpServletRequest req) throws WayfException{
-401         
-402         DiscoveryResponse[] discoveryServices;
-403         Set<XMLObject> objects = new HashSet<XMLObject>();
-404         String defaultName = null;
-405         
-406         for (IdPSiteSet metadataProvider:siteSets) {
-407             
-408             //
-409             // Only do work if the SP makes sense
-410             //
-411 
-412             if (metadataProvider.containsSP(spName)) {
-413                
-414                 //
-415                 // The name makes sense so let's get the entity and from that
-416                 // all of its roles
-417                 //
-418                 
-419                 EntityDescriptor entity = metadataProvider.getEntity(spName);
-420                 List<RoleDescriptor> roles = entity.getRoleDescriptors();
-421                 
-422                 for (RoleDescriptor role:roles) {
-423                     
-424                     //
-425                     // Check every role
-426                     //
-427                     
-428                     if (role instanceof SPSSODescriptor) {
-429                         
-430                         //
-431                         // And grab hold of all the extensions for SPSSO descriptors
-432                         //
-433                         
-434                         Extensions exts = role.getExtensions();
-435                         if (exts != null) {
-436                             objects.addAll(exts.getOrderedChildren());
-437                         }
-438                     }
-439                 }
-440             }
-441         }
-442         
-443         //
-444         // Now, let's strip out everything which isn't a DiscoveryService
-445         //
-446         
-447         discoveryServices = new DiscoveryResponse[objects.size()];
-448         int dsCount = 0;
-449         
-450         for (XMLObject obj:objects) {
-451             if (obj instanceof DiscoveryResponse) {
-452                 DiscoveryResponse ds = (DiscoveryResponse) obj;
-453                 discoveryServices[dsCount++] = ds;
-454                 if (ds.isDefault() || null == defaultName) {
-455                     defaultName = ds.getLocation();
-456                 }
-457             }
-458         }
-459         
-460         //
-461         // Now process the return parameters.  The name is either a parameter
-462         // called RETURN_PARAM_NAME or an attributes called RETURN_ATTRIBUTE_NAME
-463         //
-464         String returnName = req.getParameter(RETURN_PARAM_NAME);
-465         
-466         if (returnName == null || returnName.length() == 0) {
-467             returnName = getValue(req, RETURN_ATTRIBUTE_NAME);
-468         }
-469         
-470         //
-471         // Return index is only ever a parameter
-472         //
-473         
-474         String returnIndex = req.getParameter(RETURN_INDEX_NAME);
-475         
-476         if (returnName != null && returnName.length() != 0) {
-477             //
-478             // Given something so we have to police it.
-479             //
-480             String nameNoParam = returnName;
-481             URL providedReturnURL;
-482             int index = nameNoParam.indexOf('?');
-483             boolean found = false;
-484             
-485             if (index >= 0) {
-486                 nameNoParam = nameNoParam.substring(0,index);
-487             }
-488             
-489             try {
-490                 providedReturnURL = new URL(nameNoParam);                
-491             } catch (MalformedURLException e) {
-492                 throw new WayfException("Couldn't parse provided return name " + nameNoParam, e);
-493             }
-494             
-495             
-496             for (DiscoveryResponse disc: discoveryServices) {
-497                 if (equalsURL(disc, providedReturnURL)) {
-498                     found = true;
-499                     break;
-500                 }
-501             }
-502             if (!found) {
-503                 throw new WayfException("Couldn't find endpoint " + nameNoParam + " in metadata");
-504             }
-505         } else if (returnIndex != null && returnIndex.length() != 0) {
-506             
-507             int index; 
-508             try {
-509                 index = Integer.parseInt(returnIndex);
-510             } catch (NumberFormatException e) {
-511                 throw new WayfException("Couldn't convert " + returnIndex + " into an index");
-512             }
-513             //
-514             // So look throught to find the endpoint with the correct index
-515             //
-516 
-517             boolean found = false;
-518             
-519             for (DiscoveryResponse disc: discoveryServices) {
-520                 if (index  == disc.getIndex()) {
-521                     found = true;
-522                     returnName = disc.getLocation();
-523                     break;
-524                 }
-525             }
-526             if (!found) {
-527                 throw new WayfException("Couldn't not find endpoint " + returnIndex + "in metadata");
-528             }
-529         } else {
-530             //
-531             // No name, not index, so we want the default
-532             //
-533             returnName = defaultName;
-534         }
-535         //
-536         // So by now returnName has the correct value, either harvested from or
-537         // policed against the metadata
-538         //
-539         req.setAttribute(RETURN_ATTRIBUTE_NAME, returnName);
-540     }
-541 
-542     /**
-543      * Helper function to see whather the provided endpoint in the metadata matches the 
-544      * provided return URL in the request.
-545      * 
-546      * @param discovery
-547      * @param providedName
-548      * @return
-549      */
-550     private static boolean equalsURL(DiscoveryResponse discovery, URL providedName) {
-551         
-552         //
-553         // Nothing provided - no match
-554         //
-555         if (null == discovery) {
-556             return false;
-557         }
-558         
-559         URL discoveryName;
-560         try {
-561             discoveryName = new URL(discovery.getLocation());
-562         } catch (MalformedURLException e) {
-563             //
-564             // Something bad happened.  Log it (it is only of interest to the sysadmin, not to the user)
-565             //
-566             LOG.warn("Found invalid discovery end point : " + discovery.getLocation(), e);
-567             return false;
-568         }
-569         
-570         return providedName.equals(discoveryName);
-571         
-572     }
-573 
-574     /**
-575      * Displays a Discovery Service selection page, having first consulted the plugins as needed.
-576      * @param req Describes the request
-577      * @param res Describes the response
-578      * @param searchName What are we looking for?
-579      * 
-580      * @throws WayfRequestHandled if a plugin has dealt with the request
-581      * @throws WayfException in case of an error.
-582      */
-583     private void handleLookup(HttpServletRequest req, 
-584                               HttpServletResponse res, 
-585                               String searchName) throws WayfException, WayfRequestHandled {
-586         
-587         String shire = getValue(req, SHIRE_PARAM_NAME);
-588         String providerId = getSPId(req);
-589         boolean twoZeroProtocol = (shire == null);
-590         boolean isPassive = (twoZeroProtocol && 
-591                              "true".equalsIgnoreCase(getValue(req, ISPASSIVE_PARAM_NAME)));
-592 
-593         Collection <IdPSiteSetEntry> siteLists = null;
-594         Collection<IdPSite> searchResults = null;
-595         
-596         if (config.getProvideListOfLists()) {
-597             siteLists = new ArrayList <IdPSiteSetEntry>(siteSets.size());
-598         }
-599 
-600         Collection <IdPSite> sites = null;
-601         Comparator<IdPSite> comparator = new IdPSite.Compare(req);
-602        
-603         if (config.getProvideList()) {
-604             sites = new TreeSet<IdPSite>(comparator);
-605         }
-606 
-607         if (searchName != null && !searchName.equals("")) {
-608             searchResults = new TreeSet<IdPSite>(comparator);
-609         }
-610 
-611         LOG.debug("Processing Idp Lookup for : " + providerId);
-612 
-613         //
-614         // Iterate over all the sitesets and if they know about the SP pass them to the plugins
-615         // and then add them too the list
-616         //
-617 
-618         PluginContext[] ctx = new PluginContext[plugins.size()];
-619         List<IdPSite> hintList = new ArrayList<IdPSite>();
-620         
-621         if (twoZeroProtocol) {
-622             setupReturnAddress(providerId, req);
-623         }
-624         //
-625         // By having siteLists and sites as parameters we only iterate over 
-626         // the metadata arrays once.
-627         //
-628         try {   
-629             for (IdPSiteSet metadataProvider:siteSets) {
-630                 
-631                 //
-632                 // Only do work if the SP makes sense
-633                 //
-634 
-635                 if (metadataProvider.containsSP(providerId) || !config.getLookupSp()) {
-636 
-637                     Collection <IdPSite> search = null;
-638                     
-639                     if (searchResults != null) {
-640                         search = new TreeSet<IdPSite>(comparator);
-641                     }
-642 
-643                     Map <String, IdPSite> theseSites = metadataProvider.getIdPSites(searchName, config, search);
-644                     
-645                     //
-646                     // Consult the plugins
-647                     //
-648                     for (int i = 0; i < plugins.size(); i++) {
-649                             
-650                         Plugin plugin = plugins.get(i);
-651                         
-652                         if (searchResults == null) {
-653                             //
-654                             // This was a search
-655                             //
-656                             ctx[i] = plugin.lookup(req, 
-657                                                    res, 
-658                                                    metadataProvider.paramFor(plugin), 
-659                                                    theseSites, 
-660                                                    ctx[i], 
-661                                                    hintList);
-662                         } else {
-663                             ctx[i] = plugin.search(req, 
-664                                                    res, 
-665                                                    metadataProvider.paramFor(plugin), 
-666                                                    searchName, 
-667                                                    theseSites, 
-668                                                    ctx[i], 
-669                                                    searchResults, 
-670                                                    hintList);
-671                         }
-672                     }
-673                     
-674                     if (null == theseSites || theseSites.isEmpty()) {
-675                         continue;
-676                     }
-677                     
-678                     //
-679                         
-680                     // Accumulate any per-metadata provider information
-681                     // 
-682             
-683                     Collection<IdPSite> values = new TreeSet<IdPSite>(comparator);
-684                     if (null != theseSites) {
-685                         values.addAll(theseSites.values());
-686                     }
-687                     
-688                     if (siteLists != null) {
-689                         siteLists.add(new IdPSiteSetEntry(metadataProvider,values));
-690                     }
-691                             
-692                     if (sites != null) {
-693                         sites.addAll(values);
-694                     }
-695                     
-696                     if (searchResults != null) {
-697                         searchResults.addAll(search);
-698                     }
-699                 }
-700             }
-701             
-702             if (isPassive) {
-703                 //
-704                 // No GUI intervention.
-705                 //
-706                 if (0 != hintList.size()) {
-707                     //
-708                     // We found a candidate, hand it back
-709                     //
-710                     forwardRequest(req, res, hintList.get(0));
-711                 } else {
-712                     forwardRequest(req, res, null);
-713                 }   
-714                 return;
-715             }
-716             
-717             //
-718             // Now set up all the funky stuff that the JSP needs.  Firstly the protocol
-719             // specific parameters which will come back to us
-720             //
-721             
-722             if (twoZeroProtocol) {
-723                 //
-724                 // The return address was set up in setupReturnAddress
-725                 //
-726                 String returnString = (String) req.getAttribute(RETURN_ATTRIBUTE_NAME);
-727                 if (null == returnString || 0 == returnString.length()) {
-728                     throw new WayfException("Parameter " + RETURN_PARAM_NAME + " not supplied");
-729                 }
-730 
-731                 String returnId = getValue(req, RETURNID_PARAM_NAME);
-732                 if (null == returnId || 0 == returnId.length()) {
-733                     returnId = RETURNID_DEFAULT_VALUE;
-734                 }
-735                 //
-736                 // Return *means* something so we cannot use it as an attribute
-737                 //
-738                 req.setAttribute(RETURN_ATTRIBUTE_NAME, returnString);
-739                 req.setAttribute(RETURNID_PARAM_NAME, returnId);
-740                 req.setAttribute(ENTITYID_PARAM_NAME, providerId);
-741                 
-742             } else {
-743                 String target = getValue(req, TARGET_PARAM_NAME);
-744                 if (null == target || 0 == target.length()) {
-745                     throw new WayfException("Could not extract target from provided parameters");
-746                 }
-747                 req.setAttribute(SHIRE_PARAM_NAME, shire);
-748                 req.setAttribute(TARGET_PARAM_NAME, target);
-749                 req.setAttribute(PROVIDERID_PARAM_NAME, providerId);
-750                 //
-751                 // Time is in unix format
-752                 //
-753                 req.setAttribute("time", new Long(new Date().getTime() / 1000).toString()); 
-754                 
-755             }
-756             
-757             //
-758             // Setup the stuff that the GUI wants.  
-759             //
-760                 
-761             setDisplayLanguage(sites, req);
-762             req.setAttribute("sites", sites);
-763             if (null != siteLists) {
-764                 for (IdPSiteSetEntry siteSetEntry:siteLists) {
-765                     setDisplayLanguage(siteSetEntry.getSites(), req);
-766                 }
-767             }
-768                 
-769             req.setAttribute("siteLists", siteLists);
-770             req.setAttribute("requestURL", req.getRequestURI().toString());
-771 
-772             if (searchResults != null) {
-773                 if (searchResults.size() != 0) {
-774                     setDisplayLanguage(searchResults, req);
-775                     req.setAttribute("searchresults", searchResults);
-776                 } else {
-777                     req.setAttribute("searchResultsEmpty", "true");
-778                 }
-779             }
-780 
-781             if (hintList.size() > 0) {
-782                 setDisplayLanguage(hintList, req);
-783                 req.setAttribute("cookieList", hintList);
-784             }
-785 
-786             LOG.debug("Displaying WAYF selection page.");
-787             RequestDispatcher rd = req.getRequestDispatcher(config.getJspFile());
-788 
-789             //
-790             // And off to the jsp
-791             //
-792             rd.forward(req, res);
-793         } catch (IOException ioe) {
-794             LOG.error("Problem displaying WAYF UI.\n" +  ioe.getMessage());
-795             throw new WayfException("Problem displaying WAYF UI", ioe);
-796         } catch (ServletException se) {
-797             LOG.error("Problem displaying WAYF UI.\n" +  se.getMessage());
-798             throw new WayfException("Problem displaying WAYF UI", se);
-799         }
-800     }
-801 
-802     /**
-803      * Prior to display we set the display language from the
-804      * browser. There is probably a proper way to do this using
-805      * jsp, but I want to keep the API between JSP and java the same 1.3->2.0
-806      * @param sites - the sites we need to impact
-807      * @param req - from whiuch we get the locale
-808      */
-809     private void setDisplayLanguage(Collection<IdPSite> sites, HttpServletRequest req) {
-810         
-811         if (null == sites) {
-812             return;
-813         }
-814         Locale locale = req.getLocale();
-815         if (null == locale) {
-816             Locale.getDefault();
-817         }
-818         String lang = locale.getLanguage();
-819 
-820         for (IdPSite site : sites) {
-821             site.setDisplayLanguage(lang);
-822         }
-823     }
-824 
-825 
-826     /**
-827      * Uses an HTTP Status 307 redirect to forward the user to the IdP or the SP.
-828      * 
-829      * @param req request under consideration
-830      * @param res response under construction
-831      * @param site The Idp
-832      * @throws WayfException if bad things happen.
-833      */
-834     public static void forwardRequest(HttpServletRequest req, HttpServletResponse res, IdPSite site)
-835                     throws WayfException {
-836 
-837         String shire = getValue(req, SHIRE_PARAM_NAME);
-838         String providerId = getSPId(req);
-839         boolean twoZeroProtocol = (shire == null);
-840 
-841         if (!twoZeroProtocol) {
-842             String handleService = site.getAddressForWAYF(); 
-843             if (handleService != null ) {
-844 
-845                 String target = getValue(req, TARGET_PARAM_NAME);
-846                 if (null == target || 0 == target.length()) {
-847                     throw new WayfException("Could not extract target from provided parameters");
-848                 }
-849 
-850                 LOG.info("Redirecting to selected Handle Service: " + handleService);
-851                 try {
-852                     StringBuffer buffer = new StringBuffer(handleService +  
-853                        "?" + TARGET_PARAM_NAME + "=");
-854                     buffer.append(URLEncoder.encode(target, "UTF-8"));
-855                     buffer.append("&" + SHIRE_PARAM_NAME + "=");
-856                     buffer.append(URLEncoder.encode(shire, "UTF-8"));
-857                     buffer.append("&" + PROVIDERID_PARAM_NAME + "=");
-858                     buffer.append(URLEncoder.encode(providerId, "UTF-8"));
-859                          
-860                     //
-861                     // Time is as per U**X
-862                     //
-863                     buffer.append("&" +  TIME_PARAM_NAME + "=");
-864                     buffer.append(new Long(new Date().getTime() / 1000).toString());
-865                     res.sendRedirect(buffer.toString());
-866                 } catch (IOException ioe) {
-867                     //
-868                     // That failed.  
-869                     //
-870                     throw new WayfException("Error forwarding to IdP: \n" + ioe.getMessage());
-871                 }
-872             } else {
-873                 String s = "Error finding to IdP: " + site.getDisplayName(req); 
-874                 LOG.error(s);
-875                 throw new WayfException(s);
-876             }
-877         } else {
-878             String returnUrl = (String) req.getAttribute(RETURN_ATTRIBUTE_NAME);
-879             
-880             if (null == returnUrl || 0 == returnUrl.length()) {
-881                 throw new WayfException("Could not find return parameter");
-882             }
-883             try {
-884                 returnUrl = URLDecoder.decode(returnUrl, "UTF-8");
-885             } catch (UnsupportedEncodingException e) {
-886                 throw new WayfException("Did not understand parameter ", e);
-887             }
-888             String redirect;
-889             if (site != null) {
-890                 StringBuffer buffer = new StringBuffer(returnUrl);
-891                 //
-892                 // If we were given anybody to lookup, construct the URL
-893                 //
-894                 String returnParam = getValue(req, RETURNID_PARAM_NAME);
-895                 if (null == returnParam || 0 == returnParam.length()) {
-896                     returnParam = RETURNID_DEFAULT_VALUE;
-897                 }              
-898                 //
-899                 // Do we add a '?' or a '&' for the parameters
-900                 //
-901 
-902                 if (returnUrl.indexOf('?') >= 0) {
-903                     //
-904                     // there is a parameter already.  Add a '&'
-905                     //
-906                     buffer.append("&" + returnParam + "=");
-907                 } else {
-908                     //
-909                     // No parameter.  Use ?
-910                     //
-911                     buffer.append("?" + returnParam + "=");
-912                 }
-913                 buffer.append(site.getName());
-914                 redirect =  buffer.toString();
-915             } else {
-916                 //
-917                 // Just send it back
-918                 //
-919                 redirect = returnUrl;
-920             }
-921             
-922             LOG.debug("Dispatching to " + redirect);
-923             
-924             try {
-925                 res.sendRedirect(redirect);
-926             } catch (IOException ioe) {
-927                 //
-928                 // That failed.  
-929                 //
-930                 throw new WayfException("Error forwarding back to Sp: \n" + ioe.getMessage());
-931             }         
-932         }
-933     }
-934 
-935     /**
-936      * Handles all "recoverable" errors in WAYF processing by logging the error and forwarding the user to an
-937      * appropriate error page.
-938      * 
-939      * @param req request under consideration
-940      * @param res response under construction
-941      * @param message - what so say
-942      */
-943     private void handleError(HttpServletRequest req, HttpServletResponse res, String message) {
-944 
-945         LOG.debug("Displaying WAYF error page.");
-946         req.setAttribute("errorText", message);
-947         req.setAttribute("requestURL", req.getRequestURI().toString());
-948         RequestDispatcher rd = req.getRequestDispatcher(config.getErrorJspFile());
-949 
-950         try {
-951             rd.forward(req, res);
-952         } catch (IOException ioe) {
-953             LOG.error("Problem trying to display WAYF error page: " + ioe.toString());
-954         } catch (ServletException se) {
-955             LOG.error("Problem trying to display WAYF error page: " + se.toString());
-956         }
-957     }
-958 
-959     /**
-960      * Gets the value for the parameter either from the parameter or from jsp.
-961      * @param req - the request.
-962      * @param name - the name of the parameter.
-963      * @return - result
-964      */
-965     private static String getValue(HttpServletRequest req, String name) {
-966 
-967         
-968         String value = req.getParameter(name); 
-969         if (value != null) {
-970             return value;
-971         }
-972         return (String) req.getAttribute(name);
-973     }
-974 
-975     private static String getSPId(HttpServletRequest req) throws WayfException {
-976 
-977         //
-978         // Try first with 2.0 version
-979         //
-980         String param = req.getParameter(ENTITYID_PARAM_NAME);
-981         if (param != null && !(param.length() == 0)) {
-982             return param;
-983         } 
-984         
-985         param = (String) req.getAttribute(ENTITYID_PARAM_NAME);
-986         if (param != null && !(param.length() == 0)) {
-987             return param;
-988         }       
-989         //
-990         // So Try with 1.3 version
-991         //
-992         param = req.getParameter(PROVIDERID_PARAM_NAME);
-993         if (param != null && !(param.length() == 0)) {
-994             return param;
-995         } 
-996         
-997         param = (String) req.getAttribute(PROVIDERID_PARAM_NAME);
-998         if (param != null && !(param.length() == 0)) {
-999             return param;
-1000         } 
-1001         throw new WayfException("Could not locate SP identifier in parameters");
-1002     }   
-1003 }
+1   /**
+2    * Copyright [2006] [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  package edu.internet2.middleware.shibboleth.wayf;
+17  
+18  import java.io.IOException;
+19  import java.io.UnsupportedEncodingException;
+20  import java.net.MalformedURLException;
+21  import java.net.URL;
+22  import java.net.URLDecoder;
+23  import java.net.URLEncoder;
+24  import java.util.ArrayList;
+25  import java.util.Collection;
+26  import java.util.Comparator;
+27  import java.util.Date;
+28  import java.util.HashSet;
+29  import java.util.Hashtable;
+30  import java.util.List;
+31  import java.util.Locale;
+32  import java.util.Map;
+33  import java.util.Set;
+34  import java.util.TreeSet;
+35  
+36  import javax.servlet.RequestDispatcher;
+37  import javax.servlet.ServletException;
+38  import javax.servlet.http.HttpServletRequest;
+39  import javax.servlet.http.HttpServletResponse;
+40  
+41  import org.opensaml.saml2.common.Extensions;
+42  import org.opensaml.saml2.metadata.EntityDescriptor;
+43  import org.opensaml.saml2.metadata.RoleDescriptor;
+44  import org.opensaml.saml2.metadata.SPSSODescriptor;
+45  import org.opensaml.samlext.idpdisco.DiscoveryResponse;
+46  import org.opensaml.xml.XMLObject;
+47  import org.slf4j.Logger;
+48  import org.slf4j.LoggerFactory;
+49  import org.w3c.dom.Element;
+50  import org.w3c.dom.NodeList;
+51  
+52  import edu.internet2.middleware.shibboleth.common.ShibbolethConfigurationException;
+53  import edu.internet2.middleware.shibboleth.wayf.plugins.Plugin;
+54  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginContext;
+55  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginMetadataParameter;
+56  import edu.internet2.middleware.shibboleth.wayf.plugins.WayfRequestHandled;
+57  
+58  /**
+59    * Specific handler for each version of the Discovery Service. 
+60    */
+61  public class DiscoveryServiceHandler {
+62  
+63      /*
+64       * Protcol parameters - Old.
+65       */
+66      /**
+67       * Shire is the SP Assertion Consumer endpoint.
+68       */
+69      private static final String SHIRE_PARAM_NAME = "shire";
+70      /**
+71       * TargetName is where we are trying to get to.
+72       */
+73      private static final String TARGET_PARAM_NAME = "target";
+74      /**
+75       * time is to do with replay attack.
+76       */
+77      private static final String TIME_PARAM_NAME = "time";
+78      /**
+79       * This is the ID (in the metadata) of the SP.
+80       */
+81      private static final String PROVIDERID_PARAM_NAME = "providerId";
+82      
+83      /**
+84       * The entityDescriptor for the SP (if present).
+85       */
+86      private static final String PROVIDERID_OBJECT_PARAM_NAME = "providerObject"; 
+87      /*
+88       * Protocol parameters - New
+89       */
+90      /**
+91       * The SP id.
+92       */
+93      private static final String ENTITYID_PARAM_NAME = "entityID";
+94      /**
+95       * Where to send the request back to.
+96       */
+97      private static final String RETURN_PARAM_NAME = "return";
+98      /**
+99       * "return" is an invalid attribute, so we use returnX.
+100      */
+101     private static final String RETURN_ATTRIBUTE_NAME = "returnX";
+102     /**
+103      * Alternatively the index of where to send the address back to.
+104      */
+105     private static final String RETURN_INDEX_NAME = "returnIndex";
+106     
+107     /**
+108      * What value to put the ID of the selected metadata into.
+109      */
+110     private static final String RETURNID_PARAM_NAME = "returnIDParam";
+111     
+112     /**
+113      * What returnIDParam defaults to.
+114      */
+115     private static final String RETURNID_DEFAULT_VALUE = "entityID";
+116     /**
+117      * Whether we are allowed to interact.
+118      */
+119     private static final String ISPASSIVE_PARAM_NAME = "isPassive";
+120     
+121     /**
+122      * Whether we understand this or not.
+123      */
+124     private static final String POLICY_PARAM_NAME = "policy";
+125 
+126     /**
+127      * The only policy we know about.
+128      */
+129     private static final String KNOWN_POLICY_NAME 
+130         = "urn:oasis:names:tc:SAML:profiles:SSO:idp-discoveryprotocol:single";
+131     
+132     /**
+133      * Mandatory Serialization constant.
+134      */
+135     private static final  Logger LOG = LoggerFactory.getLogger(DiscoveryServiceHandler.class.getName());
+136 
+137     /**
+138      * The location defines the last part of the URL which distinguished this handler. 
+139      */
+140     private final String location;
+141     
+142     /**
+143      * If isDefault is true then if there is a mismatch then this handler is used.  
+144      */
+145     private final boolean isDefault;
+146     
+147     /**
+148      * Config handles detailed behavior.
+149      */
+150     private final HandlerConfig config;
+151     
+152     /**
+153      * The list of all the metadata providers that this discovery handler believes in.
+154      */
+155     private final List <IdPSiteSet> siteSets;
+156     
+157     /**
+158      * The list of all the plugins that this hanlder has had configured.
+159      */
+160     private final List <Plugin> plugins;
+161     
+162     /**
+163      * Constructor to create and configure the handler.
+164      * @param config - DOM Element with configuration information.
+165      * @param federations - Supplies all known providers which will be included if so configured.
+166      * @param plugins - Supplies all known plugins which will be included if configured in. 
+167      * @param defaultConfig - The default configurations.
+168      * @throws ShibbolethConfigurationException - if we find something odd in the config file. 
+169      */
+170     protected DiscoveryServiceHandler(Element config, 
+171                                       Hashtable <String, IdPSiteSet> federations,
+172                                       Hashtable <String, Plugin> plugins, 
+173                                       HandlerConfig defaultConfig) throws ShibbolethConfigurationException
+174     {
+175         siteSets = new ArrayList <IdPSiteSet>(federations.size());
+176         this.plugins = new ArrayList <Plugin>(plugins.size());
+177 
+178         //
+179         // Collect the Configuration from the XML
+180         //
+181         
+182         this.config = new HandlerConfig(config, defaultConfig);
+183         
+184         location = config.getAttribute("location");
+185         
+186         if (location == null || location.equals("")) {
+187                 
+188                 LOG.error("DiscoveryService must have a location specified");
+189                 throw new ShibbolethConfigurationException("DiscoveryService must have a location specified");  
+190         }
+191         
+192         //
+193         // Is this the default WAYF?
+194         //
+195         
+196         String attribute = config.getAttribute("default");
+197         if (attribute != null && !attribute.equals("")) {
+198                 isDefault = Boolean.valueOf(attribute).booleanValue();
+199         } else {
+200                 isDefault = false;
+201         }
+202         
+203         //
+204         // Which federations (sitesets) do we care about?
+205         //
+206         
+207         NodeList list = config.getElementsByTagName("Federation");
+208                 
+209         for (int i = 0; i < list.getLength(); i++ ) {
+210                     
+211             attribute = ((Element) list.item(i)).getAttribute("identifier");
+212                     
+213                 IdPSiteSet siteset = federations.get(attribute);
+214                 
+215                 if (siteset == null) {
+216                     LOG.error("Handler " + location + ": could not find metadata for <Federation> with identifier " + attribute + ".");
+217                     throw new ShibbolethConfigurationException(
+218                            "Handler " + location + ": could not find metadata for  <Federation> identifier " + attribute + ".");
+219                 }
+220                 
+221                 siteSets.add(siteset);
+222         }
+223 
+224         if (siteSets.size() == 0) {
+225             //
+226             // No Federations explicitly named pick em all
+227             //
+228             siteSets.addAll(federations.values());
+229         }
+230         
+231         //
+232         // Now, which plugins?
+233         //
+234 
+235         list = config.getElementsByTagName("PluginInstance");
+236         
+237         for (int i = 0; i < list.getLength(); i++ ) {
+238                     
+239             attribute = ((Element) list.item(i)).getAttribute("identifier");
+240                     
+241                 Plugin plugin = plugins.get(attribute);
+242                 
+243                 if (plugin == null) {
+244                     LOG.error("Handler " + location + ": could not find plugin for identifier " + attribute);
+245                     throw new ShibbolethConfigurationException(
+246                               "Handler " + location + ": could not find plugin for identifier " + attribute);
+247                 }
+248                 
+249                 this.plugins.add(plugin);
+250         }
+251 
+252         //
+253         // So now tell every IdPSite about every plugin.
+254         //
+255         // Note that there is only one idpsite per metadatafile per WAYF and that the discovery 
+256         // services share them, so the data explosion is only number(IdpSites) * number(Plugins) not
+257         // number(IdpSites) * number(Plugins) * number(DiscoverHandlers)
+258         
+259         for (IdPSiteSet site: siteSets) {
+260             for (Plugin plugin: this.plugins) {
+261                 site.addPlugin(plugin);
+262             }
+263         }
+264     }
+265     
+266     
+267     //
+268     // Standard Beany Methods
+269     //
+270     /**
+271      * The 'Name' of the service. the path used to identify the ServiceHandler.
+272      * @return the path used to identify the ServiceHandler.
+273      */
+274     
+275     protected String getLocation() {
+276         return location;
+277     }
+278 
+279     /**
+280      * Whether this is the default service.
+281      * @return is it?
+282      */
+283     protected boolean isDefault() {
+284         return isDefault;
+285     }
+286     
+287     //
+288     // Now the bits that deal with the user request
+289     //
+290 
+291     public void doGet(HttpServletRequest req, HttpServletResponse res) {
+292         
+293         String policy = req.getParameter(POLICY_PARAM_NAME);
+294         
+295         if (null != policy && !KNOWN_POLICY_NAME.equals(policy)) {
+296             //
+297             // unknown policy
+298             //
+299             LOG.error("Unknown policy " + policy);
+300             handleError(req, res, "Unknown policy " + policy);
+301             return;
+302         }
+303         
+304         //
+305         // Decide how to route the request based on query string
+306         //
+307         String requestType = req.getParameter("action");
+308         
+309         if (requestType == null || requestType.equals("")) {
+310             requestType = "lookup";
+311         }
+312         
+313         try {
+314 
+315             if (requestType.equals("search")) {
+316                     
+317                 String parameter = req.getParameter("string"); 
+318                 if (parameter != null && parameter.equals("")) {
+319                         parameter = null;
+320                 }
+321                 handleLookup(req, res, parameter);
+322                     
+323             } else if (requestType.equals("selection")) {
+324                     
+325                 handleSelection(req, res);
+326             } else {
+327                 handleLookup(req, res, null);
+328             }
+329         } catch (WayfException we) {
+330             LOG.error("Error processing DS request:", we);
+331             handleError(req, res, we.getLocalizedMessage());
+332         } catch (WayfRequestHandled we) {
+333             //
+334             // Yuck - a sucess path involving an exception
+335             //
+336         }
+337 
+338     }
+339         
+340     /**
+341      * When the WAYF user has selected something we look it up, tell the plugins and then dispatch to the Idp.
+342      *  
+343      * @param req - standard J2EE stuff
+344      * @param res - standard J2EE stuff
+345      * @throws WayfRequestHandled - if one of the plugins has done the dispatch
+346      * @throws WayfException - if we had an errors
+347      */
+348     private void handleSelection(HttpServletRequest req, 
+349                                  HttpServletResponse res) throws WayfRequestHandled, WayfException 
+350      {
+351             
+352         String idpName = req.getParameter("origin");
+353         LOG.debug("Processing handle selection: " + idpName);
+354 
+355         String sPName = getSPId(req);
+356 
+357         if (idpName == null || idpName.equals("")) {
+358             handleLookup(req, res, null);
+359             return;
+360         }
+361 
+362         if (getValue(req, SHIRE_PARAM_NAME) == null) {
+363             //
+364             // 2.0 protocol
+365             //
+366             setupReturnAddress(sPName, req);
+367         }
+368         //
+369         // Notify plugins
+370         //
+371         IdPSite site = null; 
+372         
+373         for (Plugin plugin:plugins) {
+374             for (IdPSiteSet idPSiteSet: siteSets) {
+375                 PluginMetadataParameter param = idPSiteSet.paramFor(plugin);
+376                 plugin.selected(req, res, param, idpName);
+377                 if (site == null && idPSiteSet.containsIdP(idpName)) {
+378                     site = idPSiteSet.getSite(idpName);
+379                 }
+380             }
+381         }
+382         
+383         if (site == null) {
+384             handleLookup(req, res, null);
+385         } else {
+386             forwardRequest(req, res, site);
+387         }
+388     }
+389 
+390 
+391     /**
+392      * This sets up the parameter RETURN_ATTRIBUTE_NAME with the return address 
+393      * harvested from the reqest.
+394      * <ul><le>If a "return" parameter is present we check in the metadata for spoofing 
+395      *         and then set up from there </le>
+396      *     <le>If "returnID" is specified we get this from the metadata</le>
+397      *     <le>If nothing is provided we get the default from the metadata (if provided)</le>
+398      *     <le>Otherwise we whine</le>
+399      * </ul>     
+400      * @param spName - the name of the Service provider.
+401      * @param req - The request.
+402      * @throws WayfException - if we spot spoofing or there is no defaumlt 
+403      */
+404     private void setupReturnAddress(String spName, HttpServletRequest req) throws WayfException{
+405         
+406         DiscoveryResponse[] discoveryServices;
+407         Set<XMLObject> objects = new HashSet<XMLObject>();
+408         String defaultName = null;
+409         boolean foundSPName = false;
+410         
+411         for (IdPSiteSet metadataProvider:siteSets) {
+412             
+413             //
+414             // Only do work if the SP makes sense
+415             //
+416 
+417             if (metadataProvider.containsSP(spName)) {
+418                
+419                 //
+420                 // The name makes sense so let's get the entity and from that
+421                 // all of its roles
+422                 //
+423                 foundSPName = true;
+424                 EntityDescriptor entity = metadataProvider.getEntity(spName);
+425                 List<RoleDescriptor> roles = entity.getRoleDescriptors();
+426                 
+427                 for (RoleDescriptor role:roles) {
+428                     
+429                     //
+430                     // Check every role
+431                     //
+432                     
+433                     if (role instanceof SPSSODescriptor) {
+434                         
+435                         //
+436                         // And grab hold of all the extensions for SPSSO descriptors
+437                         //
+438                         
+439                         Extensions exts = role.getExtensions();
+440                         if (exts != null) {
+441                             objects.addAll(exts.getOrderedChildren());
+442                         }
+443                     }
+444                 }
+445             }
+446         }
+447         if (!foundSPName) {
+448             LOG.error("Could not locate SP " + spName + " in metadata");
+449         }
+450         
+451         //
+452         // Now, let's strip out everything which isn't a DiscoveryService
+453         //
+454         
+455         discoveryServices = new DiscoveryResponse[objects.size()];
+456         int dsCount = 0;
+457         
+458         for (XMLObject obj:objects) {
+459             if (obj instanceof DiscoveryResponse) {
+460                 DiscoveryResponse ds = (DiscoveryResponse) obj;
+461                 discoveryServices[dsCount++] = ds;
+462                 if (ds.isDefault() || null == defaultName) {
+463                     defaultName = ds.getLocation();
+464                 }
+465             }
+466         }
+467         
+468         //
+469         // Now process the return parameters.  The name is either a parameter
+470         // called RETURN_PARAM_NAME or an attributes called RETURN_ATTRIBUTE_NAME
+471         //
+472         String returnName = req.getParameter(RETURN_PARAM_NAME);
+473         
+474         if (returnName == null || returnName.length() == 0) {
+475             returnName = getValue(req, RETURN_ATTRIBUTE_NAME);
+476         }
+477         
+478         //
+479         // Return index is only ever a parameter
+480         //
+481         
+482         String returnIndex = req.getParameter(RETURN_INDEX_NAME);
+483         
+484         if (returnName != null && returnName.length() != 0) {
+485             //
+486             // Given something so we have to police it.
+487             //
+488             String nameNoParam = returnName;
+489             URL providedReturnURL;
+490             int index = nameNoParam.indexOf('?');
+491             boolean found = false;
+492             
+493             if (index >= 0) {
+494                 nameNoParam = nameNoParam.substring(0,index);
+495             }
+496             
+497             try {
+498                 providedReturnURL = new URL(nameNoParam);                
+499             } catch (MalformedURLException e) {
+500                 throw new WayfException("Couldn't parse provided return name " + nameNoParam, e);
+501             }
+502             
+503             
+504             for (DiscoveryResponse disc: discoveryServices) {
+505                 if (equalsURL(disc, providedReturnURL)) {
+506                     found = true;
+507                     break;
+508                 }
+509             }
+510             if (!found) {
+511                 throw new WayfException("Couldn't find endpoint " + nameNoParam + " in metadata");
+512             }
+513         } else if (returnIndex != null && returnIndex.length() != 0) {
+514             
+515             int index; 
+516             try {
+517                 index = Integer.parseInt(returnIndex);
+518             } catch (NumberFormatException e) {
+519                 throw new WayfException("Couldn't convert " + returnIndex + " into an index");
+520             }
+521             //
+522             // So look through to find the endpoint with the correct index
+523             //
+524             boolean found = false;
+525             
+526             for (DiscoveryResponse disc: discoveryServices) {
+527                 if (index  == disc.getIndex()) {
+528                     found = true;
+529                     returnName = disc.getLocation();
+530                     break;
+531                 }
+532             }
+533             if (!found) {
+534                 throw new WayfException("Couldn't not find endpoint " + returnIndex + "in metadata");
+535             }
+536         } else {
+537             //
+538             // No name, not index, so we want the default
+539             //
+540             returnName = defaultName;
+541         }
+542         //
+543         // So by now returnName has the correct value, either harvested from or
+544         // policed against the metadata
+545         //
+546         req.setAttribute(RETURN_ATTRIBUTE_NAME, returnName);
+547     }
+548 
+549     /**
+550      * Helper function to see whather the provided endpoint in the metadata matches the 
+551      * provided return URL in the request.
+552      * 
+553      * @param discovery
+554      * @param providedName
+555      * @return
+556      */
+557     private static boolean equalsURL(DiscoveryResponse discovery, URL providedName) {
+558         
+559         //
+560         // Nothing provided - no match
+561         //
+562         if (null == discovery) {
+563             return false;
+564         }
+565         
+566         URL discoveryName;
+567         try {
+568             discoveryName = new URL(discovery.getLocation());
+569         } catch (MalformedURLException e) {
+570             //
+571             // Something bad happened.  Log it (it is only of interest to the sysadmin, not to the user)
+572             //
+573             LOG.warn("Found invalid discovery end point : " + discovery.getLocation(), e);
+574             return false;
+575         }
+576         
+577         return providedName.equals(discoveryName);
+578         
+579     }
+580 
+581     /**
+582      * Displays a Discovery Service selection page, having first consulted the plugins as needed.
+583      * @param req Describes the request
+584      * @param res Describes the response
+585      * @param searchName What are we looking for?
+586      * 
+587      * @throws WayfRequestHandled if a plugin has dealt with the request
+588      * @throws WayfException in case of an error.
+589      */
+590     private void handleLookup(HttpServletRequest req, 
+591                               HttpServletResponse res, 
+592                               String searchName) throws WayfException, WayfRequestHandled {
+593         
+594         String shire = getValue(req, SHIRE_PARAM_NAME);
+595         String providerId = getSPId(req);
+596         EntityDescriptor sp = null;
+597         boolean twoZeroProtocol = (shire == null);
+598         boolean isPassive = (twoZeroProtocol && 
+599                              "true".equalsIgnoreCase(getValue(req, ISPASSIVE_PARAM_NAME)));
+600 
+601         Collection <IdPSiteSetEntry> siteLists = null;
+602         Collection<IdPSite> searchResults = null;
+603         
+604         if (config.getProvideListOfLists()) {
+605             siteLists = new ArrayList <IdPSiteSetEntry>(siteSets.size());
+606         }
+607 
+608         Collection <IdPSite> sites = null;
+609         Comparator<IdPSite> comparator = new IdPSite.Compare(req);
+610        
+611         if (config.getProvideList()) {
+612             sites = new TreeSet<IdPSite>(comparator);
+613         }
+614 
+615         if (searchName != null && !searchName.equals("")) {
+616             searchResults = new TreeSet<IdPSite>(comparator);
+617         }
+618 
+619         LOG.debug("Processing Idp Lookup for : " + providerId);
+620 
+621         //
+622         // Iterate over all the sitesets and if they know about the SP pass them to the plugins
+623         // and then add them too the list
+624         //
+625 
+626         PluginContext[] ctx = new PluginContext[plugins.size()];
+627         List<IdPSite> hintList = new ArrayList<IdPSite>();
+628         
+629         if (twoZeroProtocol) {
+630             setupReturnAddress(providerId, req);
+631         }
+632         //
+633         // By having siteLists and sites as parameters we only iterate over 
+634         // the metadata arrays once.
+635         //
+636         try {   
+637             for (IdPSiteSet metadataProvider:siteSets) {
+638                 
+639                 //
+640                 // Only do work if the SP makes sense
+641                 //
+642 
+643                 if (metadataProvider.containsSP(providerId) || !config.getLookupSp()) {
+644 
+645                     Collection <IdPSite> search = null;
+646 
+647                     if (null == sp) {
+648                         sp = metadataProvider.getEntity(providerId);
+649                     }
+650                     
+651                     if (searchResults != null) {
+652                         search = new TreeSet<IdPSite>(comparator);
+653                     }
+654 
+655                     Map <String, IdPSite> theseSites = metadataProvider.getIdPSites(searchName, config, search);
+656                     
+657                     //
+658                     // Consult the plugins
+659                     //
+660                     for (int i = 0; i < plugins.size(); i++) {
+661                             
+662                         Plugin plugin = plugins.get(i);
+663                         
+664                         if (searchResults == null) {
+665                             //
+666                             // This was a search
+667                             //
+668                             ctx[i] = plugin.lookup(req, 
+669                                                    res, 
+670                                                    metadataProvider.paramFor(plugin), 
+671                                                    theseSites, 
+672                                                    ctx[i], 
+673                                                    hintList);
+674                         } else {
+675                             ctx[i] = plugin.search(req, 
+676                                                    res, 
+677                                                    metadataProvider.paramFor(plugin), 
+678                                                    searchName, 
+679                                                    theseSites, 
+680                                                    ctx[i], 
+681                                                    searchResults, 
+682                                                    hintList);
+683                         }
+684                     }
+685                     
+686                     if (null == theseSites || theseSites.isEmpty()) {
+687                         continue;
+688                     }
+689                     
+690                     //
+691                         
+692                     // Accumulate any per-metadata provider information
+693                     // 
+694             
+695                     Collection<IdPSite> values = new TreeSet<IdPSite>(comparator);
+696                     if (null != theseSites) {
+697                         values.addAll(theseSites.values());
+698                     }
+699                     
+700                     if (siteLists != null) {
+701                         siteLists.add(new IdPSiteSetEntry(metadataProvider,values));
+702                     }
+703                             
+704                     if (sites != null) {
+705                         sites.addAll(values);
+706                     }
+707                     
+708                     if (searchResults != null) {
+709                         searchResults.addAll(search);
+710                     }
+711                 }
+712             }
+713             
+714             if (isPassive) {
+715                 //
+716                 // No GUI intervention.
+717                 //
+718                 if (0 != hintList.size()) {
+719                     //
+720                     // We found a candidate, hand it back
+721                     //
+722                     forwardRequest(req, res, hintList.get(0));
+723                 } else {
+724                     forwardRequest(req, res, null);
+725                 }   
+726                 return;
+727             }
+728             
+729             //
+730             // Now set up all the funky stuff that the JSP needs.  Firstly the protocol
+731             // specific parameters which will come back to us
+732             //
+733             
+734             if (twoZeroProtocol) {
+735                 //
+736                 // The return address was set up in setupReturnAddress
+737                 //
+738                 String returnString = (String) req.getAttribute(RETURN_ATTRIBUTE_NAME);
+739                 if (null == returnString || 0 == returnString.length()) {
+740                     throw new WayfException("Parameter " + RETURN_PARAM_NAME + " not supplied");
+741                 }
+742 
+743                 String returnId = getValue(req, RETURNID_PARAM_NAME);
+744                 if (null == returnId || 0 == returnId.length()) {
+745                     returnId = RETURNID_DEFAULT_VALUE;
+746                 }
+747                 //
+748                 // Return *means* something so we cannot use it as an attribute
+749                 //
+750                 req.setAttribute(RETURN_ATTRIBUTE_NAME, returnString);
+751                 req.setAttribute(RETURNID_PARAM_NAME, returnId);
+752                 req.setAttribute(ENTITYID_PARAM_NAME, providerId);
+753                 
+754             } else {
+755                 String target = getValue(req, TARGET_PARAM_NAME);
+756                 if (null == target || 0 == target.length()) {
+757                     throw new WayfException("Could not extract target from provided parameters");
+758                 }
+759                 req.setAttribute(SHIRE_PARAM_NAME, shire);
+760                 req.setAttribute(TARGET_PARAM_NAME, target);
+761                 req.setAttribute(PROVIDERID_PARAM_NAME, providerId);
+762                 //
+763                 // Time is in unix format
+764                 //
+765                 req.setAttribute("time", new Long(new Date().getTime() / 1000).toString()); 
+766                 
+767             }
+768             
+769             //
+770             // Setup the stuff that the GUI wants.  
+771             //
+772             setDisplayLanguage(sites, req);
+773             req.setAttribute("sites", sites);
+774             if (null != siteLists) {
+775                 for (IdPSiteSetEntry siteSetEntry:siteLists) {
+776                     setDisplayLanguage(siteSetEntry.getSites(), req);
+777                 }
+778             }
+779             
+780             req.setAttribute(PROVIDERID_OBJECT_PARAM_NAME, sp);
+781                 
+782             req.setAttribute("siteLists", siteLists);
+783             req.setAttribute("requestURL", req.getRequestURI().toString());
+784 
+785             if (searchResults != null) {
+786                 if (searchResults.size() != 0) {
+787                     setDisplayLanguage(searchResults, req);
+788                     req.setAttribute("searchresults", searchResults);
+789                 } else {
+790                     req.setAttribute("searchResultsEmpty", "true");
+791                 }
+792             }
+793 
+794             if (hintList.size() > 0) {
+795                 setDisplayLanguage(hintList, req);
+796                 req.setAttribute("cookieList", hintList);
+797             }
+798 
+799             LOG.debug("Displaying WAYF selection page.");
+800             RequestDispatcher rd = req.getRequestDispatcher(config.getJspFile());
+801 
+802             //
+803             // And off to the jsp
+804             //
+805             rd.forward(req, res);
+806         } catch (IOException ioe) {
+807             LOG.error("Problem displaying WAYF UI.\n" +  ioe.getMessage());
+808             throw new WayfException("Problem displaying WAYF UI", ioe);
+809         } catch (ServletException se) {
+810             LOG.error("Problem displaying WAYF UI.\n" +  se.getMessage());
+811             throw new WayfException("Problem displaying WAYF UI", se);
+812         }
+813     }
+814 
+815     /**
+816      * Prior to display we set the display language from the
+817      * browser. There is probably a proper way to do this using
+818      * jsp, but I want to keep the API between JSP and java the same 1.3->2.0
+819      * @param sites - the sites we need to impact
+820      * @param req - from whiuch we get the locale
+821      */
+822     private void setDisplayLanguage(Collection<IdPSite> sites, HttpServletRequest req) {
+823         
+824         if (null == sites) {
+825             return;
+826         }
+827         Locale locale = req.getLocale();
+828         if (null == locale) {
+829             Locale.getDefault();
+830         }
+831         String lang = locale.getLanguage();
+832 
+833         for (IdPSite site : sites) {
+834             site.setDisplayLanguage(lang);
+835         }
+836     }
+837 
+838 
+839     /**
+840      * Uses an HTTP Status 307 redirect to forward the user to the IdP or the SP.
+841      * 
+842      * @param req request under consideration
+843      * @param res response under construction
+844      * @param site The Idp
+845      * @throws WayfException if bad things happen.
+846      */
+847     public static void forwardRequest(HttpServletRequest req, HttpServletResponse res, IdPSite site)
+848                     throws WayfException {
+849 
+850         String shire = getValue(req, SHIRE_PARAM_NAME);
+851         String providerId = getSPId(req);
+852         boolean twoZeroProtocol = (shire == null);
+853 
+854         if (!twoZeroProtocol) {
+855             String handleService = site.getAddressForWAYF(); 
+856             if (handleService != null ) {
+857 
+858                 String target = getValue(req, TARGET_PARAM_NAME);
+859                 if (null == target || 0 == target.length()) {
+860                     throw new WayfException("Could not extract target from provided parameters");
+861                 }
+862 
+863                 LOG.info("Redirecting to selected Handle Service: " + handleService);
+864                 try {
+865                     StringBuffer buffer = new StringBuffer(handleService +  
+866                        "?" + TARGET_PARAM_NAME + "=");
+867                     buffer.append(URLEncoder.encode(target, "UTF-8"));
+868                     buffer.append("&" + SHIRE_PARAM_NAME + "=");
+869                     buffer.append(URLEncoder.encode(shire, "UTF-8"));
+870                     buffer.append("&" + PROVIDERID_PARAM_NAME + "=");
+871                     buffer.append(URLEncoder.encode(providerId, "UTF-8"));
+872                          
+873                     //
+874                     // Time is as per U**X
+875                     //
+876                     buffer.append("&" +  TIME_PARAM_NAME + "=");
+877                     buffer.append(new Long(new Date().getTime() / 1000).toString());
+878                     res.sendRedirect(buffer.toString());
+879                 } catch (IOException ioe) {
+880                     //
+881                     // That failed.  
+882                     //
+883                     throw new WayfException("Error forwarding to IdP: \n" + ioe.getMessage());
+884                 }
+885             } else {
+886                 String s = "Error finding to IdP: " + site.getDisplayName(req); 
+887                 LOG.error(s);
+888                 throw new WayfException(s);
+889             }
+890         } else {
+891             String returnUrl = (String) req.getAttribute(RETURN_ATTRIBUTE_NAME);
+892             
+893             if (null == returnUrl || 0 == returnUrl.length()) {
+894                 throw new WayfException("Could not find return parameter");
+895             }
+896             try {
+897                 returnUrl = URLDecoder.decode(returnUrl, "UTF-8");
+898             } catch (UnsupportedEncodingException e) {
+899                 throw new WayfException("Did not understand parameter ", e);
+900             }
+901             String redirect;
+902             if (site != null) {
+903                 StringBuffer buffer = new StringBuffer(returnUrl);
+904                 //
+905                 // If we were given anybody to lookup, construct the URL
+906                 //
+907                 String returnParam = getValue(req, RETURNID_PARAM_NAME);
+908                 if (null == returnParam || 0 == returnParam.length()) {
+909                     returnParam = RETURNID_DEFAULT_VALUE;
+910                 }              
+911                 //
+912                 // Do we add a '?' or a '&' for the parameters
+913                 //
+914 
+915                 if (returnUrl.indexOf('?') >= 0) {
+916                     //
+917                     // there is a parameter already.  Add a '&'
+918                     //
+919                     buffer.append("&" + returnParam + "=");
+920                 } else {
+921                     //
+922                     // No parameter.  Use ?
+923                     //
+924                     buffer.append("?" + returnParam + "=");
+925                 }
+926                 buffer.append(site.getName());
+927                 redirect =  buffer.toString();
+928             } else {
+929                 //
+930                 // Just send it back
+931                 //
+932                 redirect = returnUrl;
+933             }
+934             
+935             LOG.debug("Dispatching to " + redirect);
+936             
+937             try {
+938                 res.sendRedirect(redirect);
+939             } catch (IOException ioe) {
+940                 //
+941                 // That failed.  
+942                 //
+943                 throw new WayfException("Error forwarding back to Sp: \n" + ioe.getMessage());
+944             }         
+945         }
+946     }
+947 
+948     /**
+949      * Handles all "recoverable" errors in WAYF processing by logging the error and forwarding the user to an
+950      * appropriate error page.
+951      * 
+952      * @param req request under consideration
+953      * @param res response under construction
+954      * @param message - what so say
+955      */
+956     private void handleError(HttpServletRequest req, HttpServletResponse res, String message) {
+957 
+958         LOG.debug("Displaying WAYF error page.");
+959         req.setAttribute("errorText", message);
+960         req.setAttribute("requestURL", req.getRequestURI().toString());
+961         RequestDispatcher rd = req.getRequestDispatcher(config.getErrorJspFile());
+962 
+963         try {
+964             rd.forward(req, res);
+965         } catch (IOException ioe) {
+966             LOG.error("Problem trying to display WAYF error page: " + ioe.toString());
+967         } catch (ServletException se) {
+968             LOG.error("Problem trying to display WAYF error page: " + se.toString());
+969         }
+970     }
+971 
+972     /**
+973      * Gets the value for the parameter either from the parameter or from jsp.
+974      * @param req - the request.
+975      * @param name - the name of the parameter.
+976      * @return - result
+977      */
+978     private static String getValue(HttpServletRequest req, String name) {
+979 
+980         
+981         String value = req.getParameter(name); 
+982         if (value != null) {
+983             return value;
+984         }
+985         return (String) req.getAttribute(name);
+986     }
+987 
+988     private static String getSPId(HttpServletRequest req) throws WayfException {
+989 
+990         //
+991         // Try first with 2.0 version
+992         //
+993         String param = req.getParameter(ENTITYID_PARAM_NAME);
+994         if (param != null && !(param.length() == 0)) {
+995             return param;
+996         } 
+997         
+998         param = (String) req.getAttribute(ENTITYID_PARAM_NAME);
+999         if (param != null && !(param.length() == 0)) {
+1000             return param;
+1001         }       
+1002         //
+1003         // So Try with 1.3 version
+1004         //
+1005         param = req.getParameter(PROVIDERID_PARAM_NAME);
+1006         if (param != null && !(param.length() == 0)) {
+1007             return param;
+1008         } 
+1009         
+1010         param = (String) req.getAttribute(PROVIDERID_PARAM_NAME);
+1011         if (param != null && !(param.length() == 0)) {
+1012             return param;
+1013         } 
+1014         throw new WayfException("Could not locate SP identifier in parameters");
+1015     }   
+1016 }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/HandlerConfig.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/HandlerConfig.html index 3e688b3..109977b 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/HandlerConfig.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/HandlerConfig.html @@ -1,235 +1,235 @@ - + HandlerConfig xref
View Javadoc
 
-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.wayf;
-18  
-19  import java.util.HashSet;
-20  
-21  import org.slf4j.Logger;
-22  import org.slf4j.LoggerFactory;
-23  import org.w3c.dom.Element;
-24  import org.w3c.dom.NodeList;
-25  
-26  import edu.internet2.middleware.shibboleth.common.ShibbolethConfigurationException;
-27  
-28  /**
-29   * Class used by the DiscoveryServiceHandler to handle run time behaviour. 
-30   */
-31  
-32  public class HandlerConfig {
-33  
-34      /**
-35       * How to get debug output out.
-36       */
-37      private static final Logger LOG = LoggerFactory.getLogger(HandlerConfig.class.getName());
-38      
-39      /** A set of names which are ignored when doing a search. */
-40      private final HashSet <String> ignoredForMatch;
-41          
-42      /** Where to find the GUI description jsp file. */
-43      private final String jspFile;
-44      
-45      /** Where to find the error jsp file. */
-46      private final String errorJspFile;
-47          
-48      /** Do we give the jsp file an array of arrays of IdPs? */
-49      private final boolean provideListOfLists;
-50          
-51      /** Do we give the jsp file a flat list of IdPs? */
-52      private final boolean provideList;
-53      
-54      /** Do we do a pre-filter by SP name in for each metadata provider. */
-55      private final boolean lookupSp; 
-56      
-57      /** Do we warn on the bad binding. */
-58      private final boolean warnOnBadBinding;
-59   
-60      /** Build the 'default default' configuation. */ 
-61      public HandlerConfig() {
-62          //
-63          // 'Sensible' default values
-64          //
-65          jspFile = "/wayf.jsp";
-66          errorJspFile = "/wayfError.jsp";
-67          provideList = true;
-68          provideListOfLists = false;
-69          lookupSp = true;
-70          ignoredForMatch = new HashSet <String>(); 
-71          warnOnBadBinding = false;
-72      }
-73          
-74          
-75      /**
-76       * 
-77       * Parse the Supplied XML element into a new WayfConfig Object.
-78       * @param config - The XML with the configuration info.
-79       * @param defaultValue - The default if nothing is specified.
-80       * @throws ShibbolethConfigurationException - if we see somethin wrong.
-81       */
-82      public HandlerConfig(Element config, HandlerConfig defaultValue) throws ShibbolethConfigurationException {
-83          
-84          String attribute;   
-85          LOG.debug("Loading global configuration properties.");
-86  
-87          NodeList list = config.getElementsByTagName("SearchIgnore");
-88          
-89          if (list.getLength() == 0) {
-90              
-91              ignoredForMatch = defaultValue.ignoredForMatch;
-92  
-93          } else { 
-94              
-95              ignoredForMatch = new HashSet<String>();        
-96                  
-97              for (int i = 0; i < list.getLength(); i++ ) {
-98                      
-99                      NodeList inner = ((Element) list.item(i)).getElementsByTagName("IgnoreText");
-100                     
-101                     for(int j = 0; j < inner.getLength(); j++) {
-102                             
-103                             addIgnoredForMatch(inner.item(j).getTextContent());
-104                     }
-105                 }
-106         }
-107 
-108         attribute = config.getAttribute("jspFile");
-109         if (attribute != null && !attribute.equals("")) {
-110                 jspFile = attribute;
-111         } else {
-112                 jspFile = defaultValue.jspFile;
-113         }
-114         
-115         attribute = config.getAttribute("errorJspFile");
-116         if (attribute != null && !attribute.equals("")) {
-117                 errorJspFile = attribute;
-118         } else {
-119                 errorJspFile = defaultValue.errorJspFile;
-120         }
-121         
-122         attribute = config.getAttribute("provideList");
-123         if (attribute != null && !attribute.equals("")) {
-124                 provideList = Boolean.valueOf(attribute).booleanValue();
-125         } else { 
-126                 provideList = defaultValue.provideList;
-127         }
-128 
-129         attribute = config.getAttribute("provideListOfList");
-130         if (attribute != null && !attribute.equals("")) {
-131                 provideListOfLists = Boolean.valueOf(attribute).booleanValue();
-132         } else {
-133                 provideListOfLists = defaultValue.provideListOfLists;
-134         }
-135         
-136         attribute = config.getAttribute("showUnusableIdPs");
-137         if (attribute != null && !attribute.equals("")) {
-138                 lookupSp = !Boolean.valueOf(attribute).booleanValue();
-139         } else {
-140                 lookupSp = defaultValue.lookupSp;
-141         }
-142         
-143         attribute = config.getAttribute("warnOnBadBinding");
-144         if (null != attribute && !attribute.equals("")) {
-145                 warnOnBadBinding = Boolean.valueOf(attribute).booleanValue();
-146         } else {
-147             warnOnBadBinding = false;
-148         }
-149     }
-150     
-151 
-152     /**
-153      * Determines if a particular string token should be used for matching when a user searches for origins.
-154      * 
-155      * @param str - The string to lookup.
-156      * @return whether it is or not.
-157      */
-158     public boolean isIgnoredForMatch(String str) {
-159 
-160         return ignoredForMatch.contains(str.toLowerCase());
-161     }
-162 
-163     /**
-164      * Sets the tokens that should be ignored when a user searches for an origin site.
-165      * 
-166      * @param s
-167      *            The ignored tokens are passed as a single string, each separated by whitespace
-168      */
-169     private void addIgnoredForMatch(String s) {
-170 
-171             ignoredForMatch.add(s.toLowerCase());
-172     }
-173 
-174     /**
-175      * Get the name of the jsp File this instance uses.
-176      * @return the name.
-177      */
-178     public String getJspFile() {
-179             return jspFile;
-180     }
-181     
-182     /**
-183      * Get the name of the error jsp File this instance uses.
-184      * @return the name.
-185      */
-186     public String getErrorJspFile() {
-187             return errorJspFile;
-188     }
-189     
-190     /**
-191      * Do we provide a list of lists of IdPs?.
-192      * @return whether we do or not.
-193      */
-194     public boolean getProvideListOfLists() {
-195             return provideListOfLists;
-196     }
-197     
-198     /**
-199      * Do we provide a list of IdPs?.
-200      * @return whether we provide a list of IdPs?.
-201      */
-202     public boolean getProvideList() {
-203         return provideList;
-204     }
-205     
-206     /**
-207      * Do we lookup the SP or just return all the IdPs?.
-208      * @return whether or not we lookup the SP
-209      */
-210     public boolean getLookupSp() {  
-211         return lookupSp;  
-212     }
-213     
-214     /**
-215      * Do ignore badly formed bindings or just warn
-216      * @return whether we warn.
-217      */
-218     public boolean getWarnOnBadBinding() {  
-219         return warnOnBadBinding;  
-220     }
-221     
-222 }
+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.wayf;
+18  
+19  import java.util.HashSet;
+20  
+21  import org.slf4j.Logger;
+22  import org.slf4j.LoggerFactory;
+23  import org.w3c.dom.Element;
+24  import org.w3c.dom.NodeList;
+25  
+26  import edu.internet2.middleware.shibboleth.common.ShibbolethConfigurationException;
+27  
+28  /**
+29   * Class used by the DiscoveryServiceHandler to handle run time behaviour. 
+30   */
+31  
+32  public class HandlerConfig {
+33  
+34      /**
+35       * How to get debug output out.
+36       */
+37      private static final Logger LOG = LoggerFactory.getLogger(HandlerConfig.class.getName());
+38      
+39      /** A set of names which are ignored when doing a search. */
+40      private final HashSet <String> ignoredForMatch;
+41          
+42      /** Where to find the GUI description jsp file. */
+43      private final String jspFile;
+44      
+45      /** Where to find the error jsp file. */
+46      private final String errorJspFile;
+47          
+48      /** Do we give the jsp file an array of arrays of IdPs? */
+49      private final boolean provideListOfLists;
+50          
+51      /** Do we give the jsp file a flat list of IdPs? */
+52      private final boolean provideList;
+53      
+54      /** Do we do a pre-filter by SP name in for each metadata provider. */
+55      private final boolean lookupSp; 
+56      
+57      /** Do we warn on the bad binding. */
+58      private final boolean warnOnBadBinding;
+59   
+60      /** Build the 'default default' configuation. */ 
+61      public HandlerConfig() {
+62          //
+63          // 'Sensible' default values
+64          //
+65          jspFile = "/wayf.jsp";
+66          errorJspFile = "/wayfError.jsp";
+67          provideList = true;
+68          provideListOfLists = false;
+69          lookupSp = true;
+70          ignoredForMatch = new HashSet <String>(); 
+71          warnOnBadBinding = false;
+72      }
+73          
+74          
+75      /**
+76       * 
+77       * Parse the Supplied XML element into a new WayfConfig Object.
+78       * @param config - The XML with the configuration info.
+79       * @param defaultValue - The default if nothing is specified.
+80       * @throws ShibbolethConfigurationException - if we see somethin wrong.
+81       */
+82      public HandlerConfig(Element config, HandlerConfig defaultValue) throws ShibbolethConfigurationException {
+83          
+84          String attribute;   
+85          LOG.debug("Loading global configuration properties.");
+86  
+87          NodeList list = config.getElementsByTagName("SearchIgnore");
+88          
+89          if (list.getLength() == 0) {
+90              
+91              ignoredForMatch = defaultValue.ignoredForMatch;
+92  
+93          } else { 
+94              
+95              ignoredForMatch = new HashSet<String>();        
+96                  
+97              for (int i = 0; i < list.getLength(); i++ ) {
+98                      
+99                      NodeList inner = ((Element) list.item(i)).getElementsByTagName("IgnoreText");
+100                     
+101                     for(int j = 0; j < inner.getLength(); j++) {
+102                             
+103                             addIgnoredForMatch(inner.item(j).getTextContent());
+104                     }
+105                 }
+106         }
+107 
+108         attribute = config.getAttribute("jspFile");
+109         if (attribute != null && !attribute.equals("")) {
+110                 jspFile = attribute;
+111         } else {
+112                 jspFile = defaultValue.jspFile;
+113         }
+114         
+115         attribute = config.getAttribute("errorJspFile");
+116         if (attribute != null && !attribute.equals("")) {
+117                 errorJspFile = attribute;
+118         } else {
+119                 errorJspFile = defaultValue.errorJspFile;
+120         }
+121         
+122         attribute = config.getAttribute("provideList");
+123         if (attribute != null && !attribute.equals("")) {
+124                 provideList = Boolean.valueOf(attribute).booleanValue();
+125         } else { 
+126                 provideList = defaultValue.provideList;
+127         }
+128 
+129         attribute = config.getAttribute("provideListOfList");
+130         if (attribute != null && !attribute.equals("")) {
+131                 provideListOfLists = Boolean.valueOf(attribute).booleanValue();
+132         } else {
+133                 provideListOfLists = defaultValue.provideListOfLists;
+134         }
+135         
+136         attribute = config.getAttribute("showUnusableIdPs");
+137         if (attribute != null && !attribute.equals("")) {
+138                 lookupSp = !Boolean.valueOf(attribute).booleanValue();
+139         } else {
+140                 lookupSp = defaultValue.lookupSp;
+141         }
+142         
+143         attribute = config.getAttribute("warnOnBadBinding");
+144         if (null != attribute && !attribute.equals("")) {
+145                 warnOnBadBinding = Boolean.valueOf(attribute).booleanValue();
+146         } else {
+147             warnOnBadBinding = false;
+148         }
+149     }
+150     
+151 
+152     /**
+153      * Determines if a particular string token should be used for matching when a user searches for origins.
+154      * 
+155      * @param str - The string to lookup.
+156      * @return whether it is or not.
+157      */
+158     public boolean isIgnoredForMatch(String str) {
+159 
+160         return ignoredForMatch.contains(str.toLowerCase());
+161     }
+162 
+163     /**
+164      * Sets the tokens that should be ignored when a user searches for an origin site.
+165      * 
+166      * @param s
+167      *            The ignored tokens are passed as a single string, each separated by whitespace
+168      */
+169     private void addIgnoredForMatch(String s) {
+170 
+171             ignoredForMatch.add(s.toLowerCase());
+172     }
+173 
+174     /**
+175      * Get the name of the jsp File this instance uses.
+176      * @return the name.
+177      */
+178     public String getJspFile() {
+179             return jspFile;
+180     }
+181     
+182     /**
+183      * Get the name of the error jsp File this instance uses.
+184      * @return the name.
+185      */
+186     public String getErrorJspFile() {
+187             return errorJspFile;
+188     }
+189     
+190     /**
+191      * Do we provide a list of lists of IdPs?.
+192      * @return whether we do or not.
+193      */
+194     public boolean getProvideListOfLists() {
+195             return provideListOfLists;
+196     }
+197     
+198     /**
+199      * Do we provide a list of IdPs?.
+200      * @return whether we provide a list of IdPs?.
+201      */
+202     public boolean getProvideList() {
+203         return provideList;
+204     }
+205     
+206     /**
+207      * Do we lookup the SP or just return all the IdPs?.
+208      * @return whether or not we lookup the SP
+209      */
+210     public boolean getLookupSp() {  
+211         return lookupSp;  
+212     }
+213     
+214     /**
+215      * Do ignore badly formed bindings or just warn
+216      * @return whether we warn.
+217      */
+218     public boolean getWarnOnBadBinding() {  
+219         return warnOnBadBinding;  
+220     }
+221     
+222 }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSite.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSite.html index a139c6d..5457cfd 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSite.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSite.html @@ -1,230 +1,249 @@ - + IdPSite xref
View Javadoc
 
-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.wayf;
-18  
-19  import java.util.Comparator;
-20  import java.util.List;
-21  import java.util.Locale;
-22  
-23  import javax.servlet.http.HttpServletRequest;
-24  
-25  import org.opensaml.saml2.metadata.EntityDescriptor;
-26  import org.opensaml.saml2.metadata.Organization;
-27  import org.opensaml.saml2.metadata.OrganizationDisplayName;
-28  import org.opensaml.saml2.metadata.SingleSignOnService;
-29  
-30  /**
-31   * A class which abstracts an IdP for the sake of the WAYF display.  Given an {@link EntityDescriptor} as
-32   * input it provides bean style get functions for the name (EntityId), the display name 
-33   * (a hybrid of Organization name or EntityId and the IdP's SSO connection point.
-34   * 
-35   */
-36  public class IdPSite {
-37  
-38      /** The OpenSaml element that this stands for. */
-39      private EntityDescriptor entity;
-40      
-41      /** The language we set up */
-42      private String displayLanguage;
-43      
-44      /**
-45       * Create a new element from the provided Entity.
-46       * @param entityParam - What to create from
-47       */
-48      public IdPSite(EntityDescriptor entityParam) {
-49          entity = entityParam;
-50      }
-51      
-52      /**
-53       * Get the name for the enclosed entity. 
-54       * @return the name for the enclosed entity.
-55       */
-56      public String getName() {
-57              return entity.getEntityID();
-58      }
-59      
-60      /**
-61       * Get the user friendly name for the entity, collecting the locale from the 
-62       * browser if possible
-63       * @param req the request
-64       * @return a user friendly name.
-65       */
-66      public String getDisplayName(HttpServletRequest req) {
-67          //
-68          // Get the browser locale, failing that the server one
-69          //
-70          Locale locale = req.getLocale();
-71          if (null == locale) {
-72              Locale.getDefault();
-73          }
-74          String lang = locale.getLanguage();
-75              
-76          return getDisplayName(lang);
-77      }
-78      /**
-79       * Get the user friendly name for the entity, using provided language
-80       * @param lang the language.
-81       * 
-82       * @return a user friendly name.
-83       */
-84      private String getDisplayName(String lang) {
-85          Organization org = entity.getOrganization();
-86      
-87          if (org == null) {
-88              return entity.getEntityID();
-89          } 
-90          
-91          List<OrganizationDisplayName> list = org.getDisplayNames();
-92  
-93          //
-94          // Lookup first by locale
-95          //
-96          
-97          for (OrganizationDisplayName name:list) {
-98              if (null !=name && lang.equals(name.getName().getLanguage())) {
-99                  return name.getName().getLocalString();
-100             }
-101         }
-102         
-103         //
-104         // If that doesn't work then anything goes
-105         //
-106         
-107         for (OrganizationDisplayName name:list) {
-108             if (null !=name && null != name.getName().getLocalString()) {
-109                 return name.getName().getLocalString();
-110             }
-111         }
-112      
-113         //
-114         // If there is still nothing then use the entity Id
-115         //
-116         return entity.getEntityID();
-117     }
-118     /**
-119      * Get the user friendly name for the entity, the language we previouslt set up
-120      * @param lang the language.
-121      * 
-122      * @return a user friendly name.
-123      */
-124     public String getDisplayName() {
-125         return getDisplayName(displayLanguage);
-126     }
-127     
-128     /**
-129      * Comparison so we can sort the output for jsp.
-130      * @param o What to compare against
-131      * @return numeric encoding of comparison 
-132      * @see java.lang.Comparator
-133      */
-134     protected int compareTo(Object o, HttpServletRequest req) {
-135             
-136 
-137         String myDisplayName;
-138         String otherDisplayName;
-139         IdPSite other;
-140 
-141         if (equals(o)) {
-142             return 0;
-143         }
-144 
-145         myDisplayName = getDisplayName(req);
-146         if (null == myDisplayName) {
-147             myDisplayName = "";
-148         } 
-149         
-150         other = (IdPSite) o;
-151         otherDisplayName = other.getDisplayName(req);
-152         if (null == otherDisplayName) {
-153             otherDisplayName = "";
-154         }
-155 
-156         int result = myDisplayName.toLowerCase().compareTo(otherDisplayName.toLowerCase());
-157         if (result == 0) {
-158                 result = myDisplayName.compareTo(otherDisplayName);
-159         }
-160         return result;
-161     }
-162 
-163     /**
-164      * When a user has selected an IdP, this provides the address to which we redirect.
-165      * @return http address for the IdP this represents.  
-166      */
-167     public String getAddressForWAYF() {
-168         List<SingleSignOnService> ssoList;
-169         
-170         ssoList = entity.getIDPSSODescriptor(XMLConstants.SHIB_NS).getSingleSignOnServices();
-171         
-172         for (SingleSignOnService signOnService: ssoList) {
-173             if (XMLConstants.IDP_SSO_BINDING.equals(signOnService.getBinding())) {
-174                 return signOnService.getLocation();
-175             }
-176         }
-177         return null;
-178     }
-179 
-180     /**
-181      * Prior to display we set the display language from the
-182      * browser. There is probably a proper way to do this using
-183      * jsp, but I want to keep the API between JSP and java the same 1.3->2.0
-184      * @param lang the language to set
-185      */
-186     public void setDisplayLanguage(String lang) {
-187         this.displayLanguage = lang;
-188     }
-189     
-190     public static class Compare implements Comparator<IdPSite> {
-191 
-192         /**
-193          * This allows us to set up sorted lists of entities with respect to
-194          * the browser request.
-195          * 
-196          * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
-197          */
-198         private HttpServletRequest req = null;
-199         
-200         private Compare() {
-201             //
-202             // No public method
-203         }
-204         
-205         public Compare(HttpServletRequest req) {
-206             this.req = req;
-207         }
-208         
-209         public int compare(IdPSite o1, IdPSite o2) {
-210             // TODO Auto-generated method stub
-211             return o1.compareTo(o2, req);
-212         }
-213         
-214     }
-215 
-216 }       
-217 
+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.wayf;
+18  
+19  import java.util.Comparator;
+20  import java.util.List;
+21  import java.util.Locale;
+22  
+23  import javax.servlet.http.HttpServletRequest;
+24  
+25  import org.opensaml.saml2.common.Extensions;
+26  import org.opensaml.saml2.metadata.EntityDescriptor;
+27  import org.opensaml.saml2.metadata.IDPSSODescriptor;
+28  import org.opensaml.saml2.metadata.Organization;
+29  import org.opensaml.saml2.metadata.OrganizationDisplayName;
+30  import org.opensaml.saml2.metadata.SingleSignOnService;
+31  
+32  /**
+33   * A class which abstracts an IdP for the sake of the WAYF display.  Given an {@link EntityDescriptor} as
+34   * input it provides bean style get functions for the name (EntityId), the display name 
+35   * (a hybrid of Organization name or EntityId and the IdP's SSO connection point.
+36   * 
+37   */
+38  public class IdPSite {
+39  
+40      /** The OpenSaml element that this stands for. */
+41      private EntityDescriptor entity;
+42      
+43      /** The language we set up */
+44      private String displayLanguage;
+45      
+46      /**
+47       * Create a new element from the provided Entity.
+48       * @param entityParam - What to create from
+49       */
+50      public IdPSite(EntityDescriptor entityParam) {
+51          entity = entityParam;
+52      }
+53      
+54      /**
+55       * Get the name for the enclosed entity. 
+56       * @return the name for the enclosed entity.
+57       */
+58      public String getName() {
+59              return entity.getEntityID();
+60      }
+61      
+62      /**
+63       * Get the user friendly name for the entity, collecting the locale from the 
+64       * browser if possible
+65       * @param req the request
+66       * @return a user friendly name.
+67       */
+68      public String getDisplayName(HttpServletRequest req) {
+69          //
+70          // Get the browser locale, failing that the server one
+71          //
+72          Locale locale = req.getLocale();
+73          if (null == locale) {
+74              Locale.getDefault();
+75          }
+76          String lang = locale.getLanguage();
+77              
+78          return getDisplayName(lang);
+79      }
+80      /**
+81       * Get the user friendly name for the entity, using provided language
+82       * @param lang the language.
+83       * 
+84       * @return a user friendly name.
+85       */
+86      private String getDisplayName(String lang) {
+87          Organization org = entity.getOrganization();
+88      
+89          if (org == null) {
+90              return entity.getEntityID();
+91          } 
+92          
+93          List<OrganizationDisplayName> list = org.getDisplayNames();
+94  
+95          //
+96          // Lookup first by locale
+97          //
+98          
+99          for (OrganizationDisplayName name:list) {
+100             if (null !=name && lang.equals(name.getName().getLanguage())) {
+101                 return name.getName().getLocalString();
+102             }
+103         }
+104         
+105         //
+106         // If that doesn't work then anything goes
+107         //
+108         
+109         for (OrganizationDisplayName name:list) {
+110             if (null !=name && null != name.getName().getLocalString()) {
+111                 return name.getName().getLocalString();
+112             }
+113         }
+114      
+115         //
+116         // If there is still nothing then use the entity Id
+117         //
+118         return entity.getEntityID();
+119     }
+120     /**
+121      * Get the user friendly name for the entity, the language we previously set up.
+122      * 
+123      * @return a user friendly name.
+124      */
+125     public String getDisplayName() {
+126         return getDisplayName(displayLanguage);
+127     }
+128     
+129     /**
+130      * Return all the extension elements.
+131      * @return the extensions
+132      */
+133     public Extensions getExtensions() {
+134         IDPSSODescriptor idpss = entity.getIDPSSODescriptor(XMLConstants.SHIB_NS);
+135         if (null == idpss) {
+136             //
+137             // Get the SAML2 protocol
+138             //
+139             idpss = entity.getIDPSSODescriptor(XMLConstants.SALM2_PROTOCOL);
+140         }
+141         if (null == idpss) {
+142             return null;
+143         }
+144         return idpss.getExtensions();
+145     }
+146     
+147     /**
+148      * Comparison so we can sort the output for jsp.
+149      * @param What to compare against
+150      * @return numeric encoding of comparison 
+151      * @see java.lang.Comparator
+152      */
+153     protected int compareTo(Object o, HttpServletRequest req) {
+154             
+155 
+156         String myDisplayName;
+157         String otherDisplayName;
+158         IdPSite other;
+159 
+160         if (equals(o)) {
+161             return 0;
+162         }
+163 
+164         myDisplayName = getDisplayName(req);
+165         if (null == myDisplayName) {
+166             myDisplayName = "";
+167         } 
+168         
+169         other = (IdPSite) o;
+170         otherDisplayName = other.getDisplayName(req);
+171         if (null == otherDisplayName) {
+172             otherDisplayName = "";
+173         }
+174 
+175         int result = myDisplayName.toLowerCase().compareTo(otherDisplayName.toLowerCase());
+176         if (result == 0) {
+177                 result = myDisplayName.compareTo(otherDisplayName);
+178         }
+179         return result;
+180     }
+181 
+182     /**
+183      * When a user has selected an IdP, this provides the address to which we redirect.
+184      * @return http address for the IdP this represents.  
+185      */
+186     public String getAddressForWAYF() {
+187         List<SingleSignOnService> ssoList;
+188         
+189         ssoList = entity.getIDPSSODescriptor(XMLConstants.SHIB_NS).getSingleSignOnServices();
+190         
+191         for (SingleSignOnService signOnService: ssoList) {
+192             if (XMLConstants.IDP_SSO_BINDING.equals(signOnService.getBinding())) {
+193                 return signOnService.getLocation();
+194             }
+195         }
+196         return null;
+197     }
+198 
+199     /**
+200      * Prior to display we set the display language from the
+201      * browser. There is probably a proper way to do this using
+202      * jsp, but I want to keep the API between JSP and java the same 1.3->2.0
+203      * @param lang the language to set
+204      */
+205     public void setDisplayLanguage(String lang) {
+206         this.displayLanguage = lang;
+207     }
+208     
+209     public static class Compare implements Comparator<IdPSite> {
+210 
+211         /**
+212          * This allows us to set up sorted lists of entities with respect to
+213          * the browser request.
+214          * 
+215          * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+216          */
+217         private HttpServletRequest req = null;
+218         
+219         private Compare() {
+220             //
+221             // No public method
+222         }
+223         
+224         public Compare(HttpServletRequest req) {
+225             this.req = req;
+226         }
+227         
+228         public int compare(IdPSite o1, IdPSite o2) {
+229             // TODO Auto-generated method stub
+230             return o1.compareTo(o2, req);
+231         }
+232         
+233     }
+234 
+235 }       
+236 
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSiteSet.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSiteSet.html index acb4888..e77e85a 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSiteSet.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSiteSet.html @@ -1,576 +1,592 @@ - + IdPSiteSet xref
View Javadoc
 
-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  package edu.internet2.middleware.shibboleth.wayf;
-17  
-18  import java.io.File;
-19  import java.lang.reflect.Constructor;
-20  import java.net.MalformedURLException;
-21  import java.net.URL;
-22  import java.util.ArrayList;
-23  import java.util.Collection;
-24  import java.util.Enumeration;
-25  import java.util.HashMap;
-26  import java.util.HashSet;
-27  import java.util.List;
-28  import java.util.Map;
-29  import java.util.Set;
-30  import java.util.StringTokenizer;
-31  import java.util.TreeMap;
-32  
-33  import org.opensaml.saml2.metadata.EntitiesDescriptor;
-34  import org.opensaml.saml2.metadata.EntityDescriptor;
-35  import org.opensaml.saml2.metadata.IDPSSODescriptor;
-36  import org.opensaml.saml2.metadata.Organization;
-37  import org.opensaml.saml2.metadata.OrganizationDisplayName;
-38  import org.opensaml.saml2.metadata.OrganizationName;
-39  import org.opensaml.saml2.metadata.RoleDescriptor;
-40  import org.opensaml.saml2.metadata.SPSSODescriptor;
-41  import org.opensaml.saml2.metadata.provider.FileBackedHTTPMetadataProvider;
-42  import org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider;
-43  import org.opensaml.saml2.metadata.provider.MetadataFilter;
-44  import org.opensaml.saml2.metadata.provider.MetadataFilterChain;
-45  import org.opensaml.saml2.metadata.provider.MetadataProvider;
-46  import org.opensaml.saml2.metadata.provider.MetadataProviderException;
-47  import org.opensaml.saml2.metadata.provider.ObservableMetadataProvider;
-48  import org.opensaml.xml.XMLObject;
-49  import org.opensaml.xml.parse.ParserPool;
-50  import org.slf4j.Logger;
-51  import org.slf4j.LoggerFactory;
-52  import org.w3c.dom.Element;
-53  import org.w3c.dom.NodeList;
-54  
-55  import edu.internet2.middleware.shibboleth.common.ShibbolethConfigurationException;
-56  import edu.internet2.middleware.shibboleth.wayf.plugins.Plugin;
-57  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginMetadataParameter;
-58  import edu.internet2.middleware.shibboleth.wayf.plugins.provider.BindingFilter;
-59  
-60  /**
-61   * 
-62   * Represents a collection of related sites as desribed by a single soirce of metadata. 
-63   * This is usually a federation.  When the WAYF looks to see which IdP sites to show, 
-64   * it trims the list so as to not show IdP's which do not trust the SP.
-65   *
-66   * This class is opaque outside this file.  The three static methods getSitesLists,
-67   * searchForMatchingOrigins and lookupIdP provide mechansims for accessing 
-68   * collections of IdPSiteSets.
-69   * 
-70   */
-71  
-72  public class IdPSiteSet implements ObservableMetadataProvider.Observer {
-73          
-74      /** Handle for error output. */
-75      private static final Logger LOG = LoggerFactory.getLogger(IdPSiteSet.class.getName());
-76  
-77      /** The OpenSaml metadata source. */
-78      private ObservableMetadataProvider metadata;
-79  
-80      /** Is the named SP in the current metadata set? */
-81      private Set<String> spNames = new HashSet<String>(0);
-82  
-83      /** Is the named IdP in the current metadata set? */
-84      private Set<String> idpNames = new HashSet<String>(0);
-85      
-86      /** What does the configuration identify this as? */
-87      private final String identifier;
-88      
-89      /** What name should we display for this set of entities? */
-90      private final String displayName;
-91      
-92      /** Where does the metadata exist? */
-93      private String location;
-94      
-95      /** What parameters do we pass in to which plugin? */
-96      private final Map<Plugin, PluginMetadataParameter> plugins = new HashMap<Plugin, PluginMetadataParameter>();
-97      
-98      /**
-99       * Create a new IdPSiteSet as described by the supplied XML segment. 
-100      * @param el - configuration details.
-101      * @param parserPool - the parsers we initialized above.
-102      * @param warnOnBadBinding if we just warn or give an error if an SP has bad entry points.
-103      * @throws ShibbolethConfigurationException - if something goes wrong.
-104      */
-105     protected IdPSiteSet(Element el, ParserPool parserPool, boolean warnOnBadBinding) throws ShibbolethConfigurationException {
-106 
-107         String spoolSpace;
-108         String delayString;
-109 
-110         this.identifier = el.getAttribute("identifier");
-111         this.displayName = el.getAttribute("displayName");
-112         location = el.getAttribute("url");
-113         if (null == location || location.length() == 0) {
-114             //
-115             // Sigh for a few releases this was documented as URI
-116             //
-117             location = el.getAttribute("url");
-118         }
-119         spoolSpace = el.getAttribute("backingFile");
-120         delayString = el.getAttribute("timeout");
-121         
-122         //
-123         // Configure the filters (before the metadata so we can add them before we start reading)
-124         //
-125         String ident;
-126         String className;
-127         ident = "<not specified>"; 
-128         className = "<not specified>"; 
-129         MetadataFilterChain filterChain = null;
-130         filterChain = new MetadataFilterChain();
-131         try {
-132             NodeList itemElements = el.getElementsByTagNameNS(XMLConstants.CONFIG_NS, "Filter");
-133             List <MetadataFilter> filters = new ArrayList<MetadataFilter>(1 + itemElements.getLength());
-134             
-135             //
-136             // We always have a binding filter
-137             //
-138             filters.add(new BindingFilter(warnOnBadBinding));
-139                 
-140             for (int i = 0; i < itemElements.getLength(); i++) {
-141                 Element element = (Element) itemElements.item(i);
-142    
-143                 ident = "<not specified>"; 
-144                 className = "<not specified>"; 
-145             
-146                 ident = element.getAttribute("identifier");
-147 
-148                 if (null == ident || ident.equals("")) {
-149                     LOG.error("Could not load filter with no identifier");
-150                     continue;
-151                 }
-152             
-153                 className = element.getAttribute("type");
-154                 if (null == className || className.equals("")) {
-155                     LOG.error("Filter " + identifier + " did not have a valid type");
-156                 }
-157                 //
-158                 // So try to get hold of the Filter
-159                 //
-160                 Class<MetadataFilter> filterClass = (Class<MetadataFilter>) Class.forName(className);
-161                 Class[] classParams = {Element.class};
-162                 Constructor<MetadataFilter> constructor = filterClass.getConstructor(classParams);
-163                 Object[] constructorParams = {element};
-164             
-165                 filters.add(constructor.newInstance(constructorParams));
-166             }
-167             filterChain.setFilters(filters);
-168         } catch (Exception e) {
-169             LOG.error("Could not load filter " + ident + "()" + className + ") for " + this.identifier, e);
-170             throw new ShibbolethConfigurationException("Could not load filter", e);
-171         }
-172     
-173         LOG.info("Loading Metadata for " + displayName);
-174         try {
-175             int delay;
-176             delay = 30000;
-177             if (null != delayString && !"".equals(delayString)) {
-178                 delay = Integer.parseInt(delayString);
-179             }
-180             
-181             URL url = new URL(location); 
-182             if ("file".equalsIgnoreCase(url.getProtocol())){
-183                 FilesystemMetadataProvider provider = new FilesystemMetadataProvider(new File(url.getFile()));
-184                 provider.setParserPool(parserPool);
-185                 if (null != filterChain) {
-186                     provider.setMetadataFilter(filterChain);
-187                 }
-188                 provider.initialize();
-189                 metadata = provider;
-190             } else {
-191                 if (spoolSpace == null || "".equals(spoolSpace)) {
-192                     throw new ShibbolethConfigurationException("backingFile must be specified for " + identifier);
-193                 }
-194                 
-195                 FileBackedHTTPMetadataProvider provider;
-196             
-197                 provider = new FileBackedHTTPMetadataProvider(location, delay, spoolSpace);
-198                 provider.setParserPool(parserPool);
-199                 if (null != filterChain) {
-200                     provider.setMetadataFilter(filterChain);
-201                 }
-202                 provider.initialize();
-203                 metadata = provider;
-204             }
-205         } catch (MetadataProviderException e) {
-206             throw new ShibbolethConfigurationException("Could not read " + location, e);
-207         } catch (NumberFormatException e) {
-208             throw new ShibbolethConfigurationException("Badly formed timeout " + delayString, e);
-209         } catch (MalformedURLException e) {
-210             throw new ShibbolethConfigurationException("Badly formed url ", e);
-211         }
-212         metadata.getObservers().add(this);
-213         onEvent(metadata);
-214     }
-215 
-216     /**
-217      * Based on 1.2 Origin.isMatch.  There must have been a reason for it...
-218      * [Kindas of] support for the search function in the wayf.  This return many false positives
-219      * but given the aim is to provide input for a pull down list...
-220      * 
-221      * @param entity   The entity to match.
-222      * @param str      The patten to match against.
-223      * @param config   Provides list of tokens to not lookup
-224      * @return         Whether this entity matches  
-225      */
-226 
-227     private static boolean isMatch(EntityDescriptor entity, String str, HandlerConfig config) {
-228         
-229         Enumeration input = new StringTokenizer(str);
-230         while (input.hasMoreElements()) {
-231             String currentToken = (String) input.nextElement();
-232 
-233             if (config.isIgnoredForMatch(currentToken)) {                           
-234                 continue;
-235             }
-236                 
-237             currentToken = currentToken.toLowerCase(); 
-238 
-239             if (entity.getEntityID().indexOf(currentToken) > -1) {
-240                 return true; 
-241             }
-242                                 
-243             Organization org = entity.getOrganization();
-244                 
-245             if (org != null) {
-246                         
-247                 List <OrganizationName> orgNames = org.getOrganizationNames();
-248                 for (OrganizationName name : orgNames) {
-249                     if (name.getName().getLocalString().toLowerCase().indexOf(currentToken) > -1) {
-250                         return true;
-251                     }
-252                 }
-253                         
-254                 List <OrganizationDisplayName> orgDisplayNames = org.getDisplayNames();
-255                 for (OrganizationDisplayName name : orgDisplayNames) {
-256                     if (name.getName().getLocalString().toLowerCase().indexOf(currentToken) > -1) {
-257                         return true;
-258                     }
-259                 }                                
-260             }
-261         }
-262         return false;
-263     }
-264 
-265     /**
-266      * Return all the Idp in the provided entities descriptor.  If SearchMatches
-267      * is non null it is populated with whatever of the IdPs matches the search string 
-268      * (as noted above). 
-269      * @param searchString to match with
-270      * @param config parameter to mathing
-271      * @param searchMatches if non null is filled with such of the sites which match the string
-272      * @return the sites which fit.
-273      */
-274     protected Map<String, IdPSite> getIdPSites(String searchString, 
-275                                                HandlerConfig config, 
-276                                                Collection<IdPSite> searchMatches)
-277     {
-278         XMLObject object;
-279         List <EntityDescriptor> entities;
-280         try {
-281             object = metadata.getMetadata();
-282         } catch (MetadataProviderException e) {
-283             LOG.error("Metadata for " + location + "could not be read", e);
-284             return null;
-285         }
-286         
-287         if (object == null) {
-288             return null;
-289         }
-290         
-291         //
-292         // Fill in entities approptiately
-293         //
-294         
-295         if (object instanceof EntityDescriptor) {
-296             entities = new ArrayList<EntityDescriptor>(1);
-297             entities.add((EntityDescriptor) object);
-298         } else if (object instanceof EntitiesDescriptor) {
-299 
-300             EntitiesDescriptor entitiesDescriptor = (EntitiesDescriptor) object; 
-301     
-302             entities = entitiesDescriptor.getEntityDescriptors();
-303         } else {
-304            return null;
-305         }
-306        
-307         //
-308         // populate the result (and the searchlist) from the entities list
-309         //
-310         
-311         TreeMap<String, IdPSite> result = new TreeMap <String,IdPSite>();
-312                     
-313         for (EntityDescriptor entity : entities) {
-314                 
-315             if (entity.isValid() && hasIdPRole(entity)) {
-316 
-317                 IdPSite site = new IdPSite(entity);
-318                 result.put(site.getName(), site);
-319                 if (searchMatches != null && isMatch(entity, searchString, config)) {           
-320 
-321                     searchMatches.add(site);
-322                 }
-323 
-324             }
-325         } // iterate over all entities
-326         return result;
-327     }
-328 
-329 
-330     /**
-331      * Return this sites (internal) identifier.
-332      * @return the identifier
-333      */
-334     protected String getIdentifier() {
-335         return identifier;
-336     }
-337 
-338     /**
-339      * Return the human friendly name for this siteset.
-340      * @return The friendly name
-341      */
-342     protected String getDisplayName() {
-343         return displayName;
-344     }
-345 
-346     /**
-347      * We do not need to look at a set if it doesn't know about the given SP.  However if
-348      * no SP is given (as per 1.1) then we do need to look.  This calls lets us know whether 
-349      * this set is a canddiate for looking into.
-350      * @param SPName the Sp we are interested in.
-351      * @return whether the site contains the SP.
-352      */
-353     protected boolean containsSP(String SPName) {
-354 
-355         //
-356         // Deal with the case where we do *not* want to search by
-357         // SP (also handles the 1.1 case)
-358         //
-359         
-360         if ((SPName == null) || (SPName.length() == 0)) {
-361             return true;
-362         }
-363 
-364         //
-365         // Get hold of the current object list so as to provoke observer to fire 
-366         // if needs be.
-367         // 
-368         
-369         XMLObject object;
-370         try {
-371             object = metadata.getMetadata();
-372         } catch (MetadataProviderException e) {
-373             return false;
-374         }
-375         //
-376         // Now lookup
-377         //
-378 
-379         if (object instanceof EntitiesDescriptor ||
-380             object instanceof EntityDescriptor) {
-381             return spNames.contains(SPName);
-382         } else {
-383             return false;
-384         }
-385     }
-386 
-387     /**
-388      * For plugin handling we need to know quickly if a metadataset contains the idp.
-389      * @param IdPName the IdP we are interested in.
-390      * @return whether the site contains the IdP.
-391      * 
-392      */
-393 
-394     protected boolean containsIdP(String IdPName) {
-395         
-396         if ((IdPName == null) || (IdPName.length() == 0)) {
-397             return true;
-398         }
-399 
-400         //
-401         // Get hold of the current object list so as to provoke observer to fire 
-402         // if needs be.
-403         // 
-404         
-405         XMLObject object;
-406         try {
-407             object = metadata.getMetadata();
-408         } catch (MetadataProviderException e) {
-409             return false;
-410         }
-411         if (object instanceof EntitiesDescriptor ||
-412             object instanceof EntityDescriptor) {
-413             return idpNames.contains(IdPName);
-414         } else {
-415             return false;
-416         }
-417     }
-418 
-419     //
-420     // Now deal with plugins - these are delcared to use but we are
-421     // responsible for their parameter
-422     //
-423 
-424     /**
-425      * Declares a plugin to the siteset.
-426      * @param plugin what to declare
-427      */
-428     protected void addPlugin(Plugin plugin) {
-429 
-430         if (plugins.containsKey(plugin)) {
-431             return;
-432         }
-433         
-434         PluginMetadataParameter param = plugin.refreshMetadata(metadata);
-435         
-436         plugins.put(plugin, param);
-437     }
-438 
-439     /**
-440      * Return the parameter that this plugin uses.
-441      * @param plugin
-442      * @return teh parameter.
-443      */
-444     protected PluginMetadataParameter paramFor(Plugin plugin) {
-445         return plugins.get(plugin);
-446     }
-447 
-448 
-449     /* (non-Javadoc)
-450      * @see org.opensaml.saml2.metadata.provider.ObservableMetadataProvider.Observer#onEvent(org.opensaml.saml2.metadata.provider.MetadataProvider)
-451      */
-452     public void onEvent(MetadataProvider provider) {
-453         Set<String> spNameSet = new HashSet<String>(0);
-454         Set<String> idpNameSet = new HashSet<String>(0);
-455 
-456         XMLObject obj; 
-457         try {
-458             obj = provider.getMetadata();
-459         } catch (MetadataProviderException e) {
-460             LOG.error("Couldn't read metadata for " + location, e);
-461             return;
-462         }
-463         if ((obj instanceof EntitiesDescriptor)) {
-464             EntitiesDescriptor entitiesDescriptor = (EntitiesDescriptor) obj;
-465             
-466             for (EntityDescriptor entity : entitiesDescriptor.getEntityDescriptors()) {
-467                 if (hasSPRole(entity)) {
-468                     spNameSet.add(entity.getEntityID());
-469                 }
-470                 if (hasIdPRole(entity)) {
-471                     idpNameSet.add(entity.getEntityID());
-472                 }
-473             }
-474         } else if (obj instanceof EntityDescriptor) {
-475             EntityDescriptor entity = (EntityDescriptor) obj;
-476             if (hasSPRole(entity)) {
-477                 spNameSet.add(entity.getEntityID());
-478             }
-479             if (hasIdPRole(entity)) {
-480                 idpNameSet.add(entity.getEntityID());
-481             }
-482         } else {
-483             LOG.error("Metadata for " + location + " isn't <EntitiesDescriptor> or <EntityDescriptor>");
-484             return;
-485         }
-486         //
-487         // Now that we have the new set sorted out commit it in
-488         //
-489         this.spNames = spNameSet;
-490         this.idpNames = idpNameSet;
-491         
-492         for (Plugin plugin:plugins.keySet()) {
-493             plugins.put(plugin, plugin.refreshMetadata(provider));
-494         }
-495     }
-496 
-497     /**
-498      * Enumerate all the roles and see whether this entity can be an IdP.
-499      * @param entity
-500      * @return true if one of the roles that entity has is IdPSSO
-501      */
-502     private static boolean hasIdPRole(EntityDescriptor entity) {
-503         List<RoleDescriptor> roles = entity.getRoleDescriptors();
-504         
-505         for (RoleDescriptor role:roles) {
-506            if (role instanceof IDPSSODescriptor) {
-507                //
-508                // So the entity knows how to be some sort of an Idp
-509                //
-510                return true;            
-511            }
-512         }
-513         return false;
-514     }
-515 
-516     /**
-517      * Enumerate all the roles and see whether this entity can be an SP.
-518      * @param entity
-519      * @return true if one of the roles that entity has is SPSSO
-520      */
-521     private static boolean hasSPRole(EntityDescriptor entity) {
-522         List<RoleDescriptor> roles = entity.getRoleDescriptors();
-523         
-524         for (RoleDescriptor role:roles) {
-525            if (role instanceof SPSSODescriptor) {
-526                //
-527                // "I can do that"
-528                //
-529                return true;
-530            }
-531         }
-532         return false;
-533     }
-534 
-535     /**
-536      * Return the idpSite for the given entity name.
-537      * @param idpName the entityname to look up
-538      * @return the associated idpSite
-539      * @throws WayfException
-540      */
-541     protected IdPSite getSite(String idpName) throws WayfException {
-542 
-543         try {
-544             return new IdPSite(metadata.getEntityDescriptor(idpName));
-545         } catch (MetadataProviderException e) {
-546             String s = "Couldn't resolve " + idpName + " in "  + getDisplayName();
-547             LOG.error(s, e);
-548             throw new WayfException(s, e);
-549         }
-550     }
-551     
-552     protected EntityDescriptor getEntity(String name) throws WayfException {
-553         try {
-554             return metadata.getEntityDescriptor(name);
-555         } catch (MetadataProviderException e) {
-556             String s = "Couldn't resolve " + name + " in "  + getDisplayName();
-557             LOG.error(s, e);
-558             throw new WayfException(s, e);
-559         }
-560         
-561     }
-562 }
-563 
+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  package edu.internet2.middleware.shibboleth.wayf;
+17  
+18  import java.io.File;
+19  import java.lang.reflect.Constructor;
+20  import java.net.MalformedURLException;
+21  import java.net.URL;
+22  import java.util.ArrayList;
+23  import java.util.Collection;
+24  import java.util.Enumeration;
+25  import java.util.HashMap;
+26  import java.util.HashSet;
+27  import java.util.List;
+28  import java.util.Map;
+29  import java.util.Set;
+30  import java.util.StringTokenizer;
+31  import java.util.TreeMap;
+32  
+33  import org.opensaml.saml2.metadata.EntitiesDescriptor;
+34  import org.opensaml.saml2.metadata.EntityDescriptor;
+35  import org.opensaml.saml2.metadata.IDPSSODescriptor;
+36  import org.opensaml.saml2.metadata.Organization;
+37  import org.opensaml.saml2.metadata.OrganizationDisplayName;
+38  import org.opensaml.saml2.metadata.OrganizationName;
+39  import org.opensaml.saml2.metadata.RoleDescriptor;
+40  import org.opensaml.saml2.metadata.SPSSODescriptor;
+41  import org.opensaml.saml2.metadata.provider.FileBackedHTTPMetadataProvider;
+42  import org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider;
+43  import org.opensaml.saml2.metadata.provider.MetadataFilter;
+44  import org.opensaml.saml2.metadata.provider.MetadataFilterChain;
+45  import org.opensaml.saml2.metadata.provider.MetadataProvider;
+46  import org.opensaml.saml2.metadata.provider.MetadataProviderException;
+47  import org.opensaml.saml2.metadata.provider.ObservableMetadataProvider;
+48  import org.opensaml.xml.XMLObject;
+49  import org.opensaml.xml.parse.ParserPool;
+50  import org.slf4j.Logger;
+51  import org.slf4j.LoggerFactory;
+52  import org.w3c.dom.Element;
+53  import org.w3c.dom.NodeList;
+54  
+55  import edu.internet2.middleware.shibboleth.common.ShibbolethConfigurationException;
+56  import edu.internet2.middleware.shibboleth.wayf.plugins.Plugin;
+57  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginMetadataParameter;
+58  import edu.internet2.middleware.shibboleth.wayf.plugins.provider.BindingFilter;
+59  
+60  /**
+61   * 
+62   * Represents a collection of related sites as described by a single source of metadata. 
+63   * This is usually a federation.  When the WAYF looks to see which IdP sites to show, 
+64   * it trims the list so as to not show IdP's which do not trust the SP.
+65   *
+66   * This class is opaque outside this file.  The three static methods getSitesLists,
+67   * searchForMatchingOrigins and lookupIdP provide mechansims for accessing 
+68   * collections of IdPSiteSets.
+69   * 
+70   */
+71  
+72  public class IdPSiteSet implements ObservableMetadataProvider.Observer {
+73          
+74      /** Handle for error output. */
+75      private static final Logger LOG = LoggerFactory.getLogger(IdPSiteSet.class.getName());
+76  
+77      /** The OpenSaml metadata source. */
+78      private ObservableMetadataProvider metadata;
+79  
+80      /** Is the named SP in the current metadata set? */
+81      private Set<String> spNames = new HashSet<String>(0);
+82  
+83      /** Is the named IdP in the current metadata set? */
+84      private Set<String> idpNames = new HashSet<String>(0);
+85      
+86      /** What does the configuration identify this as? */
+87      private final String identifier;
+88      
+89      /** What name should we display for this set of entities? */
+90      private final String displayName;
+91      
+92      /** Where does the metadata exist? */
+93      private String location;
+94      
+95      /** What parameters do we pass in to which plugin? */
+96      private final Map<Plugin, PluginMetadataParameter> plugins = new HashMap<Plugin, PluginMetadataParameter>();
+97      
+98      /**
+99       * Create a new IdPSiteSet as described by the supplied XML segment. 
+100      * @param el - configuration details.
+101      * @param parserPool - the parsers we initialized above.
+102      * @param warnOnBadBinding if we just warn or give an error if an SP has bad entry points.
+103      * @throws ShibbolethConfigurationException - if something goes wrong.
+104      */
+105     protected IdPSiteSet(Element el, ParserPool parserPool, boolean warnOnBadBinding) throws ShibbolethConfigurationException {
+106 
+107         String spoolSpace;
+108         String delayString;
+109 
+110         this.identifier = el.getAttribute("identifier");
+111         this.displayName = el.getAttribute("displayName");
+112         location = el.getAttribute("url");
+113         if (null == location || location.length() == 0) {
+114             //
+115             // Sigh for a few releases this was documented as URI
+116             //
+117             location = el.getAttribute("url");
+118         }
+119         spoolSpace = el.getAttribute("backingFile");
+120         delayString = el.getAttribute("timeout");
+121         
+122         //
+123         // Configure the filters (before the metadata so we can add them before we start reading)
+124         //
+125         String ident;
+126         String className;
+127         ident = "<not specified>"; 
+128         className = "<not specified>"; 
+129         MetadataFilterChain filterChain = null;
+130         filterChain = new MetadataFilterChain();
+131         try {
+132             NodeList itemElements = el.getElementsByTagNameNS(XMLConstants.CONFIG_NS, "Filter");
+133             List <MetadataFilter> filters = new ArrayList<MetadataFilter>(1 + itemElements.getLength());
+134             
+135             //
+136             // We always have a binding filter
+137             //
+138             filters.add(new BindingFilter(warnOnBadBinding));
+139                 
+140             for (int i = 0; i < itemElements.getLength(); i++) {
+141                 Element element = (Element) itemElements.item(i);
+142    
+143                 ident = "<not specified>"; 
+144                 className = "<not specified>"; 
+145             
+146                 ident = element.getAttribute("identifier");
+147 
+148                 if (null == ident || ident.equals("")) {
+149                     LOG.error("Could not load filter with no identifier");
+150                     continue;
+151                 }
+152             
+153                 className = element.getAttribute("type");
+154                 if (null == className || className.equals("")) {
+155                     LOG.error("Filter " + identifier + " did not have a valid type");
+156                 }
+157                 //
+158                 // So try to get hold of the Filter
+159                 //
+160                 Class<MetadataFilter> filterClass = (Class<MetadataFilter>) Class.forName(className);
+161                 Class[] classParams = {Element.class};
+162                 Constructor<MetadataFilter> constructor = filterClass.getConstructor(classParams);
+163                 Object[] constructorParams = {element};
+164             
+165                 filters.add(constructor.newInstance(constructorParams));
+166             }
+167             filterChain.setFilters(filters);
+168         } catch (Exception e) {
+169             LOG.error("Could not load filter " + ident + "()" + className + ") for " + this.identifier, e);
+170             throw new ShibbolethConfigurationException("Could not load filter", e);
+171         }
+172     
+173         LOG.info("Loading Metadata for " + displayName);
+174         try {
+175             int delay;
+176             delay = 30000;
+177             if (null != delayString && !"".equals(delayString)) {
+178                 delay = Integer.parseInt(delayString);
+179             }
+180             
+181             URL url = new URL(location); 
+182             if ("file".equalsIgnoreCase(url.getProtocol())){
+183                 FilesystemMetadataProvider provider = new FilesystemMetadataProvider(new File(url.getFile()));
+184                 provider.setParserPool(parserPool);
+185                 if (null != filterChain) {
+186                     provider.setMetadataFilter(filterChain);
+187                 }
+188                 provider.initialize();
+189                 metadata = provider;
+190             } else {
+191                 if (spoolSpace == null || "".equals(spoolSpace)) {
+192                     throw new ShibbolethConfigurationException("backingFile must be specified for " + identifier);
+193                 }
+194                 
+195                 FileBackedHTTPMetadataProvider provider;
+196             
+197                 provider = new FileBackedHTTPMetadataProvider(location, delay, spoolSpace);
+198                 provider.setParserPool(parserPool);
+199                 if (null != filterChain) {
+200                     provider.setMetadataFilter(filterChain);
+201                 }
+202                 provider.initialize();
+203                 metadata = provider;
+204             }
+205         } catch (MetadataProviderException e) {
+206             throw new ShibbolethConfigurationException("Could not read " + location, e);
+207         } catch (NumberFormatException e) {
+208             throw new ShibbolethConfigurationException("Badly formed timeout " + delayString, e);
+209         } catch (MalformedURLException e) {
+210             throw new ShibbolethConfigurationException("Badly formed url ", e);
+211         }
+212         metadata.getObservers().add(this);
+213         onEvent(metadata);
+214     }
+215 
+216     /**
+217      * Based on 1.2 Origin.isMatch.  There must have been a reason for it...
+218      * [Kindas of] support for the search function in the wayf.  This return many false positives
+219      * but given the aim is to provide input for a pull down list...
+220      * 
+221      * @param entity   The entity to match.
+222      * @param str      The patten to match against.
+223      * @param config   Provides list of tokens to not lookup
+224      * @return         Whether this entity matches  
+225      */
+226 
+227     private static boolean isMatch(EntityDescriptor entity, String str, HandlerConfig config) {
+228         
+229         Enumeration input = new StringTokenizer(str);
+230         while (input.hasMoreElements()) {
+231             String currentToken = (String) input.nextElement();
+232 
+233             if (config.isIgnoredForMatch(currentToken)) {                           
+234                 continue;
+235             }
+236                 
+237             currentToken = currentToken.toLowerCase(); 
+238 
+239             if (entity.getEntityID().indexOf(currentToken) > -1) {
+240                 return true; 
+241             }
+242                                 
+243             Organization org = entity.getOrganization();
+244                 
+245             if (org != null) {
+246                         
+247                 List <OrganizationName> orgNames = org.getOrganizationNames();
+248                 for (OrganizationName name : orgNames) {
+249                     if (name.getName().getLocalString().toLowerCase().indexOf(currentToken) > -1) {
+250                         return true;
+251                     }
+252                 }
+253                         
+254                 List <OrganizationDisplayName> orgDisplayNames = org.getDisplayNames();
+255                 for (OrganizationDisplayName name : orgDisplayNames) {
+256                     if (name.getName().getLocalString().toLowerCase().indexOf(currentToken) > -1) {
+257                         return true;
+258                     }
+259                 }                                
+260             }
+261         }
+262         return false;
+263     }
+264 
+265     /**
+266      * Return all the Idp in the provided entities descriptor.  If SearchMatches
+267      * is non null it is populated with whatever of the IdPs matches the search string 
+268      * (as noted above). 
+269      * @param searchString to match with
+270      * @param config parameter to mathing
+271      * @param searchMatches if non null is filled with such of the sites which match the string
+272      * @return the sites which fit.
+273      */
+274     protected Map<String, IdPSite> getIdPSites(String searchString, 
+275                                                HandlerConfig config, 
+276                                                Collection<IdPSite> searchMatches)
+277     {
+278         XMLObject object;
+279         List <EntityDescriptor> entities;
+280         try {
+281             object = metadata.getMetadata();
+282         } catch (MetadataProviderException e) {
+283             LOG.error("Metadata for " + location + "could not be read", e);
+284             return null;
+285         }
+286         
+287         if (object == null) {
+288             return null;
+289         }
+290         
+291         //
+292         // Fill in entities approptiately
+293         //
+294         
+295         if (object instanceof EntityDescriptor) {
+296             entities = new ArrayList<EntityDescriptor>(1);
+297             entities.add((EntityDescriptor) object);
+298         } else if (object instanceof EntitiesDescriptor) {
+299 
+300             EntitiesDescriptor entitiesDescriptor = (EntitiesDescriptor) object; 
+301     
+302             entities = getAllEntities(entitiesDescriptor);
+303         } else {
+304            return null;
+305         }
+306        
+307         //
+308         // populate the result (and the searchlist) from the entities list
+309         //
+310         
+311         TreeMap<String, IdPSite> result = new TreeMap <String,IdPSite>();
+312                     
+313         for (EntityDescriptor entity : entities) {
+314                 
+315             if (entity.isValid() && hasIdPRole(entity)) {
+316 
+317                 IdPSite site = new IdPSite(entity);
+318                 result.put(site.getName(), site);
+319                 if (searchMatches != null && isMatch(entity, searchString, config)) {           
+320 
+321                     searchMatches.add(site);
+322                 }
+323 
+324             }
+325         } // iterate over all entities
+326         return result;
+327     }
+328 
+329 
+330     /**
+331      * Return this sites (internal) identifier.
+332      * @return the identifier
+333      */
+334     protected String getIdentifier() {
+335         return identifier;
+336     }
+337 
+338     /**
+339      * Return the human friendly name for this siteset.
+340      * @return The friendly name
+341      */
+342     protected String getDisplayName() {
+343         return displayName;
+344     }
+345 
+346     /**
+347      * We do not need to look at a set if it doesn't know about the given SP.  However if
+348      * no SP is given (as per 1.1) then we do need to look.  This calls lets us know whether 
+349      * this set is a canddiate for looking into.
+350      * @param SPName the Sp we are interested in.
+351      * @return whether the site contains the SP.
+352      */
+353     protected boolean containsSP(String SPName) {
+354 
+355         //
+356         // Deal with the case where we do *not* want to search by
+357         // SP (also handles the 1.1 case)
+358         //
+359         
+360         if ((SPName == null) || (SPName.length() == 0)) {
+361             return true;
+362         }
+363 
+364         //
+365         // Get hold of the current object list so as to provoke observer to fire 
+366         // if needs be.
+367         // 
+368         
+369         XMLObject object;
+370         try {
+371             object = metadata.getMetadata();
+372         } catch (MetadataProviderException e) {
+373             return false;
+374         }
+375         //
+376         // Now lookup
+377         //
+378 
+379         if (object instanceof EntitiesDescriptor ||
+380             object instanceof EntityDescriptor) {
+381             return spNames.contains(SPName);
+382         } else {
+383             return false;
+384         }
+385     }
+386 
+387     /**
+388      * For plugin handling we need to know quickly if a metadataset contains the idp.
+389      * @param IdPName the IdP we are interested in.
+390      * @return whether the site contains the IdP.
+391      * 
+392      */
+393 
+394     protected boolean containsIdP(String IdPName) {
+395         
+396         if ((IdPName == null) || (IdPName.length() == 0)) {
+397             return true;
+398         }
+399 
+400         //
+401         // Get hold of the current object list so as to provoke observer to fire 
+402         // if needs be.
+403         // 
+404         
+405         XMLObject object;
+406         try {
+407             object = metadata.getMetadata();
+408         } catch (MetadataProviderException e) {
+409             return false;
+410         }
+411         if (object instanceof EntitiesDescriptor ||
+412             object instanceof EntityDescriptor) {
+413             return idpNames.contains(IdPName);
+414         } else {
+415             return false;
+416         }
+417     }
+418 
+419     //
+420     // Now deal with plugins - these are delcared to use but we are
+421     // responsible for their parameter
+422     //
+423 
+424     /**
+425      * Declares a plugin to the siteset.
+426      * @param plugin what to declare
+427      */
+428     protected void addPlugin(Plugin plugin) {
+429 
+430         if (plugins.containsKey(plugin)) {
+431             return;
+432         }
+433         
+434         PluginMetadataParameter param = plugin.refreshMetadata(metadata);
+435         
+436         plugins.put(plugin, param);
+437     }
+438 
+439     /**
+440      * Return the parameter that this plugin uses.
+441      * @param plugin
+442      * @return teh parameter.
+443      */
+444     protected PluginMetadataParameter paramFor(Plugin plugin) {
+445         return plugins.get(plugin);
+446     }
+447 
+448     /**
+449      * Return all the entities below the entities descriptor
+450      * 
+451      * @param entitiesDescriptor the entities descriptor 
+452      * @return
+453      */
+454     
+455     private List<EntityDescriptor> getAllEntities(EntitiesDescriptor entitiesDescriptor)
+456     {
+457         List<EntityDescriptor> result = new ArrayList<EntityDescriptor>(entitiesDescriptor.getEntityDescriptors());
+458         for (EntitiesDescriptor entities : entitiesDescriptor.getEntitiesDescriptors()) {
+459             result.addAll(getAllEntities(entities));
+460         }
+461         return result;
+462     }
+463 
+464     /* (non-Javadoc)
+465      * @see org.opensaml.saml2.metadata.provider.ObservableMetadataProvider.Observer#onEvent(org.opensaml.saml2.metadata.provider.MetadataProvider)
+466      */
+467     
+468     public void onEvent(MetadataProvider provider) {
+469         Set<String> spNameSet = new HashSet<String>(0);
+470         Set<String> idpNameSet = new HashSet<String>(0);
+471 
+472         XMLObject obj; 
+473         try {
+474             obj = provider.getMetadata();
+475         } catch (MetadataProviderException e) {
+476             LOG.error("Couldn't read metadata for " + location, e);
+477             return;
+478         }
+479         if (obj instanceof EntitiesDescriptor) {
+480             EntitiesDescriptor entitiesDescriptor = (EntitiesDescriptor) obj;
+481             
+482             for (EntityDescriptor entity : getAllEntities(entitiesDescriptor)) {
+483                 if (hasSPRole(entity)) {
+484                     spNameSet.add(entity.getEntityID());
+485                 }
+486                 if (hasIdPRole(entity)) {
+487                     idpNameSet.add(entity.getEntityID());
+488                 }
+489             }
+490         } else if (obj instanceof EntityDescriptor) {
+491             EntityDescriptor entity = (EntityDescriptor) obj;
+492             if (hasSPRole(entity)) {
+493                 spNameSet.add(entity.getEntityID());
+494             }
+495             if (hasIdPRole(entity)) {
+496                 idpNameSet.add(entity.getEntityID());
+497             }
+498         } else {
+499             LOG.error("Metadata for " + location + " isn't <EntitiesDescriptor> or <EntityDescriptor>");
+500             return;
+501         }
+502         //
+503         // Now that we have the new set sorted out commit it in
+504         //
+505         this.spNames = spNameSet;
+506         this.idpNames = idpNameSet;
+507         
+508         for (Plugin plugin:plugins.keySet()) {
+509             plugins.put(plugin, plugin.refreshMetadata(provider));
+510         }
+511     }
+512 
+513     /**
+514      * Enumerate all the roles and see whether this entity can be an IdP.
+515      * @param entity
+516      * @return true if one of the roles that entity has is IdPSSO
+517      */
+518     private static boolean hasIdPRole(EntityDescriptor entity) {
+519         List<RoleDescriptor> roles = entity.getRoleDescriptors();
+520         
+521         for (RoleDescriptor role:roles) {
+522            if (role instanceof IDPSSODescriptor) {
+523                //
+524                // So the entity knows how to be some sort of an Idp
+525                //
+526                return true;            
+527            }
+528         }
+529         return false;
+530     }
+531 
+532     /**
+533      * Enumerate all the roles and see whether this entity can be an SP.
+534      * @param entity
+535      * @return true if one of the roles that entity has is SPSSO
+536      */
+537     private static boolean hasSPRole(EntityDescriptor entity) {
+538         List<RoleDescriptor> roles = entity.getRoleDescriptors();
+539         
+540         for (RoleDescriptor role:roles) {
+541            if (role instanceof SPSSODescriptor) {
+542                //
+543                // "I can do that"
+544                //
+545                return true;
+546            }
+547         }
+548         return false;
+549     }
+550 
+551     /**
+552      * Return the idpSite for the given entity name.
+553      * @param idpName the entityname to look up
+554      * @return the associated idpSite
+555      * @throws WayfException
+556      */
+557     protected IdPSite getSite(String idpName) throws WayfException {
+558 
+559         try {
+560             return new IdPSite(metadata.getEntityDescriptor(idpName));
+561         } catch (MetadataProviderException e) {
+562             String s = "Couldn't resolve " + idpName + " in "  + getDisplayName();
+563             LOG.error(s, e);
+564             throw new WayfException(s, e);
+565         }
+566     }
+567     
+568     protected EntityDescriptor getEntity(String name) throws WayfException {
+569         try {
+570             return metadata.getEntityDescriptor(name);
+571         } catch (MetadataProviderException e) {
+572             String s = "Couldn't resolve " + name + " in "  + getDisplayName();
+573             LOG.error(s, e);
+574             throw new WayfException(s, e);
+575         }
+576         
+577     }
+578 }
+579 
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSiteSetEntry.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSiteSetEntry.html index cc3ae38..a921e72 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSiteSetEntry.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/IdPSiteSetEntry.html @@ -1,70 +1,70 @@ - + IdPSiteSetEntry xref
View Javadoc
 
-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  package edu.internet2.middleware.shibboleth.wayf;
-17  
-18  import java.util.Collection;
-19  /**
-20   * This is just a container class for tieing together a set of IdPs to a name - this being what
-21   * is sent to the JSP for display purposes.
-22   */
-23  public class IdPSiteSetEntry {
-24          
-25      /** The metadata provider. */
-26      private final IdPSiteSet siteSet;
-27      
-28      /** The IdPs associated with that metadata provider. */
-29      private final Collection<IdPSite> sites;
-30      
-31      /**
-32       * Create an object which contains just these two objects.
-33       * @param siteSetParam the metadata provider.
-34       * @param sitesParam the list of IdPs. 
-35       */
-36      public IdPSiteSetEntry(IdPSiteSet siteSetParam, Collection<IdPSite> sitesParam) {
-37          this.siteSet = siteSetParam;
-38          this.sites = sitesParam;
-39      }
-40      
-41      /** 
-42       * Return something to display for this set of sites. 
-43       * @return the name as defined in the configuration
-44       */
-45      public String getName() {
-46          return siteSet.getDisplayName();
-47      }
-48      
-49      /**
-50       * Return the list of associated sites. 
-51       * @return a collection of IdPs.
-52       */
-53      public Collection<IdPSite> getSites() {
-54          return sites;
-55      }
-56  
-57  }
+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  package edu.internet2.middleware.shibboleth.wayf;
+17  
+18  import java.util.Collection;
+19  /**
+20   * This is just a container class for tieing together a set of IdPs to a name - this being what
+21   * is sent to the JSP for display purposes.
+22   */
+23  public class IdPSiteSetEntry {
+24          
+25      /** The metadata provider. */
+26      private final IdPSiteSet siteSet;
+27      
+28      /** The IdPs associated with that metadata provider. */
+29      private final Collection<IdPSite> sites;
+30      
+31      /**
+32       * Create an object which contains just these two objects.
+33       * @param siteSetParam the metadata provider.
+34       * @param sitesParam the list of IdPs. 
+35       */
+36      public IdPSiteSetEntry(IdPSiteSet siteSetParam, Collection<IdPSite> sitesParam) {
+37          this.siteSet = siteSetParam;
+38          this.sites = sitesParam;
+39      }
+40      
+41      /** 
+42       * Return something to display for this set of sites. 
+43       * @return the name as defined in the configuration
+44       */
+45      public String getName() {
+46          return siteSet.getDisplayName();
+47      }
+48      
+49      /**
+50       * Return the list of associated sites. 
+51       * @return a collection of IdPs.
+52       */
+53      public Collection<IdPSite> getSites() {
+54          return sites;
+55      }
+56  
+57  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/LogbackConfigurationChangeListener.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/LogbackConfigurationChangeListener.html index e4560ba..3de420f 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/LogbackConfigurationChangeListener.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/LogbackConfigurationChangeListener.html @@ -1,85 +1,85 @@ - + LogbackConfigurationChangeListener xref
View Javadoc
 
-1   /*
-2    * Copyright [2007] [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.wayf;
-18  
-19  import org.opensaml.util.resource.Resource;
-20  import org.opensaml.util.resource.ResourceChangeListener;
-21  import org.opensaml.util.resource.ResourceException;
-22  import org.slf4j.LoggerFactory;
-23  
-24  import ch.qos.logback.classic.LoggerContext;
-25  import ch.qos.logback.classic.joran.JoranConfigurator;
-26  import ch.qos.logback.core.joran.spi.JoranException;
-27  import ch.qos.logback.core.status.ErrorStatus;
-28  import ch.qos.logback.core.status.InfoStatus;
-29  import ch.qos.logback.core.status.StatusManager;
-30  
-31  /** Callback that may be registered for a watch logback configuration file. */
-32  public class LogbackConfigurationChangeListener implements ResourceChangeListener {
-33  
-34      /** {@inheritDoc} */
-35      public void onResourceCreate(Resource resource) {
-36          configureLogback(resource);
-37      }
-38  
-39      /** {@inheritDoc} */
-40      public void onResourceDelete(Resource resource) {
-41          // do nothing
-42      }
-43  
-44      /** {@inheritDoc} */
-45      public void onResourceUpdate(Resource resource) {
-46          configureLogback(resource);
-47      }
-48  
-49      /**
-50       * Configures logback using the given resource as the Joran configuration file.
-51       * 
-52       * @param configuration logback configuration file
-53       */
-54      protected void configureLogback(Resource configuration) {
-55          LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
-56          StatusManager statusManager = loggerContext.getStatusManager();
-57          statusManager.add(new InfoStatus("Loading logging configuration file: " + configuration.getLocation(), this));
-58          try {
-59              loggerContext.reset();
-60              JoranConfigurator configurator = new JoranConfigurator();
-61              configurator.setContext(loggerContext);
-62              configurator.doConfigure(configuration.getInputStream());
-63              loggerContext.start();
-64          } catch (JoranException e) {
-65              statusManager.add(new ErrorStatus("Error loading logging configuration file: "
-66                      + configuration.getLocation(), this, e));
-67          } catch (ResourceException e) {
-68              statusManager.add(new ErrorStatus("Error loading logging configuration file: "
-69                      + configuration.getLocation(), this, e));
-70          }
-71      }
-72  }
+1   /*
+2    * Copyright [2007] [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.wayf;
+18  
+19  import org.opensaml.util.resource.Resource;
+20  import org.opensaml.util.resource.ResourceChangeListener;
+21  import org.opensaml.util.resource.ResourceException;
+22  import org.slf4j.LoggerFactory;
+23  
+24  import ch.qos.logback.classic.LoggerContext;
+25  import ch.qos.logback.classic.joran.JoranConfigurator;
+26  import ch.qos.logback.core.joran.spi.JoranException;
+27  import ch.qos.logback.core.status.ErrorStatus;
+28  import ch.qos.logback.core.status.InfoStatus;
+29  import ch.qos.logback.core.status.StatusManager;
+30  
+31  /** Callback that may be registered for a watch logback configuration file. */
+32  public class LogbackConfigurationChangeListener implements ResourceChangeListener {
+33  
+34      /** {@inheritDoc} */
+35      public void onResourceCreate(Resource resource) {
+36          configureLogback(resource);
+37      }
+38  
+39      /** {@inheritDoc} */
+40      public void onResourceDelete(Resource resource) {
+41          // do nothing
+42      }
+43  
+44      /** {@inheritDoc} */
+45      public void onResourceUpdate(Resource resource) {
+46          configureLogback(resource);
+47      }
+48  
+49      /**
+50       * Configures logback using the given resource as the Joran configuration file.
+51       * 
+52       * @param configuration logback configuration file
+53       */
+54      protected void configureLogback(Resource configuration) {
+55          LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
+56          StatusManager statusManager = loggerContext.getStatusManager();
+57          statusManager.add(new InfoStatus("Loading logging configuration file: " + configuration.getLocation(), this));
+58          try {
+59              loggerContext.reset();
+60              JoranConfigurator configurator = new JoranConfigurator();
+61              configurator.setContext(loggerContext);
+62              configurator.doConfigure(configuration.getInputStream());
+63              loggerContext.start();
+64          } catch (JoranException e) {
+65              statusManager.add(new ErrorStatus("Error loading logging configuration file: "
+66                      + configuration.getLocation(), this, e));
+67          } catch (ResourceException e) {
+68              statusManager.add(new ErrorStatus("Error loading logging configuration file: "
+69                      + configuration.getLocation(), this, e));
+70          }
+71      }
+72  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/LogbackLoggingService.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/LogbackLoggingService.html index 53ef169..c4b3ba3 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/LogbackLoggingService.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/LogbackLoggingService.html @@ -1,77 +1,77 @@ - + LogbackLoggingService xref
View Javadoc
 
-1   /*
-2    * Copyright [2007] [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.wayf;
-18  
-19  import java.util.Timer;
-20  
-21  import org.opensaml.util.resource.FilesystemResource;
-22  import org.opensaml.util.resource.Resource;
-23  import org.opensaml.util.resource.ResourceChangeWatcher;
-24  import org.opensaml.util.resource.ResourceException;
-25  import org.slf4j.LoggerFactory;
-26  
-27  import ch.qos.logback.classic.LoggerContext;
-28  import ch.qos.logback.core.status.ErrorStatus;
-29  import ch.qos.logback.core.status.StatusManager;
-30  
-31  /**
-32   * Simple logging service that watches for logback configuration file changes and reloads the file when a change occurs.
-33   */
-34  public class LogbackLoggingService {
-35      
-36      /** Timer used periodically read the logging configuration file. */
-37      private Timer taskTimer;
-38  
-39      /**
-40       * Constructor.
-41       *
-42       * @param loggingConfigurationFile logback configuration file
-43       * @param pollingFrequency frequency the configuration file should be checked for changes
-44       */
-45      public LogbackLoggingService(String loggingConfigurationFile, long pollingFrequency) {        
-46          LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
-47          StatusManager statusManager = loggerContext.getStatusManager();
-48          
-49          try{
-50              Resource configResource = new FilesystemResource(loggingConfigurationFile);
-51              LogbackConfigurationChangeListener configChangeListener = new LogbackConfigurationChangeListener();
-52              configChangeListener.onResourceCreate(configResource);
-53              
-54              ResourceChangeWatcher resourceWatcher = new ResourceChangeWatcher(configResource, pollingFrequency, 5);
-55              resourceWatcher.getResourceListeners().add(configChangeListener);
-56              
-57              taskTimer = new Timer(true);
-58              taskTimer.schedule(resourceWatcher, 0, pollingFrequency);
-59          }catch(ResourceException e){
-60              statusManager.add(new ErrorStatus("Error loading logging configuration file: "
-61                      + loggingConfigurationFile, this, e));
-62          }
-63      }
-64  }
+1   /*
+2    * Copyright [2007] [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.wayf;
+18  
+19  import java.util.Timer;
+20  
+21  import org.opensaml.util.resource.FilesystemResource;
+22  import org.opensaml.util.resource.Resource;
+23  import org.opensaml.util.resource.ResourceChangeWatcher;
+24  import org.opensaml.util.resource.ResourceException;
+25  import org.slf4j.LoggerFactory;
+26  
+27  import ch.qos.logback.classic.LoggerContext;
+28  import ch.qos.logback.core.status.ErrorStatus;
+29  import ch.qos.logback.core.status.StatusManager;
+30  
+31  /**
+32   * Simple logging service that watches for logback configuration file changes and reloads the file when a change occurs.
+33   */
+34  public class LogbackLoggingService {
+35      
+36      /** Timer used periodically read the logging configuration file. */
+37      private Timer taskTimer;
+38  
+39      /**
+40       * Constructor.
+41       *
+42       * @param loggingConfigurationFile logback configuration file
+43       * @param pollingFrequency frequency the configuration file should be checked for changes
+44       */
+45      public LogbackLoggingService(String loggingConfigurationFile, long pollingFrequency) {        
+46          LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
+47          StatusManager statusManager = loggerContext.getStatusManager();
+48          
+49          try{
+50              Resource configResource = new FilesystemResource(loggingConfigurationFile);
+51              LogbackConfigurationChangeListener configChangeListener = new LogbackConfigurationChangeListener();
+52              configChangeListener.onResourceCreate(configResource);
+53              
+54              ResourceChangeWatcher resourceWatcher = new ResourceChangeWatcher(configResource, pollingFrequency, 5);
+55              resourceWatcher.getResourceListeners().add(configChangeListener);
+56              
+57              taskTimer = new Timer(true);
+58              taskTimer.schedule(resourceWatcher, 0, pollingFrequency);
+59          }catch(ResourceException e){
+60              statusManager.add(new ErrorStatus("Error loading logging configuration file: "
+61                      + loggingConfigurationFile, this, e));
+62          }
+63      }
+64  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/Version.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/Version.html index 0598401..70e40ab 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/Version.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/Version.html @@ -1,44 +1,44 @@ - + Version xref
View Javadoc
 
-1   /*
-2    * Copyright 2008 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.wayf;
-18  
-19  /** Class for printing the version of this library. */
-20  public class Version {
-21  
-22      /**
-23       * Main entry point to program.
-24       * 
-25       * @param args command line arguments
-26       */
-27      public static void main(String[] args) {
-28          Package pkg = Version.class.getPackage();
-29          System.out.println(pkg.getImplementationTitle() + " version " + pkg.getImplementationVersion());
-30      }
-31  }
+1   /*
+2    * Copyright 2008 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.wayf;
+18  
+19  /** Class for printing the version of this library. */
+20  public class Version {
+21  
+22      /**
+23       * Main entry point to program.
+24       * 
+25       * @param args command line arguments
+26       */
+27      public static void main(String[] args) {
+28          Package pkg = Version.class.getPackage();
+29          System.out.println(pkg.getImplementationTitle() + " version " + pkg.getImplementationVersion());
+30      }
+31  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/WayfException.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/WayfException.html index 886c6c8..3d85b39 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/WayfException.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/WayfException.html @@ -1,60 +1,60 @@ - + WayfException xref
View Javadoc
 
-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.wayf;
-18  
-19  
-20  /**
-21   * Signals that an error has occurred while processing a Shibboleth WAYF request.
-22   * 
-23   * @author Walter Hoehn wassa&#064;columbia.edu
-24   */
-25  
-26  public class WayfException extends Exception {
-27  
-28      /** Required serialization constant. */ 
-29      private static final long serialVersionUID = 8426660801169338914L;
-30      
-31      /**
-32       * Constructor with a description and an exception.
-33       * @param s description
-34       * @param e something bad having happened.
-35       */
-36      public WayfException(String s, Throwable e) {
-37          super(s, e);
-38      }
-39  
-40      /**
-41       * Constructure with just a description.
-42       * @param s description
-43       */
-44      public WayfException(String s) {
-45          super(s);
-46      }
-47  }
+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.wayf;
+18  
+19  
+20  /**
+21   * Signals that an error has occurred while processing a Shibboleth WAYF request.
+22   * 
+23   * @author Walter Hoehn wassa&#064;columbia.edu
+24   */
+25  
+26  public class WayfException extends Exception {
+27  
+28      /** Required serialization constant. */ 
+29      private static final long serialVersionUID = 8426660801169338914L;
+30      
+31      /**
+32       * Constructor with a description and an exception.
+33       * @param s description
+34       * @param e something bad having happened.
+35       */
+36      public WayfException(String s, Throwable e) {
+37          super(s, e);
+38      }
+39  
+40      /**
+41       * Constructure with just a description.
+42       * @param s description
+43       */
+44      public WayfException(String s) {
+45          super(s);
+46      }
+47  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/WayfService.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/WayfService.html index b19792a..f6b1195 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/WayfService.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/WayfService.html @@ -1,322 +1,426 @@ - + WayfService xref
View Javadoc
 
-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.wayf;
-18  
-19  import java.io.FileInputStream;
-20  import java.io.FileNotFoundException;
-21  import java.lang.reflect.Constructor;
-22  import java.util.ArrayList;
-23  import java.util.Hashtable;
-24  import java.util.Iterator;
-25  import java.util.List;
-26  
-27  import javax.servlet.GenericServlet;
-28  import javax.servlet.ServletException;
-29  import javax.servlet.http.HttpServlet;
-30  import javax.servlet.http.HttpServletRequest;
-31  import javax.servlet.http.HttpServletResponse;
-32  
-33  import org.opensaml.DefaultBootstrap;
-34  import org.opensaml.xml.parse.BasicParserPool;
-35  import org.opensaml.xml.util.DatatypeHelper;
-36  import org.slf4j.Logger;
-37  import org.slf4j.LoggerFactory;
-38  import org.w3c.dom.Document;
-39  import org.w3c.dom.Element;
-40  import org.w3c.dom.NodeList;
-41  
-42  import edu.internet2.middleware.shibboleth.common.ShibbolethConfigurationException;
-43  import edu.internet2.middleware.shibboleth.wayf.plugins.Plugin;
-44  
-45  /**
-46   * A servlet implementation of the Shibboleth WAYF service. Allows a browser
-47   * user to select from among a group of origin sites. User selection is
-48   * optionally cached and the user is forwarded to the HandleService appropriate
-49   * to his selection.
-50   */
-51  public class WayfService extends HttpServlet {
-52  
-53      /** Required constant for serializaton. */
-54      private static final long serialVersionUID = 5244503011625804940L;
-55      
-56      /** Handle for outputting error and other messages. */
-57      private static final Logger LOG = LoggerFactory.getLogger(WayfService.class.getName());
-58  
-59      /** Where to get the configuration. */
-60      private String wayfConfigFileLocation;
-61      
-62      /** Logging service. */
-63      private LogbackLoggingService logService;
-64  
-65      /** All the different Discovery Services we deal with. */
-66      private List <DiscoveryServiceHandler> discoveryServices = new ArrayList <DiscoveryServiceHandler>();
-67      
-68      /**
-69       * Initialize the Discovery Service.
-70       * 
-71       * @throws ServletException in the case of something bad happening
-72       *  
-73       * @see GenericServlet#init()
-74       */
-75      public void init() throws ServletException {
-76  
-77          super.init();
-78          
-79          wayfConfigFileLocation = getServletContext().getInitParameter("WAYFConfigFileLocation");
-80          if (wayfConfigFileLocation == null) {
-81              wayfConfigFileLocation = getServletConfig().getInitParameter("WAYFConfigFileLocation");
-82          }
-83          if (wayfConfigFileLocation == null) {
-84              wayfConfigFileLocation = "/wayfconfig.xml";
-85          }
-86  
-87  
-88          try {
-89              //
-90              // Initialize logging
-91              //
-92              String wayfLogfile = getServletContext().getInitParameter("WAYFLogConfig");
-93              if (null == wayfLogfile) {
-94                  wayfLogfile = getServletConfig().getInitParameter("WAYFLogConfig");
-95              }
-96              long pollingFrequency = 1000*60*5;
-97              
-98              String wayfLogfilePollFrequency = getServletContext().getInitParameter("WAYFLogConfigPollFrequency");
-99              if (null == wayfLogfilePollFrequency) {
-100                 wayfLogfilePollFrequency = getServletConfig().getInitParameter("WAYFLogConfigPollFrequency");              
-101             }
-102             if(!DatatypeHelper.isEmpty(wayfLogfilePollFrequency)){
-103                 pollingFrequency = Long.parseLong(wayfLogfilePollFrequency);
-104             }
-105             if (wayfLogfile != null) {
-106                 logService = new LogbackLoggingService(wayfLogfile, pollingFrequency);
-107             }
-108 
-109             LOG.info("Logging initiated");
-110             
-111             //
-112             // Initialize OpenSAML 2 library
-113             //
-114             DefaultBootstrap.bootstrap();   
-115         
-116             BasicParserPool parser = new BasicParserPool();
-117             parser.setNamespaceAware(true);
-118             Document doc;
-119             try {
-120                 doc = parser.parse(new FileInputStream(wayfConfigFileLocation));
-121             } catch (FileNotFoundException e) {
-122                 LOG.error("Could not parse " + wayfConfigFileLocation, e);
-123                 throw new ShibbolethConfigurationException("Could not parse " + wayfConfigFileLocation, e);
-124             }            
-125             NodeList itemElements = doc.getDocumentElement().getElementsByTagNameNS(XMLConstants.CONFIG_NS, 
-126                                                                                     "Default");
-127             
-128             HandlerConfig defaultHandlerConfig;
-129             
-130             if (itemElements.getLength() == 1) {
-131                     
-132                 Element element = (Element) itemElements.item(0);
-133                 String attribute = element.getAttribute("location");
-134                 
-135                 if (attribute != null && !attribute.equals("")) {
-136                         
-137                     LOG.error("<Default> element cannot contain a location attribute");
-138                     throw new ShibbolethConfigurationException("<Default> element cannot contain a location attribute");
-139                         
-140                 }
-141     
-142                 attribute = element.getAttribute("default");
-143                 
-144                 if (attribute != null && !attribute.equals("")) {
-145     
-146                     LOG.error("<Default> element cannot contain a default attribute");
-147                     throw new ShibbolethConfigurationException("<Default> element cannot contain a default attribute");
-148                     
-149                 }
-150     
-151                 itemElements = element.getElementsByTagName("Federation");
-152                 
-153                 if (itemElements.getLength() != 0) {
-154                         
-155                     LOG.error("<Default> element cannot contain <Federation> elements");
-156                     throw new ShibbolethConfigurationException("<Default> element cannot contain <Federation> elements");
-157     
-158                 }
-159                                         
-160                 defaultHandlerConfig = new HandlerConfig(element, new HandlerConfig());
-161         
-162             } else if (itemElements.getLength() == 0) {
-163     
-164                     defaultHandlerConfig = new HandlerConfig();
-165             
-166             } else {
-167                     LOG.error("Must specify exactly one <Default> element");
-168                     throw new ShibbolethConfigurationException("Must specify exactly one <Default> element");
-169             }
-170                                           
-171             //
-172             // Load metadata
-173             //
-174             Hashtable <String, IdPSiteSet> siteSets = new Hashtable <String, IdPSiteSet>();
-175     
-176             itemElements = doc.getDocumentElement().getElementsByTagNameNS(XMLConstants.CONFIG_NS,
-177                             "MetadataProvider");
-178             
-179             for (int i = 0; i < itemElements.getLength(); i++) {
-180                     
-181                 Element element = (Element) itemElements.item(i);
-182                 
-183                 IdPSiteSet siteset = new IdPSiteSet(element, parser, defaultHandlerConfig.getWarnOnBadBinding());
-184                 
-185                 siteSets.put(siteset.getIdentifier(), siteset);
-186             }
-187             if (siteSets.size() < 1) {
-188                 LOG.error("No Metadata Provider metadata loaded.");
-189                 throw new ShibbolethConfigurationException("Could not load SAML metadata.");
-190             }
-191             //
-192             // Load plugins
-193             //
-194             
-195             Hashtable <String, Plugin> plugins = new Hashtable <String, Plugin>();
-196     
-197             itemElements = doc.getDocumentElement().getElementsByTagNameNS(XMLConstants.CONFIG_NS,
-198                             "Plugin");
-199             
-200             for (int i = 0; i < itemElements.getLength(); i++) {
-201                     
-202                 Plugin plugin;
-203                 
-204                 Element element = (Element) itemElements.item(i);
-205                 
-206                 String identifier = element.getAttribute("identifier");
-207         
-208                 if (null == identifier || identifier.equals("")) {
-209                         LOG.error("Could not load plugin with no identifier");
-210                         continue;
-211                 }
-212                 
-213                 String className = element.getAttribute("type");
-214                 if (null == className || className.equals("")) {
-215                         LOG.error("Plugin " + identifier + " did not have a valid type");
-216                 }
-217                 //
-218                 // So try to get hold of the plugin
-219                 //
-220                 try {
-221                     Class<Plugin> pluginClass = (Class<Plugin>) Class.forName(className);
-222                     Class[] classParams = {Element.class};
-223                     Constructor<Plugin> pluginConstructor = pluginClass.getConstructor(classParams);
-224                     Object[] constructorParams = {element};
-225                     
-226                     plugin = pluginConstructor.newInstance(constructorParams);
-227                         
-228                 } catch (Exception e) {
-229                     LOG.error("Plugin " + identifier + " could not be loaded ", e);
-230                     continue;
-231                 } 
-232                 
-233                 plugins.put(identifier, plugin);
-234             }
-235             
-236             
-237             //
-238             // Load service handlers
-239             //
-240             itemElements = doc.getDocumentElement().getElementsByTagNameNS(XMLConstants.CONFIG_NS,
-241                             "DiscoveryServiceHandler");
-242             
-243             for (int i = 0; i < itemElements.getLength(); i++) {
-244                     
-245                 discoveryServices.add(new DiscoveryServiceHandler((Element)itemElements.item(i), 
-246                                       siteSets, 
-247                                       plugins, 
-248                                       defaultHandlerConfig));
-249     
-250             }
-251     
-252         } catch (Exception e) {
-253         //
-254         // All other exceptions are from the parsing
-255         //
-256         if (LOG != null) {
-257                 LOG.error("Error parsing DS configuration file.", e);
-258         }
-259         throw new ServletException("Error parsing DS configuration file.", e);
-260     }
-261 
-262     LOG.info("DS initialization completed.");
-263 }
-264 
-265     /**
-266      * Handle an HTTP GET.  Just passes out to the appropriate handler.
-267      * @param req described the request.
-268      * @param res contains the response.
-269      * @see HttpServlet#doGet(HttpServletRequest, HttpServletResponse)
-270      */
-271     public void doGet(HttpServletRequest req, HttpServletResponse res) {
-272             
-273         LOG.info("Handling DS request.");
-274         // Tell the browser not to cache the WAYF page
-275         res.setHeader("Cache-Control", "no-cache");
-276         res.setHeader("Pragma", "no-cache");
-277         res.setDateHeader("Expires", 0);
-278 
-279         DiscoveryServiceHandler serviceHandler = lookupServiceHandler(req); 
-280         
-281         serviceHandler.doGet(req, res);
-282            
-283     }
-284 
-285     /**
-286      * Given a request (an HTTP Get) find the apropriate DiscoveryService (from the name).
-287      * @param req desribed the request
-288      * @return the apropriate DiscoveryService.
-289      */
-290     private DiscoveryServiceHandler lookupServiceHandler(HttpServletRequest req) {
-291 
-292         Iterator<DiscoveryServiceHandler> it = discoveryServices.iterator();
-293         String requestURL = req.getRequestURL().toString(); 
-294         DiscoveryServiceHandler defaultHandler = null;
-295         
-296         while (it.hasNext()) {
-297             DiscoveryServiceHandler handler = it.next();
-298             
-299             if (requestURL.matches(handler.getLocation())) {
-300                 return handler;
-301             }
-302             if (defaultHandler == null || handler.isDefault()) {
-303                 defaultHandler = handler;
-304             }
-305         }
-306         LOG.warn("Could not find Discovery service Handler for " + requestURL);
-307         return defaultHandler;
-308     }    
-309 }
+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.wayf;
+18  
+19  import java.io.FileInputStream;
+20  import java.io.FileNotFoundException;
+21  import java.lang.reflect.Constructor;
+22  import java.util.ArrayList;
+23  import java.util.Hashtable;
+24  import java.util.Iterator;
+25  import java.util.List;
+26  
+27  import javax.servlet.GenericServlet;
+28  import javax.servlet.ServletException;
+29  import javax.servlet.http.HttpServlet;
+30  import javax.servlet.http.HttpServletRequest;
+31  import javax.servlet.http.HttpServletResponse;
+32  import javax.xml.namespace.QName;
+33  
+34  import org.opensaml.DefaultBootstrap;
+35  import org.opensaml.xml.Configuration;
+36  import org.opensaml.xml.XMLObjectBuilderFactory;
+37  import org.opensaml.xml.io.UnmarshallerFactory;
+38  import org.opensaml.xml.parse.BasicParserPool;
+39  import org.opensaml.xml.util.DatatypeHelper;
+40  import org.slf4j.Logger;
+41  import org.slf4j.LoggerFactory;
+42  import org.w3c.dom.Document;
+43  import org.w3c.dom.Element;
+44  import org.w3c.dom.NodeList;
+45  
+46  import edu.internet2.middleware.shibboleth.common.ShibbolethConfigurationException;
+47  import edu.internet2.middleware.shibboleth.wayf.idpdisco.Description;
+48  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DescriptionBuilder;
+49  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DescriptionUnmarshaller;
+50  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DiscoHints;
+51  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DiscoHintsBuilder;
+52  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DiscoHintsUnmarshaller;
+53  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DisplayName;
+54  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DisplayNameBuilder;
+55  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DisplayNameUnmarshaller;
+56  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DomainHint;
+57  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DomainHintBuilder;
+58  import edu.internet2.middleware.shibboleth.wayf.idpdisco.DomainHintUnmarshaller;
+59  import edu.internet2.middleware.shibboleth.wayf.idpdisco.GeolocationHint;
+60  import edu.internet2.middleware.shibboleth.wayf.idpdisco.GeolocationHintBuilder;
+61  import edu.internet2.middleware.shibboleth.wayf.idpdisco.GeolocationHintUnmarshaller;
+62  import edu.internet2.middleware.shibboleth.wayf.idpdisco.IPHint;
+63  import edu.internet2.middleware.shibboleth.wayf.idpdisco.IPHintBuilder;
+64  import edu.internet2.middleware.shibboleth.wayf.idpdisco.IPHintUnmarshaller;
+65  import edu.internet2.middleware.shibboleth.wayf.idpdisco.InformationURL;
+66  import edu.internet2.middleware.shibboleth.wayf.idpdisco.InformationURLBuilder;
+67  import edu.internet2.middleware.shibboleth.wayf.idpdisco.InformationURLUnmarshaller;
+68  import edu.internet2.middleware.shibboleth.wayf.idpdisco.Logo;
+69  import edu.internet2.middleware.shibboleth.wayf.idpdisco.LogoBuilder;
+70  import edu.internet2.middleware.shibboleth.wayf.idpdisco.LogoUnmarshaller;
+71  import edu.internet2.middleware.shibboleth.wayf.idpdisco.PrivacyStatementURL;
+72  import edu.internet2.middleware.shibboleth.wayf.idpdisco.PrivacyStatementURLBuilder;
+73  import edu.internet2.middleware.shibboleth.wayf.idpdisco.PrivacyStatementURLUnmarshaller;
+74  import edu.internet2.middleware.shibboleth.wayf.idpdisco.UIInfo;
+75  import edu.internet2.middleware.shibboleth.wayf.idpdisco.UIInfoBuilder;
+76  import edu.internet2.middleware.shibboleth.wayf.idpdisco.UIInfoUnmarshaller;
+77  import edu.internet2.middleware.shibboleth.wayf.plugins.Plugin;
+78  
+79  /**
+80   * A servlet implementation of the Shibboleth WAYF service. Allows a browser
+81   * user to select from among a group of origin sites. User selection is
+82   * optionally cached and the user is forwarded to the HandleService appropriate
+83   * to his selection.
+84   */
+85  public class WayfService extends HttpServlet {
+86  
+87      /** Required constant for serializaton. */
+88      private static final long serialVersionUID = 5244503011625804940L;
+89      
+90      /** Handle for outputting error and other messages. */
+91      private static final Logger LOG = LoggerFactory.getLogger(WayfService.class.getName());
+92  
+93      /** Where to get the configuration. */
+94      private String wayfConfigFileLocation;
+95      
+96      /** Logging service. */
+97      private LogbackLoggingService logService;
+98  
+99      /** All the different Discovery Services we deal with. */
+100     private List <DiscoveryServiceHandler> discoveryServices = new ArrayList <DiscoveryServiceHandler>();
+101     
+102     /**
+103      * help for init.
+104      */
+105     private void setupOtherSamlTypes(){
+106         QName response;
+107         UnmarshallerFactory uFactory = Configuration.getUnmarshallerFactory();
+108         XMLObjectBuilderFactory bFactory = Configuration.getBuilderFactory();
+109         
+110         //
+111         // The UiInfo type
+112         //
+113         response = new QName(UIInfo.MDUI_NS, Description.DEFAULT_ELEMENT_LOCAL_NAME);
+114         uFactory.registerUnmarshaller(response, new DescriptionUnmarshaller());
+115         bFactory.registerBuilder(response, new DescriptionBuilder());
+116         
+117         response = new QName(UIInfo.MDUI_NS, DisplayName.DEFAULT_ELEMENT_LOCAL_NAME);
+118         uFactory.registerUnmarshaller(response, new DisplayNameUnmarshaller());
+119         bFactory.registerBuilder(response, new DisplayNameBuilder());
+120         
+121         response = new QName(UIInfo.MDUI_NS, InformationURL.DEFAULT_ELEMENT_LOCAL_NAME);
+122         uFactory.registerUnmarshaller(response, new InformationURLUnmarshaller());
+123         bFactory.registerBuilder(response, new InformationURLBuilder());
+124 
+125         response = new QName(UIInfo.MDUI_NS, Logo.DEFAULT_ELEMENT_LOCAL_NAME);
+126         uFactory.registerUnmarshaller(response, new LogoUnmarshaller());
+127         bFactory.registerBuilder(response, new LogoBuilder());
+128 
+129         response = new QName(UIInfo.MDUI_NS, PrivacyStatementURL.DEFAULT_ELEMENT_LOCAL_NAME);
+130         uFactory.registerUnmarshaller(response, new PrivacyStatementURLUnmarshaller());
+131         bFactory.registerBuilder(response, new PrivacyStatementURLBuilder());
+132 
+133         response = new QName(UIInfo.MDUI_NS, UIInfo.DEFAULT_ELEMENT_LOCAL_NAME);
+134         uFactory.registerUnmarshaller(response, new UIInfoUnmarshaller());
+135         bFactory.registerBuilder(response, new UIInfoBuilder());
+136         
+137         //
+138         // The DiscoHint Types
+139         //
+140         response = new QName(DiscoHints.MDUI_NS, IPHint.DEFAULT_ELEMENT_LOCAL_NAME);
+141         uFactory.registerUnmarshaller(response, new IPHintUnmarshaller());
+142         bFactory.registerBuilder(response, new IPHintBuilder());
+143         
+144         response = new QName(DiscoHints.MDUI_NS, GeolocationHint.DEFAULT_ELEMENT_LOCAL_NAME);
+145         uFactory.registerUnmarshaller(response, new GeolocationHintUnmarshaller());
+146         bFactory.registerBuilder(response, new GeolocationHintBuilder());
+147 
+148         response = new QName(DiscoHints.MDUI_NS, DomainHint.DEFAULT_ELEMENT_LOCAL_NAME);
+149         uFactory.registerUnmarshaller(response, new DomainHintUnmarshaller());
+150         bFactory.registerBuilder(response, new DomainHintBuilder());
+151 
+152         response = new QName(DiscoHints.MDUI_NS, DiscoHints.DEFAULT_ELEMENT_LOCAL_NAME);
+153         uFactory.registerUnmarshaller(response, new DiscoHintsUnmarshaller());
+154         bFactory.registerBuilder(response, new DiscoHintsBuilder());
+155     }
+156     
+157 
+158     /**
+159      * Initialize the Discovery Service.
+160      * 
+161      * @throws javax.servlet.ServletException in the case of something bad happening
+162      *  
+163      * @see GenericServlet#init()
+164      */
+165     public void init() throws ServletException {
+166 
+167         String loadMetadataExts = null;
+168         
+169         super.init();
+170         
+171         wayfConfigFileLocation = getServletContext().getInitParameter("WAYFConfigFileLocation");
+172         if (wayfConfigFileLocation == null) {
+173             wayfConfigFileLocation = getServletConfig().getInitParameter("WAYFConfigFileLocation");
+174         }
+175         if (wayfConfigFileLocation == null) {
+176             wayfConfigFileLocation = "/wayfconfig.xml";
+177         }
+178 
+179         loadMetadataExts = getServletContext().getInitParameter("loadMetadataExts");
+180         if (loadMetadataExts == null) {
+181             loadMetadataExts = getServletConfig().getInitParameter("loadMetadataExts");
+182         }
+183 
+184         try {
+185             //
+186             // Initialize logging
+187             //
+188             String wayfLogfile = getServletContext().getInitParameter("WAYFLogConfig");
+189             if (null == wayfLogfile) {
+190                 wayfLogfile = getServletConfig().getInitParameter("WAYFLogConfig");
+191             }
+192             long pollingFrequency = 1000*60*5;
+193             
+194             String wayfLogfilePollFrequency = getServletContext().getInitParameter("WAYFLogConfigPollFrequency");
+195             if (null == wayfLogfilePollFrequency) {
+196                 wayfLogfilePollFrequency = getServletConfig().getInitParameter("WAYFLogConfigPollFrequency");              
+197             }
+198             if(!DatatypeHelper.isEmpty(wayfLogfilePollFrequency)){
+199                 pollingFrequency = Long.parseLong(wayfLogfilePollFrequency);
+200             }
+201             if (wayfLogfile != null) {
+202                 logService = new LogbackLoggingService(wayfLogfile, pollingFrequency);
+203             }
+204 
+205             LOG.info("Logging initiated");
+206             
+207             //
+208             // Initialize OpenSAML 2 library
+209             //
+210             DefaultBootstrap.bootstrap();   
+211         
+212             BasicParserPool parser = new BasicParserPool();
+213             parser.setNamespaceAware(true);
+214             Document doc;
+215             try {
+216                 doc = parser.parse(new FileInputStream(wayfConfigFileLocation));
+217             } catch (FileNotFoundException e) {
+218                 LOG.error("Could not parse " + wayfConfigFileLocation, e);
+219                 throw new ShibbolethConfigurationException("Could not parse " + wayfConfigFileLocation, e);
+220             }            
+221             NodeList itemElements = doc.getDocumentElement().getElementsByTagNameNS(XMLConstants.CONFIG_NS, 
+222                                                                                     "Default");
+223             
+224             HandlerConfig defaultHandlerConfig;
+225             
+226             if (itemElements.getLength() == 1) {
+227                     
+228                 Element element = (Element) itemElements.item(0);
+229                 String attribute = element.getAttribute("location");
+230                 
+231                 if (attribute != null && !attribute.equals("")) {
+232                         
+233                     LOG.error("<Default> element cannot contain a location attribute");
+234                     throw new ShibbolethConfigurationException("<Default> element cannot contain a location attribute");
+235                         
+236                 }
+237     
+238                 attribute = element.getAttribute("default");
+239                 
+240                 if (attribute != null && !attribute.equals("")) {
+241     
+242                     LOG.error("<Default> element cannot contain a default attribute");
+243                     throw new ShibbolethConfigurationException("<Default> element cannot contain a default attribute");
+244                     
+245                 }
+246     
+247                 itemElements = element.getElementsByTagName("Federation");
+248                 
+249                 if (itemElements.getLength() != 0) {
+250                         
+251                     LOG.error("<Default> element cannot contain <Federation> elements");
+252                     throw new ShibbolethConfigurationException("<Default> element cannot contain <Federation> elements");
+253     
+254                 }
+255                                         
+256                 defaultHandlerConfig = new HandlerConfig(element, new HandlerConfig());
+257         
+258             } else if (itemElements.getLength() == 0) {
+259     
+260                     defaultHandlerConfig = new HandlerConfig();
+261             
+262             } else {
+263                     LOG.error("Must specify exactly one <Default> element");
+264                     throw new ShibbolethConfigurationException("Must specify exactly one <Default> element");
+265             }
+266             
+267             //
+268             // As a trial for V2, load metadata extensions - if enabled
+269             //
+270             if (loadMetadataExts != null) {
+271                 LOG.debug("Setting up <UIInfo> and <DiscoHints> parsers - UNSUPPORTED OPERATION");
+272                 setupOtherSamlTypes();
+273             }
+274                                           
+275             //
+276             // Load metadata
+277             //
+278             Hashtable <String, IdPSiteSet> siteSets = new Hashtable <String, IdPSiteSet>();
+279     
+280             itemElements = doc.getDocumentElement().getElementsByTagNameNS(XMLConstants.CONFIG_NS,
+281                             "MetadataProvider");
+282             
+283             for (int i = 0; i < itemElements.getLength(); i++) {
+284                     
+285                 Element element = (Element) itemElements.item(i);
+286                 
+287                 IdPSiteSet siteset = new IdPSiteSet(element, parser, defaultHandlerConfig.getWarnOnBadBinding());
+288                 
+289                 siteSets.put(siteset.getIdentifier(), siteset);
+290             }
+291             if (siteSets.size() < 1) {
+292                 LOG.error("No Metadata Provider metadata loaded.");
+293                 throw new ShibbolethConfigurationException("Could not load SAML metadata.");
+294             }
+295             //
+296             // Load plugins
+297             //
+298             
+299             Hashtable <String, Plugin> plugins = new Hashtable <String, Plugin>();
+300     
+301             itemElements = doc.getDocumentElement().getElementsByTagNameNS(XMLConstants.CONFIG_NS,
+302                             "Plugin");
+303             
+304             for (int i = 0; i < itemElements.getLength(); i++) {
+305                     
+306                 Plugin plugin;
+307                 
+308                 Element element = (Element) itemElements.item(i);
+309                 
+310                 String identifier = element.getAttribute("identifier");
+311         
+312                 if (null == identifier || identifier.equals("")) {
+313                         LOG.error("Could not load plugin with no identifier");
+314                         continue;
+315                 }
+316                 
+317                 String className = element.getAttribute("type");
+318                 if (null == className || className.equals("")) {
+319                         LOG.error("Plugin " + identifier + " did not have a valid type");
+320                 }
+321                 //
+322                 // So try to get hold of the plugin
+323                 //
+324                 try {
+325                     Class<Plugin> pluginClass = (Class<Plugin>) Class.forName(className);
+326                     Class[] classParams = {Element.class};
+327                     Constructor<Plugin> pluginConstructor = pluginClass.getConstructor(classParams);
+328                     Object[] constructorParams = {element};
+329                     
+330                     plugin = pluginConstructor.newInstance(constructorParams);
+331                         
+332                 } catch (Exception e) {
+333                     LOG.error("Plugin " + identifier + " could not be loaded ", e);
+334                     continue;
+335                 } 
+336                 
+337                 plugins.put(identifier, plugin);
+338             }
+339             
+340             
+341             //
+342             // Load service handlers
+343             //
+344             itemElements = doc.getDocumentElement().getElementsByTagNameNS(XMLConstants.CONFIG_NS,
+345                             "DiscoveryServiceHandler");
+346             
+347             for (int i = 0; i < itemElements.getLength(); i++) {
+348                     
+349                 discoveryServices.add(new DiscoveryServiceHandler((Element)itemElements.item(i), 
+350                                       siteSets, 
+351                                       plugins, 
+352                                       defaultHandlerConfig));
+353     
+354             }
+355     
+356         } catch (Exception e) {
+357         //
+358         // All other exceptions are from the parsing
+359         //
+360         if (LOG != null) {
+361                 LOG.error("Error parsing DS configuration file.", e);
+362         }
+363         throw new ServletException("Error parsing DS configuration file.", e);
+364     }
+365 
+366     LOG.info("DS initialization completed.");
+367 }
+368 
+369     /**
+370      * Handle an HTTP GET.  Just passes out to the appropriate handler.
+371      * @param req described the request.
+372      * @param res contains the response.
+373      * @see HttpServlet#doGet(HttpServletRequest, HttpServletResponse)
+374      */
+375     public void doGet(HttpServletRequest req, HttpServletResponse res) {
+376             
+377         LOG.info("Handling DS request.");
+378         // Tell the browser not to cache the WAYF page
+379         res.setHeader("Cache-Control", "no-cache");
+380         res.setHeader("Pragma", "no-cache");
+381         res.setDateHeader("Expires", 0);
+382 
+383         DiscoveryServiceHandler serviceHandler = lookupServiceHandler(req); 
+384         
+385         serviceHandler.doGet(req, res);
+386            
+387     }
+388 
+389     /**
+390      * Given a request (an HTTP Get) find the apropriate DiscoveryService (from the name).
+391      * @param req desribed the request
+392      * @return the apropriate DiscoveryService.
+393      */
+394     private DiscoveryServiceHandler lookupServiceHandler(HttpServletRequest req) {
+395 
+396         Iterator<DiscoveryServiceHandler> it = discoveryServices.iterator();
+397         String requestURL = req.getRequestURL().toString(); 
+398         DiscoveryServiceHandler defaultHandler = null;
+399         
+400         while (it.hasNext()) {
+401             DiscoveryServiceHandler handler = it.next();
+402             
+403             if (requestURL.matches(handler.getLocation())) {
+404                 return handler;
+405             }
+406             if (defaultHandler == null || handler.isDefault()) {
+407                 defaultHandler = handler;
+408             }
+409         }
+410         LOG.warn("Could not find Discovery service Handler for " + requestURL);
+411         return defaultHandler;
+412     }    
+413 }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/XMLConstants.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/XMLConstants.html index 9be262d..f0b3a1b 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/XMLConstants.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/XMLConstants.html @@ -1,46 +1,49 @@ - + XMLConstants xref
View Javadoc
 
-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.wayf;
-18  
-19  /**
-20   * Holder class for various XML constants (namespaces and so forth).
-21   */
-22  public class XMLConstants {
-23  
-24      /** Shibboleth XML namespace. */
-25      public static final String SHIB_NS = "urn:mace:shibboleth:1.0";
-26  
-27      /** SSO Binding name. */
-28      public static final String IDP_SSO_BINDING = "urn:mace:shibboleth:1.0:profiles:AuthnRequest";
-29  
-30      /** Namespace for Discovery Service configuration. */
-31      public static final String CONFIG_NS = "urn:mace:shibboleth:wayf:config:1.0";
-32      
-33  }
+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.wayf;
+18  
+19  /**
+20   * Holder class for various XML constants (namespaces and so forth).
+21   */
+22  public class XMLConstants {
+23  
+24      /** Shibboleth XML namespace. */
+25      public static final String SHIB_NS = "urn:mace:shibboleth:1.0";
+26  
+27      /** SSO Binding name. */
+28      public static final String IDP_SSO_BINDING = "urn:mace:shibboleth:1.0:profiles:AuthnRequest";
+29  
+30      /** Namespace for Discovery Service configuration. */
+31      public static final String CONFIG_NS = "urn:mace:shibboleth:wayf:config:1.0";
+32      
+33      /** SAML2 protocol */
+34      public static final String SALM2_PROTOCOL = "urn:oasis:names:tc:SAML:2.0:protocol";
+35      
+36  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/Description.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/Description.html new file mode 100644 index 0000000..751d176 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/Description.html @@ -0,0 +1,71 @@ + + + + +Description xref + + + +
View Javadoc
+
+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.wayf.idpdisco;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.opensaml.common.SAMLObject;
+22  import org.opensaml.common.xml.SAMLConstants;
+23  import org.opensaml.saml2.metadata.LocalizedString;
+24  
+25  /**
+26   * DisplayName.
+27   *
+28   * See IdP Discovery and Login UI Metadata Extension Profile.
+29   *
+30   * @author Rod Widdowson August 2010
+31   * 
+32   * Reflects the Description in the IdP Discovery and Login UI Metadata Extension Profile.
+33   * 
+34   */
+35  public interface Description extends LocalizedName {
+36  
+37      /** Element local name. */
+38      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "Description";
+39      
+40      /** Default element name. */
+41      public static final QName DEFAULT_ELEMENT_NAME = new QName(UIInfo.MDUI_NS, 
+42              DEFAULT_ELEMENT_LOCAL_NAME, UIInfo.MDUI_PREFIX);
+43      
+44      /**
+45       * Gets the description of the EndPoint.
+46       * 
+47       * @return the description of the EndPoint
+48       */
+49      public LocalizedString getDescription();
+50      
+51      /**
+52       * Sets the description of the EndPoint.
+53       * 
+54       * @param newDescription description of the EndPoint
+55       */
+56      public void setDescription(LocalizedString newDescription);
+57  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionBuilder.html new file mode 100644 index 0000000..c803e3e --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionBuilder.html @@ -0,0 +1,58 @@ + + + + +DescriptionBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+20  
+21  /**
+22   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.Description} objects.
+23   * @author Rod Widdowson
+24   */
+25  public class DescriptionBuilder extends AbstractSAMLObjectBuilder<Description> {
+26      /**
+27       * Constructor.
+28       */
+29      public DescriptionBuilder() {
+30  
+31      }
+32  
+33      /** {@inheritDoc} */
+34      public Description buildObject() {
+35          return buildObject(UIInfo.MDUI_NS, 
+36                             Description.DEFAULT_ELEMENT_LOCAL_NAME, 
+37                             UIInfo.MDUI_PREFIX);
+38      }
+39  
+40      /** {@inheritDoc} */
+41      public Description buildObject(String namespaceURI, String localName, String namespacePrefix) {
+42          return new DescriptionImpl(namespaceURI, localName, namespacePrefix);
+43      }
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionImpl.html new file mode 100644 index 0000000..7f6d927 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionImpl.html @@ -0,0 +1,61 @@ + + + + +DescriptionImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.saml2.metadata.LocalizedString;
+20  
+21  /**
+22   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.Description}.
+23   */
+24  public class DescriptionImpl extends LocalizedNameImpl implements Description {
+25  
+26      /**
+27       * Constructor.
+28       * 
+29       * @param namespaceURI the namespaceURI
+30       * @param elementLocalName the elementLocalName
+31       * @param namespacePrefix the namespacePrefix
+32       */
+33      protected DescriptionImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+34          super(namespaceURI, elementLocalName, namespacePrefix);
+35      }
+36  
+37      /** {@inheritDoc} */
+38      public LocalizedString getDescription() {
+39          return getName();
+40      }
+41  
+42      /** {@inheritDoc} */
+43      public void setDescription(LocalizedString newDescription) {
+44          setName(newDescription);
+45      }
+46  
+47  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionMarshaller.html new file mode 100644 index 0000000..3f7e507 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionMarshaller.html @@ -0,0 +1,46 @@ + + + + +DescriptionMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.xml.XMLObject;
+22  import org.opensaml.xml.io.MarshallingException;
+23  import org.opensaml.xml.util.XMLHelper;
+24  import org.w3c.dom.Attr;
+25  import org.w3c.dom.Element;
+26  
+27  /**
+28   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.Description} objects.
+29   */
+30  public class DescriptionMarshaller extends LocalizedNameMarshaller {
+31  
+32  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionUnmarshaller.html new file mode 100644 index 0000000..c35d6c3 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DescriptionUnmarshaller.html @@ -0,0 +1,39 @@ + + + + +DescriptionUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  
+20  /**
+21   * A thread-safe unmarshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.Description} objects.
+22   */
+23  public class DescriptionUnmarshaller extends LocalizedNameUnmarshaller {
+24  
+25  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHints.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHints.html new file mode 100644 index 0000000..d185fa6 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHints.html @@ -0,0 +1,82 @@ + + + + +DiscoHints xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import java.util.List;
+20  
+21  import javax.xml.namespace.QName;
+22  
+23  import org.opensaml.common.SAMLObject;
+24  
+25  /**
+26   * See IdP Discovery and Login UI Metadata Extension Profile.
+27   * 
+28   * @author RDW 27/Aug/2010
+29   * 
+30   * Reflects the DiscoHints 
+31   */
+32  public interface DiscoHints extends SAMLObject {
+33      /** Namespace for Discovery Service metadata extensions. */
+34      public static final String MDUI_NS = "urn:oasis:names:tc:SAML:metadata:ui";
+35  
+36      /** Default namespace prefix used by this library. */
+37      public static final String  MDUI_PREFIX = "mdui";
+38  
+39      /** Name of the element inside the Extensions. */
+40      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "DiscoHints";
+41  
+42      /** Default element name. */
+43      public static final QName DEFAULT_ELEMENT_NAME = new QName(MDUI_NS, DEFAULT_ELEMENT_LOCAL_NAME,
+44              MDUI_PREFIX);
+45      
+46      /** 
+47       * The <IPHint> element specifies a set of [CIDR] blocks associated with, 
+48       *  or serviced by, the entity.  Both IPv4 and IPv6 CIDR blocks MUST be supported.
+49       * 
+50       * @return hints
+51       */
+52      public List <IPHint> getIPHints();
+53      
+54      /** The <DomainHint> element specifies a set of DNS domains associated with, 
+55       * or serviced by, the entity.
+56       * @return hints.
+57       */
+58      public List <DomainHint> getDomainHints();
+59      
+60      /** The <GeolocationHint> element specifies the geographic coordinates associated 
+61       *  with, or serviced by, the entity.  Coordinates are given in decimal form using
+62       *  the World Geodetic System (2d) coordinate system.
+63       * 
+64       * @return hints
+65       */
+66      public List <GeolocationHint> getGeolocationHints();
+67      
+68  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsBuilder.html new file mode 100644 index 0000000..5f2cb8f --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsBuilder.html @@ -0,0 +1,57 @@ + + + + +DiscoHintsBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+17  
+18  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+19  
+20  /**
+21   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.UIInfo}.
+22   */
+23  public class DiscoHintsBuilder extends AbstractSAMLObjectBuilder<DiscoHints> {
+24  
+25      /**
+26       * Constructor.
+27       */
+28      public DiscoHintsBuilder() {
+29  
+30      }
+31  
+32      /** {@inheritDoc} */
+33      public DiscoHints buildObject() {
+34          return buildObject(DiscoHints.MDUI_NS, 
+35                             DiscoHints.DEFAULT_ELEMENT_LOCAL_NAME, 
+36                             DiscoHints.MDUI_PREFIX);
+37      }
+38  
+39      /** {@inheritDoc} */
+40      public DiscoHints buildObject(String namespaceURI, String localName, String namespacePrefix) {
+41          return new DiscoHintsImpl(namespaceURI, localName, namespacePrefix);
+42      }
+43  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsImpl.html new file mode 100644 index 0000000..7147fe8 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsImpl.html @@ -0,0 +1,94 @@ + + + + +DiscoHintsImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import java.util.ArrayList;
+20  import java.util.List;
+21  
+22  import org.opensaml.common.impl.AbstractSAMLObject;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.util.XMLObjectChildrenList;
+25  
+26  /**
+27   *  Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.DiscHints}.
+28   * @author Rod Widdowson
+29   *
+30   */
+31  public class DiscoHintsImpl extends AbstractSAMLObject implements DiscoHints {
+32  
+33      /** DNS Domain hints. */
+34      private final XMLObjectChildrenList<DomainHint> domainHints;
+35      
+36      /** IP Address hints. */
+37      private final XMLObjectChildrenList<IPHint> iPHints;
+38  
+39      /** GeoLocation hints. */
+40      private final XMLObjectChildrenList<GeolocationHint> geoHints;
+41      
+42      /**
+43       * Constructor.
+44       * @param namespaceURI namespaceURI
+45       * @param elementLocalName elementLocalName
+46       * @param namespacePrefix namespacePrefix
+47       */
+48      
+49      protected DiscoHintsImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+50          super(namespaceURI, elementLocalName, namespacePrefix);
+51          domainHints = new XMLObjectChildrenList<DomainHint>(this);
+52          iPHints = new XMLObjectChildrenList<IPHint>(this);
+53          geoHints = new XMLObjectChildrenList<GeolocationHint>(this);
+54      }
+55  
+56      /** {@inheritDoc} */
+57      public List<DomainHint> getDomainHints() {
+58          return domainHints;
+59      }
+60  
+61      /** {@inheritDoc} */
+62      public List<GeolocationHint> getGeolocationHints() {
+63          return geoHints;
+64      }
+65  
+66      /** {@inheritDoc} */
+67      public List<IPHint> getIPHints() {
+68          return iPHints;
+69      }
+70  
+71      /** {@inheritDoc} */
+72      public List<XMLObject> getOrderedChildren() {
+73          ArrayList<XMLObject> children = new ArrayList<XMLObject>();
+74          
+75          children.addAll(domainHints);
+76          children.addAll(iPHints);
+77          children.addAll(geoHints);
+78          return children;
+79      }
+80  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsMarshaller.html new file mode 100644 index 0000000..ec12bf6 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsMarshaller.html @@ -0,0 +1,41 @@ + + + + +DiscoHintsMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  
+18  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+19  
+20  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+21  
+22  /**
+23   * A thread safe Marshaller for {@link @linkedu.internet2.middleware.shibboleth.wayf.idpdisco.DiscoHints} objects.
+24   */
+25  public class DiscoHintsMarshaller extends AbstractSAMLObjectMarshaller {
+26  
+27  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsUnmarshaller.html new file mode 100644 index 0000000..5145cab --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DiscoHintsUnmarshaller.html @@ -0,0 +1,58 @@ + + + + +DiscoHintsUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
+20  import org.opensaml.xml.XMLObject;
+21  import org.opensaml.xml.io.UnmarshallingException;
+22  
+23  /**
+24   * A thread-safe Unmarshaller for {@link org.opensaml.saml2.metadata.DiscoHints} objects.
+25   */
+26  public class DiscoHintsUnmarshaller extends AbstractSAMLObjectUnmarshaller {
+27  
+28      /** {@inheritDoc} */
+29      protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
+30              throws UnmarshallingException {
+31          DiscoHints info = (DiscoHints) parentSAMLObject;
+32  
+33          if (childSAMLObject instanceof IPHint) {
+34              info.getIPHints().add((IPHint) childSAMLObject);
+35          } else if (childSAMLObject instanceof DomainHint) {
+36              info.getDomainHints().add((DomainHint) childSAMLObject);
+37          } else if (childSAMLObject instanceof GeolocationHint) {
+38              info.getGeolocationHints().add((GeolocationHint) childSAMLObject);
+39          } else {
+40              super.processChildElement(parentSAMLObject, childSAMLObject);
+41          }
+42      }
+43  
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayName.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayName.html new file mode 100644 index 0000000..fbdc318 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayName.html @@ -0,0 +1,70 @@ + + + + +DisplayName xref + + + +
View Javadoc
+
+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.wayf.idpdisco;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.opensaml.common.SAMLObject;
+22  import org.opensaml.saml2.metadata.LocalizedString;
+23  import org.opensaml.xml.LangBearing;
+24  
+25  /**
+26   * DisplayName.
+27   *
+28   * See IdP Discovery and Login UI Metadata Extension Profile.
+29   *
+30   * @author Rod Widdowson August 2010
+31   * 
+32   * Reflects the UINFO in the IdP Discovery and Login UI Metadata Extension Profile/
+33   * */
+34  public interface DisplayName extends LocalizedName {
+35  
+36      /** Element local name. */
+37      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "DisplayName";
+38      
+39      /** Default element name. */
+40      public static final QName DEFAULT_ELEMENT_NAME = new QName(UIInfo.MDUI_NS, 
+41              DEFAULT_ELEMENT_LOCAL_NAME, UIInfo.MDUI_PREFIX);
+42      
+43      /**
+44       * Gets the name of the EndPoint.
+45       * 
+46       * @return the name of the EndPoint
+47       */
+48      public LocalizedString getName();
+49      
+50      /**
+51       * Sets the EndPoint name.
+52       * 
+53       * @param newName EndPoint name
+54       */
+55      public void setName(LocalizedString newName);
+56  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameBuilder.html new file mode 100644 index 0000000..e04cbfd --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameBuilder.html @@ -0,0 +1,58 @@ + + + + +DisplayNameBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+20  
+21  /**
+22   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.DisplayName} objects.
+23   */
+24  public class DisplayNameBuilder extends AbstractSAMLObjectBuilder<DisplayName> {
+25  
+26      /**
+27       * Constructor.
+28       */
+29      public DisplayNameBuilder() {
+30  
+31      }
+32  
+33      /** {@inheritDoc} */
+34      public DisplayName buildObject() {
+35          return buildObject(UIInfo.MDUI_NS, 
+36                             DisplayName.DEFAULT_ELEMENT_LOCAL_NAME, 
+37                             UIInfo.MDUI_PREFIX);
+38      }
+39  
+40      /** {@inheritDoc} */
+41      public DisplayName buildObject(String namespaceURI, String localName, String namespacePrefix) {
+42          return new DisplayNameImpl(namespaceURI, localName, namespacePrefix);
+43      }
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameImpl.html new file mode 100644 index 0000000..6f17732 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameImpl.html @@ -0,0 +1,48 @@ + + + + +DisplayNameImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+17  
+18  
+19  /**
+20   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.DisplayName}.
+21   */
+22  public class DisplayNameImpl extends LocalizedNameImpl implements DisplayName {
+23  
+24      /**
+25       * Constructor.
+26       * 
+27       * @param namespaceURI the namespaceURI
+28       * @param elementLocalName the elementLocalName
+29       * @param namespacePrefix the namespacePrefix
+30       */
+31      protected DisplayNameImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+32          super(namespaceURI, elementLocalName, namespacePrefix);
+33      }
+34  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameMarshaller.html new file mode 100644 index 0000000..c3558c3 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameMarshaller.html @@ -0,0 +1,46 @@ + + + + +DisplayNameMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.xml.XMLObject;
+22  import org.opensaml.xml.io.MarshallingException;
+23  import org.opensaml.xml.util.XMLHelper;
+24  import org.w3c.dom.Attr;
+25  import org.w3c.dom.Element;
+26  
+27  /**
+28   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.DisplayName} objects.
+29   */
+30  public class DisplayNameMarshaller extends LocalizedNameMarshaller {
+31  
+32  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameUnmarshaller.html new file mode 100644 index 0000000..229b78f --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DisplayNameUnmarshaller.html @@ -0,0 +1,38 @@ + + + + +DisplayNameUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  /**
+20   * A thread-safe unmarshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.DisplayName} objects.
+21   */
+22  public class DisplayNameUnmarshaller extends LocalizedNameUnmarshaller {
+23  
+24  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHint.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHint.html new file mode 100644 index 0000000..9af8e6e --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHint.html @@ -0,0 +1,69 @@ + + + + +DomainHint xref + + + +
View Javadoc
+
+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.wayf.idpdisco;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.opensaml.common.SAMLObject;
+22  
+23  /**
+24   * IPHint.
+25   *
+26   * See IdP Discovery and Login UI Metadata Extension Profile.
+27   *
+28   * @author Rod Widdowson August 2010
+29   * 
+30   * The <DomainHint> element specifies a set of DNS domains associated with, 
+31   * or serviced by, the entity. 
+32   */
+33  public interface DomainHint extends SAMLObject {
+34  
+35      /** Element local name. */
+36      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "DomainHint";
+37      
+38      /** Default element name. */
+39      public static final QName DEFAULT_ELEMENT_NAME = new QName(DiscoHints.MDUI_NS, 
+40              DEFAULT_ELEMENT_LOCAL_NAME, DiscoHints.MDUI_PREFIX);
+41      
+42      /**
+43       * Gets the Hint.
+44       * 
+45       * @return the Hint
+46       */
+47      public String getHint();
+48      
+49      /**
+50       * Sets the hint.
+51       * 
+52       * @param newHint hint
+53       */
+54      public void setHint(String newHint);
+55  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintBuilder.html new file mode 100644 index 0000000..09dd715 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintBuilder.html @@ -0,0 +1,58 @@ + + + + +DomainHintBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+20  
+21  /**
+22   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.DomainHint} objects.
+23   */
+24  public class DomainHintBuilder extends AbstractSAMLObjectBuilder<DomainHint> {
+25  
+26      /**
+27       * Constructor.
+28       */
+29      public DomainHintBuilder() {
+30  
+31      }
+32  
+33      /** {@inheritDoc} */
+34      public DomainHint buildObject() {
+35          return buildObject(DiscoHints.MDUI_NS, 
+36                             DomainHint.DEFAULT_ELEMENT_LOCAL_NAME, 
+37                             DiscoHints.MDUI_PREFIX);
+38      }
+39  
+40      /** {@inheritDoc} */
+41      public DomainHint buildObject(String namespaceURI, String localName, String namespacePrefix) {
+42          return new DomainHintImpl(namespaceURI, localName, namespacePrefix);
+43      }
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintImpl.html new file mode 100644 index 0000000..2103a68 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintImpl.html @@ -0,0 +1,73 @@ + + + + +DomainHintImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+17  
+18  import java.util.List;
+19  
+20  import org.opensaml.common.impl.AbstractSAMLObject;
+21  import org.opensaml.xml.XMLObject;
+22  
+23  /**
+24   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.DomainHint}.
+25   */
+26  public class DomainHintImpl extends AbstractSAMLObject implements DomainHint{
+27  
+28      /**
+29       * local storage.
+30       */
+31      private String hint;
+32      
+33      /**
+34       * Constructor.
+35       * 
+36       * @param namespaceURI the namespaceURI
+37       * @param elementLocalName the elementLocalName
+38       * @param namespacePrefix the namespacePrefix
+39       */
+40      protected DomainHintImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+41          super(namespaceURI, elementLocalName, namespacePrefix);
+42      }
+43  
+44      /** {@inheritDoc} */
+45      public String getHint() {
+46          return hint;
+47      }
+48  
+49      /** {@inheritDoc} */
+50      public void setHint(String newHint) {
+51          hint = prepareForAssignment(hint, newHint);
+52      }
+53  
+54      /** {@inheritDoc} */
+55      public List<XMLObject> getOrderedChildren() {
+56          return null;
+57      }
+58  
+59  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintMarshaller.html new file mode 100644 index 0000000..ef9f71e --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintMarshaller.html @@ -0,0 +1,52 @@ + + + + +DomainHintMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+20  import org.opensaml.xml.XMLObject;
+21  import org.opensaml.xml.io.MarshallingException;
+22  import org.opensaml.xml.util.XMLHelper;
+23  import org.w3c.dom.Element;
+24  
+25  /**
+26   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.DomainHint} objects.
+27   */
+28  public class DomainHintMarshaller extends AbstractSAMLObjectMarshaller {
+29  
+30      /** {@inheritDoc} */
+31      protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
+32          DomainHint name = (DomainHint) samlObject;
+33  
+34          if (name.getHint() != null) {
+35              XMLHelper.appendTextContent(domElement, name.getHint());
+36          }
+37      }
+38  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintUnmarshaller.html new file mode 100644 index 0000000..c518634 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/DomainHintUnmarshaller.html @@ -0,0 +1,52 @@ + + + + +DomainHintUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.saml2.metadata.LocalizedString;
+22  import org.opensaml.xml.LangBearing;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.io.UnmarshallingException;
+25  import org.w3c.dom.Attr;
+26  
+27  /**
+28   * A thread-safe unmarshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.DomainHint} objects.
+29   */
+30  public class DomainHintUnmarshaller extends AbstractSAMLObjectUnmarshaller {
+31  
+32      /** {@inheritDoc} */
+33      protected void processElementContent(XMLObject samlObject, String elementContent) {
+34          DomainHint hint = (DomainHint) samlObject;
+35  
+36          hint.setHint(elementContent);
+37      }
+38  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHint.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHint.html new file mode 100644 index 0000000..9d47145 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHint.html @@ -0,0 +1,70 @@ + + + + +GeolocationHint xref + + + +
View Javadoc
+
+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.wayf.idpdisco;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.opensaml.common.SAMLObject;
+22  
+23  /**
+24   * IPHint.
+25   *
+26   * See IdP Discovery and Login UI Metadata Extension Profile.
+27   *
+28   * @author Rod Widdowson August 2010
+29   * 
+30   * The <GeolocationHint> element specifies the geographic coordinates associated 
+31   *  with, or serviced by, the entity.  Coordinates are given in decimal form using
+32   *  the World Geodetic System (2d) coordinate system.
+33   */
+34  public interface GeolocationHint extends SAMLObject {
+35  
+36      /** Element local name. */
+37      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "GeolocationHint";
+38      
+39      /** Default element name. */
+40      public static final QName DEFAULT_ELEMENT_NAME = new QName(DiscoHints.MDUI_NS, 
+41              DEFAULT_ELEMENT_LOCAL_NAME, DiscoHints.MDUI_PREFIX);
+42      
+43      /**
+44       * Gets the Hint.
+45       * 
+46       * @return the Hint
+47       */
+48      public String getHint();
+49      
+50      /**
+51       * Sets the hint.
+52       * 
+53       * @param newHint hint
+54       */
+55      public void setHint(String newHint);
+56  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintBuilder.html new file mode 100644 index 0000000..583027f --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintBuilder.html @@ -0,0 +1,58 @@ + + + + +GeolocationHintBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+20  
+21  /**
+22   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.GeolocationHint} objects.
+23   */
+24  public class GeolocationHintBuilder extends AbstractSAMLObjectBuilder<GeolocationHint> {
+25  
+26      /**
+27       * Constructor.
+28       */
+29      public GeolocationHintBuilder() {
+30  
+31      }
+32  
+33      /** {@inheritDoc} */
+34      public GeolocationHint buildObject() {
+35          return buildObject(DiscoHints.MDUI_NS, 
+36                             GeolocationHint.DEFAULT_ELEMENT_LOCAL_NAME, 
+37                             DiscoHints.MDUI_PREFIX);
+38      }
+39  
+40      /** {@inheritDoc} */
+41      public GeolocationHint buildObject(String namespaceURI, String localName, String namespacePrefix) {
+42          return new GeolocationHintImpl(namespaceURI, localName, namespacePrefix);
+43      }
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintImpl.html new file mode 100644 index 0000000..722c539 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintImpl.html @@ -0,0 +1,76 @@ + + + + +GeolocationHintImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+17  
+18  import java.util.List;
+19  
+20  import org.opensaml.common.impl.AbstractSAMLObject;
+21  import org.opensaml.saml2.metadata.LocalizedString;
+22  import org.opensaml.xml.LangBearing;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.util.DatatypeHelper;
+25  
+26  /**
+27   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.GeolocationHint}.
+28   */
+29  public class GeolocationHintImpl extends AbstractSAMLObject implements GeolocationHint {
+30  
+31      /**
+32       * local storage.
+33       */
+34      private String hint;
+35      
+36      /**
+37       * Constructor.
+38       * 
+39       * @param namespaceURI the namespaceURI
+40       * @param elementLocalName the elementLocalName
+41       * @param namespacePrefix the namespacePrefix
+42       */
+43      protected GeolocationHintImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+44          super(namespaceURI, elementLocalName, namespacePrefix);
+45      }
+46  
+47      /** {@inheritDoc} */
+48      public String getHint() {
+49          return hint;
+50      }
+51  
+52      /** {@inheritDoc} */
+53      public void setHint(String newHint) {
+54          hint = prepareForAssignment(hint, newHint);
+55      }
+56  
+57      /** {@inheritDoc} */
+58      public List<XMLObject> getOrderedChildren() {
+59          return null;
+60      }
+61  
+62  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintMarshaller.html new file mode 100644 index 0000000..b8b9b72 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintMarshaller.html @@ -0,0 +1,52 @@ + + + + +GeolocationHintMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+20  import org.opensaml.xml.XMLObject;
+21  import org.opensaml.xml.io.MarshallingException;
+22  import org.opensaml.xml.util.XMLHelper;
+23  import org.w3c.dom.Element;
+24  
+25  /**
+26   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.GeolocationHint} objects.
+27   */
+28  public class GeolocationHintMarshaller extends AbstractSAMLObjectMarshaller {
+29  
+30      /** {@inheritDoc} */
+31      protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
+32          GeolocationHint name = (GeolocationHint) samlObject;
+33  
+34          if (name.getHint() != null) {
+35              XMLHelper.appendTextContent(domElement, name.getHint());
+36          }
+37      }
+38  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintUnmarshaller.html new file mode 100644 index 0000000..b1f8a24 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/GeolocationHintUnmarshaller.html @@ -0,0 +1,47 @@ + + + + +GeolocationHintUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
+20  import org.opensaml.xml.XMLObject;
+21  
+22  /**
+23   * A thread-safe unmarshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.GeolocationHint} objects.
+24   */
+25  public class GeolocationHintUnmarshaller extends AbstractSAMLObjectUnmarshaller {
+26  
+27      /** {@inheritDoc} */
+28      protected void processElementContent(XMLObject samlObject, String elementContent) {
+29          GeolocationHint hint = (GeolocationHint) samlObject;
+30  
+31          hint.setHint(elementContent);
+32      }
+33  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHint.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHint.html new file mode 100644 index 0000000..9ec3625 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHint.html @@ -0,0 +1,69 @@ + + + + +IPHint xref + + + +
View Javadoc
+
+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.wayf.idpdisco;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.opensaml.common.SAMLObject;
+22  
+23  /**
+24   * IPHint.
+25   *
+26   * See IdP Discovery and Login UI Metadata Extension Profile.
+27   *
+28   * @author Rod Widdowson August 2010
+29   * 
+30   * The <IPHint> element specifies a set of [CIDR] blocks associated with, 
+31   *  or serviced by, the entity.  Both IPv4 and IPv6 CIDR blocks MUST be supported.
+32   */
+33  public interface IPHint extends SAMLObject {
+34  
+35      /** Element local name. */
+36      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "IPHint";
+37      
+38      /** Default element name. */
+39      public static final QName DEFAULT_ELEMENT_NAME = new QName(DiscoHints.MDUI_NS, 
+40              DEFAULT_ELEMENT_LOCAL_NAME, DiscoHints.MDUI_PREFIX);
+41      
+42      /**
+43       * Gets the Hint.
+44       * 
+45       * @return the Hint
+46       */
+47      public String getHint();
+48      
+49      /**
+50       * Sets the hint.
+51       * 
+52       * @param newHint hint
+53       */
+54      public void setHint(String newHint);
+55  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintBuilder.html new file mode 100644 index 0000000..c5543ca --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintBuilder.html @@ -0,0 +1,58 @@ + + + + +IPHintBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+20  
+21  /**
+22   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.IPHint} objects.
+23   */
+24  public class IPHintBuilder extends AbstractSAMLObjectBuilder<IPHint> {
+25  
+26      /**
+27       * Constructor.
+28       */
+29      public IPHintBuilder() {
+30  
+31      }
+32  
+33      /** {@inheritDoc} */
+34      public IPHint buildObject() {
+35          return buildObject(DiscoHints.MDUI_NS, 
+36                             IPHint.DEFAULT_ELEMENT_LOCAL_NAME, 
+37                             DiscoHints.MDUI_PREFIX);
+38      }
+39  
+40      /** {@inheritDoc} */
+41      public IPHint buildObject(String namespaceURI, String localName, String namespacePrefix) {
+42          return new IPHintImpl(namespaceURI, localName, namespacePrefix);
+43      }
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintImpl.html new file mode 100644 index 0000000..fa728e7 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintImpl.html @@ -0,0 +1,76 @@ + + + + +IPHintImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+17  
+18  import java.util.List;
+19  
+20  import org.opensaml.common.impl.AbstractSAMLObject;
+21  import org.opensaml.saml2.metadata.LocalizedString;
+22  import org.opensaml.xml.LangBearing;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.util.DatatypeHelper;
+25  
+26  /**
+27   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.IPHint}.
+28   */
+29  public class IPHintImpl extends AbstractSAMLObject implements IPHint {
+30  
+31      /**
+32       * local storage.
+33       */
+34      private String hint;
+35      
+36      /**
+37       * Constructor.
+38       * 
+39       * @param namespaceURI the namespaceURI
+40       * @param elementLocalName the elementLocalName
+41       * @param namespacePrefix the namespacePrefix
+42       */
+43      protected IPHintImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+44          super(namespaceURI, elementLocalName, namespacePrefix);
+45      }
+46  
+47      /** {@inheritDoc} */
+48      public String getHint() {
+49          return hint;
+50      }
+51  
+52      /** {@inheritDoc} */
+53      public void setHint(String newHint) {
+54          hint = prepareForAssignment(hint, newHint);
+55      }
+56  
+57      /** {@inheritDoc} */
+58      public List<XMLObject> getOrderedChildren() {
+59          return null;
+60      }
+61  
+62  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintMarshaller.html new file mode 100644 index 0000000..b986411 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintMarshaller.html @@ -0,0 +1,52 @@ + + + + +IPHintMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+20  import org.opensaml.xml.XMLObject;
+21  import org.opensaml.xml.io.MarshallingException;
+22  import org.opensaml.xml.util.XMLHelper;
+23  import org.w3c.dom.Element;
+24  
+25  /**
+26   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.IPHint} objects.
+27   */
+28  public class IPHintMarshaller extends AbstractSAMLObjectMarshaller {
+29  
+30      /** {@inheritDoc} */
+31      protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
+32          IPHint name = (IPHint) samlObject;
+33  
+34          if (name.getHint() != null) {
+35              XMLHelper.appendTextContent(domElement, name.getHint());
+36          }
+37      }
+38  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintUnmarshaller.html new file mode 100644 index 0000000..5d05a26 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/IPHintUnmarshaller.html @@ -0,0 +1,52 @@ + + + + +IPHintUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.saml2.metadata.LocalizedString;
+22  import org.opensaml.xml.LangBearing;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.io.UnmarshallingException;
+25  import org.w3c.dom.Attr;
+26  
+27  /**
+28   * A thread-safe unmarshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.IPHint} objects.
+29   */
+30  public class IPHintUnmarshaller extends AbstractSAMLObjectUnmarshaller {
+31  
+32      /** {@inheritDoc} */
+33      protected void processElementContent(XMLObject samlObject, String elementContent) {
+34          IPHint hint = (IPHint) samlObject;
+35  
+36          hint.setHint(elementContent);
+37      }
+38  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURL.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURL.html new file mode 100644 index 0000000..906c0a1 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURL.html @@ -0,0 +1,70 @@ + + + + +InformationURL xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.opensaml.common.SAMLObject;
+22  import org.opensaml.saml2.metadata.LocalizedString;
+23  
+24  /**
+25   * InformationURL.
+26   *
+27   * See IdP Discovery and Login UI Metadata Extension Profile.
+28   *
+29   * @author Rod Widdowson August 2010
+30   * 
+31   * Reflects the InformationURL in the IdP Discovery and Login UI Metadata Extension Profile.
+32   * 
+33   */
+34  public interface InformationURL extends LocalizedURI {
+35  
+36      /** Element local name. */
+37      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "InformationURL";
+38      
+39      /** Default element name. */
+40      public static final QName DEFAULT_ELEMENT_NAME = new QName(DiscoHints.MDUI_NS, 
+41              DEFAULT_ELEMENT_LOCAL_NAME, DiscoHints.MDUI_PREFIX);
+42      
+43      /**
+44       * Gets the InformationURL of the EndPoint.
+45       * 
+46       * @return the InformationURL of the EndPoint
+47       */
+48      public LocalizedString getURL();
+49      
+50      /**
+51       * Sets the InformationURL of the EndPoint.
+52       * 
+53       * @param newName InformationURL of the EndPoint
+54       */
+55      public void setURL(LocalizedString newName);
+56  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLBuilder.html new file mode 100644 index 0000000..e71da9f --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLBuilder.html @@ -0,0 +1,58 @@ + + + + +InformationURLBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+20  
+21  /**
+22   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.InformationURL} objects.
+23   * @author Rod Widdowson
+24   */
+25  public class InformationURLBuilder extends AbstractSAMLObjectBuilder<InformationURL> {
+26      /**
+27       * Constructor.
+28       */
+29      public InformationURLBuilder() {
+30  
+31      }
+32  
+33      /** {@inheritDoc} */
+34      public InformationURL buildObject() {
+35          return buildObject(UIInfo.MDUI_NS, 
+36                             InformationURL.DEFAULT_ELEMENT_LOCAL_NAME, 
+37                             UIInfo.MDUI_PREFIX);
+38      }
+39  
+40      /** {@inheritDoc} */
+41      public InformationURL buildObject(String namespaceURI, String localName, String namespacePrefix) {
+42          return new InformationURLImpl(namespaceURI, localName, namespacePrefix);
+43      }
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLImpl.html new file mode 100644 index 0000000..970eaa1 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLImpl.html @@ -0,0 +1,68 @@ + + + + +InformationURLImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import java.util.List;
+20  
+21  import org.opensaml.common.impl.AbstractSAMLObject;
+22  import org.opensaml.saml2.metadata.LocalizedString;
+23  import org.opensaml.xml.LangBearing;
+24  import org.opensaml.xml.XMLObject;
+25  import org.opensaml.xml.util.DatatypeHelper;
+26  
+27  /**
+28   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.InformationURL}.
+29   * @author Rod Widdowson
+30   */
+31  
+32  public class InformationURLImpl extends LocalizedURIImpl implements InformationURL {
+33  
+34      /**
+35       * Constructor.
+36       * 
+37       * @param namespaceURI the namespaceURI
+38       * @param elementLocalName the elementLocalName
+39       * @param namespacePrefix the namespacePrefix
+40       */
+41      protected InformationURLImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+42          super(namespaceURI, elementLocalName, namespacePrefix);
+43      }
+44  
+45      /** {@inheritDoc} */
+46      public LocalizedString getURL() {
+47          return getURL();
+48      }
+49  
+50      /** {@inheritDoc} */
+51      public void setURL(LocalizedString newInformationURL) {
+52          setURL(newInformationURL);
+53      }
+54  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLMarshaller.html new file mode 100644 index 0000000..226e64b --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLMarshaller.html @@ -0,0 +1,38 @@ + + + + +InformationURLMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  
+20  /**
+21   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.InformationURL} objects.
+22   */
+23  public class InformationURLMarshaller extends LocalizedURIMarshaller {
+24  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLUnmarshaller.html new file mode 100644 index 0000000..b058ebc --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/InformationURLUnmarshaller.html @@ -0,0 +1,37 @@ + + + + +InformationURLUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  /**
+20   * A thread-safe unmarshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.InformationURL} objects.
+21   */
+22  public class InformationURLUnmarshaller extends LocalizedURIUnmarshaller {
+23  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedName.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedName.html new file mode 100644 index 0000000..ad8e7da --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedName.html @@ -0,0 +1,58 @@ + + + + +LocalizedName xref + + + +
View Javadoc
+
+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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.SAMLObject;
+20  import org.opensaml.saml2.metadata.LocalizedString;
+21  import org.opensaml.xml.LangBearing;
+22  
+23  /**
+24   * LocalizedName.
+25   */
+26  public interface LocalizedName extends SAMLObject, LangBearing {
+27  
+28      /** Local name of the XSI type. */
+29      public static final String TYPE_LOCAL_NAME = "localizedNameType"; 
+30          
+31      /**
+32       * Gets the name.
+33       * 
+34       * @return the name
+35       */
+36      public LocalizedString getName();
+37      
+38      /**
+39       * Sets the  name.
+40       * 
+41       * @param newName new name
+42       */
+43      public void setName(LocalizedString newName);
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameImpl.html new file mode 100644 index 0000000..a648211 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameImpl.html @@ -0,0 +1,89 @@ + + + + +LocalizedNameImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+17  
+18  import java.util.List;
+19  
+20  import org.opensaml.common.impl.AbstractSAMLObject;
+21  import org.opensaml.saml2.metadata.LocalizedString;
+22  import org.opensaml.xml.LangBearing;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.util.DatatypeHelper;
+25  
+26  /**
+27   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.LocalizedName}.
+28   */
+29  public class LocalizedNameImpl extends AbstractSAMLObject implements LocalizedName {
+30  
+31      /** Display name. */
+32      private LocalizedString name;
+33  
+34      /**
+35       * Constructor.
+36       * 
+37       * @param namespaceURI the namespaceURI
+38       * @param elementLocalName the elementLocalName
+39       * @param namespacePrefix the namespacePrefix
+40       */
+41      protected LocalizedNameImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+42          super(namespaceURI, elementLocalName, namespacePrefix);
+43      }
+44  
+45      /** {@inheritDoc} */
+46      public LocalizedString getName() {
+47          return name;
+48      }
+49  
+50      /** {@inheritDoc} */
+51      public void setName(LocalizedString newName) {
+52          name = prepareForAssignment(name, newName);
+53          boolean hasXMLLang = false;
+54          if (name != null && !DatatypeHelper.isEmpty(name.getLanguage())) {
+55              hasXMLLang = true;
+56          }
+57          manageQualifiedAttributeNamespace(LangBearing.XML_LANG_ATTR_NAME, hasXMLLang);
+58      }
+59  
+60      /** {@inheritDoc} */
+61      public String getXMLLang() {
+62          return name.getLanguage();
+63      }
+64  
+65      /** {@inheritDoc} */
+66      public void setXMLLang(String newLang) {
+67          name.setLanguage(newLang);
+68      }
+69  
+70      /** {@inheritDoc} */
+71      public List<XMLObject> getOrderedChildren() {
+72          return null;
+73      }
+74  
+75  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameMarshaller.html new file mode 100644 index 0000000..014a91d --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameMarshaller.html @@ -0,0 +1,69 @@ + + + + +LocalizedNameMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.xml.LangBearing;
+22  import org.opensaml.xml.XMLObject;
+23  import org.opensaml.xml.io.MarshallingException;
+24  import org.opensaml.xml.util.XMLHelper;
+25  import org.w3c.dom.Attr;
+26  import org.w3c.dom.Element;
+27  
+28  /**
+29   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.LocalizedName} objects.
+30   */
+31  public class LocalizedNameMarshaller extends AbstractSAMLObjectMarshaller {
+32  
+33      /**
+34       * {@inheritDoc}
+35       */
+36      protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
+37          LocalizedName name = (LocalizedName) samlObject;
+38  
+39          if (name.getName() != null) {
+40              Attr attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), SAMLConstants.XML_NS,
+41                      LangBearing.XML_LANG_ATTR_LOCAL_NAME, SAMLConstants.XML_PREFIX);
+42              attribute.setValue(name.getName().getLanguage());
+43              domElement.setAttributeNodeNS(attribute);
+44          }
+45      }
+46  
+47      /** {@inheritDoc} */
+48      protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
+49          LocalizedName name = (LocalizedName) samlObject;
+50  
+51          if (name.getName() != null) {
+52              XMLHelper.appendTextContent(domElement, name.getName().getLocalString());
+53          }
+54      }
+55  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameUnmarshaller.html new file mode 100644 index 0000000..04d0775 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedNameUnmarshaller.html @@ -0,0 +1,76 @@ + + + + +LocalizedNameUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.saml2.metadata.LocalizedString;
+22  import org.opensaml.xml.LangBearing;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.io.UnmarshallingException;
+25  import org.w3c.dom.Attr;
+26  
+27  /**
+28   * A thread-safe unmarshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.LocalizedName} objects.
+29   */
+30  public class LocalizedNameUnmarshaller extends AbstractSAMLObjectUnmarshaller {
+31  
+32      /**
+33       * {@inheritDoc}
+34       */
+35      protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
+36          if (attribute.getLocalName().equals(LangBearing.XML_LANG_ATTR_LOCAL_NAME)
+37                  && SAMLConstants.XML_NS.equals(attribute.getNamespaceURI())) {
+38              LocalizedName name = (LocalizedName) samlObject;
+39  
+40              LocalizedString nameStr = name.getName();
+41              if (nameStr == null) {
+42                  nameStr = new LocalizedString();
+43              }
+44  
+45              nameStr.setLanguage(attribute.getValue());
+46              name.setName(nameStr);
+47          }
+48      }
+49  
+50      /** {@inheritDoc} */
+51      protected void processElementContent(XMLObject samlObject, String elementContent) {
+52          LocalizedName name = (LocalizedName) samlObject;
+53  
+54          LocalizedString nameStr = name.getName();
+55          if (nameStr == null) {
+56              nameStr = new LocalizedString();
+57          }
+58  
+59          nameStr.setLocalizedString(elementContent);
+60          name.setName(nameStr);
+61      }
+62  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURI.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURI.html new file mode 100644 index 0000000..80cb67a --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURI.html @@ -0,0 +1,58 @@ + + + + +LocalizedURI xref + + + +
View Javadoc
+
+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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.SAMLObject;
+20  import org.opensaml.saml2.metadata.LocalizedString;
+21  import org.opensaml.xml.LangBearing;
+22  
+23  /**
+24   * LocalizedURI.
+25   */
+26  public interface LocalizedURI extends SAMLObject, LangBearing {
+27  
+28      /** Local name of the XSI type. */
+29      public static final String TYPE_LOCAL_NAME = "localizedURIType"; 
+30          
+31      /**
+32       * Gets the URI.
+33       * 
+34       * @return the URI
+35       */
+36      public LocalizedString getURI();
+37      
+38      /**
+39       * Sets the URI.
+40       * 
+41       * @param newURI the new value
+42       */
+43      public void setURI(LocalizedString newURI);
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIImpl.html new file mode 100644 index 0000000..f895231 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIImpl.html @@ -0,0 +1,89 @@ + + + + +LocalizedURIImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+17  
+18  import java.util.List;
+19  
+20  import org.opensaml.common.impl.AbstractSAMLObject;
+21  import org.opensaml.saml2.metadata.LocalizedString;
+22  import org.opensaml.xml.LangBearing;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.util.DatatypeHelper;
+25  
+26  /**
+27   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.LocalizedURI}.
+28   */
+29  public class LocalizedURIImpl extends AbstractSAMLObject implements LocalizedURI{
+30  
+31      /** Display name. */
+32      private LocalizedString uri;
+33  
+34      /**
+35       * Constructor.
+36       * 
+37       * @param namespaceURI the namespaceURI
+38       * @param elementLocalName the elementLocalName
+39       * @param namespacePrefix the namespacePrefix
+40       */
+41      protected LocalizedURIImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+42          super(namespaceURI, elementLocalName, namespacePrefix);
+43      }
+44  
+45      /** {@inheritDoc} */
+46      public LocalizedString getURI() {
+47          return uri;
+48      }
+49  
+50      /** {@inheritDoc} */
+51      public void setURI(LocalizedString newURI) {
+52          uri = prepareForAssignment(uri, newURI);
+53          boolean hasXMLLang = false;
+54          if (uri != null && !DatatypeHelper.isEmpty(uri.getLanguage())) {
+55              hasXMLLang = true;
+56          }
+57          manageQualifiedAttributeNamespace(LangBearing.XML_LANG_ATTR_NAME, hasXMLLang);
+58      }
+59  
+60      /** {@inheritDoc} */
+61      public String getXMLLang() {
+62          return uri.getLanguage();
+63      }
+64  
+65      /** {@inheritDoc} */
+66      public void setXMLLang(String newLang) {
+67          uri.setLanguage(newLang);
+68      }
+69  
+70      /** {@inheritDoc} */
+71      public List<XMLObject> getOrderedChildren() {
+72          return null;
+73      }
+74  
+75  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIMarshaller.html new file mode 100644 index 0000000..af491a4 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIMarshaller.html @@ -0,0 +1,69 @@ + + + + +LocalizedURIMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.xml.LangBearing;
+22  import org.opensaml.xml.XMLObject;
+23  import org.opensaml.xml.io.MarshallingException;
+24  import org.opensaml.xml.util.XMLHelper;
+25  import org.w3c.dom.Attr;
+26  import org.w3c.dom.Element;
+27  
+28  /**
+29   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.LocalizedURI} objects.
+30   */
+31  public class LocalizedURIMarshaller extends AbstractSAMLObjectMarshaller {
+32  
+33      /**
+34       * {@inheritDoc}
+35       */
+36      protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
+37          LocalizedURI name = (LocalizedURI) samlObject;
+38  
+39          if (name.getURI() != null) {
+40              Attr attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), SAMLConstants.XML_NS,
+41                      LangBearing.XML_LANG_ATTR_LOCAL_NAME, SAMLConstants.XML_PREFIX);
+42              attribute.setValue(name.getURI().getLanguage());
+43              domElement.setAttributeNodeNS(attribute);
+44          }
+45      }
+46  
+47      /** {@inheritDoc} */
+48      protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
+49          LocalizedURI name = (LocalizedURI) samlObject;
+50  
+51          if (name.getURI() != null) {
+52              XMLHelper.appendTextContent(domElement, name.getURI().getLocalString());
+53          }
+54      }
+55  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIUnmarshaller.html new file mode 100644 index 0000000..32d30bb --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LocalizedURIUnmarshaller.html @@ -0,0 +1,76 @@ + + + + +LocalizedURIUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.saml2.metadata.LocalizedString;
+22  import org.opensaml.xml.LangBearing;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.io.UnmarshallingException;
+25  import org.w3c.dom.Attr;
+26  
+27  /**
+28   * A thread-safe unmarshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.LocalURI} objects.
+29   */
+30  public class LocalizedURIUnmarshaller extends AbstractSAMLObjectUnmarshaller {
+31  
+32      /**
+33       * {@inheritDoc}
+34       */
+35      protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
+36          if (attribute.getLocalName().equals(LangBearing.XML_LANG_ATTR_LOCAL_NAME)
+37                  && SAMLConstants.XML_NS.equals(attribute.getNamespaceURI())) {
+38              LocalizedURI uri = (LocalizedURI) samlObject;
+39  
+40              LocalizedString uriStr = uri.getURI();
+41              if (uriStr == null) {
+42                  uriStr = new LocalizedString();
+43              }
+44  
+45              uriStr.setLanguage(attribute.getValue());
+46              uri.setURI(uriStr);
+47          }
+48      }
+49  
+50      /** {@inheritDoc} */
+51      protected void processElementContent(XMLObject samlObject, String elementContent) {
+52          LocalizedURI uri = (LocalizedURI) samlObject;
+53  
+54          LocalizedString uriStr = uri.getURI();
+55          if (uriStr == null) {
+56              uriStr = new LocalizedString();
+57          }
+58  
+59          uriStr.setLocalizedString(elementContent);
+60          uri.setURI(uriStr);
+61      }
+62  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/Logo.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/Logo.html new file mode 100644 index 0000000..4d063fb --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/Logo.html @@ -0,0 +1,99 @@ + + + + +Logo xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.opensaml.common.SAMLObject;
+22  import org.opensaml.saml2.metadata.LocalizedString;
+23  import org.opensaml.xml.LangBearing;
+24  
+25  /**
+26   * Localized logo type.
+27   * 
+28   * 
+29   * @author RDW 27/Aug/2010
+30   * 
+31   * See IdP Discovery and Login UI Metadata Extension Profile.
+32   *  
+33   */
+34  public interface Logo extends LangBearing, SAMLObject {
+35  
+36      /** Element local name. */
+37      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "Logo";
+38      
+39      /** Default element name. */
+40      public static final QName DEFAULT_ELEMENT_NAME = new QName(UIInfo.MDUI_NS, 
+41              DEFAULT_ELEMENT_LOCAL_NAME, UIInfo.MDUI_PREFIX);
+42      
+43      public static final String HEIGHT_ATTR_NAME = "height";
+44  
+45      public static final String WIDTH_ATTR_NAME = "width";
+46  
+47  
+48      /**
+49       * Gets the URL.
+50       * 
+51       * @return the URL
+52       */
+53      public LocalizedString getURL();
+54      
+55      /**
+56       * Sets the URL.
+57       * 
+58       * @param newURL the URL
+59       */
+60      public void setURL(LocalizedString newURL);
+61  
+62      /**
+63       * Get the height of the logo.
+64       * @return the height of the logo
+65       */
+66      public Integer getHeight();
+67      
+68      /**
+69       * Sets the height of the logo.
+70       * @param newHeight the height of the logo
+71       */
+72      public void setHeight(Integer newHeight);
+73  
+74      /**
+75       * Get the width of the logo.
+76       * @return the width of the logo
+77       */
+78      public Integer getWidth();
+79      
+80      /**
+81       * Sets the width of the logo.
+82       * @param newWidth the height of the logo
+83       */
+84      public void setWidth(Integer newWidth);
+85  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoBuilder.html new file mode 100644 index 0000000..9ef049e --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoBuilder.html @@ -0,0 +1,58 @@ + + + + +LogoBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+20  
+21  /**
+22   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.Logo} objects.
+23   */
+24  public class LogoBuilder extends AbstractSAMLObjectBuilder<Logo> {
+25  
+26      /**
+27       * Constructor.
+28       */
+29      public LogoBuilder() {
+30  
+31      }
+32  
+33      /** {@inheritDoc} */
+34      public Logo buildObject() {
+35          return buildObject(UIInfo.MDUI_NS, 
+36                             Logo.DEFAULT_ELEMENT_LOCAL_NAME, 
+37                             UIInfo.MDUI_PREFIX);
+38      }
+39  
+40      /** {@inheritDoc} */
+41      public Logo buildObject(String namespaceURI, String localName, String namespacePrefix) {
+42          return new LogoImpl(namespaceURI, localName, namespacePrefix);
+43      }
+44  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoImpl.html new file mode 100644 index 0000000..9a9c42d --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoImpl.html @@ -0,0 +1,123 @@ + + + + +LogoImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import java.util.List;
+20  
+21  import org.opensaml.common.impl.AbstractSAMLObject;
+22  import org.opensaml.saml2.metadata.LocalizedString;
+23  import org.opensaml.xml.XMLObject;
+24  
+25  /**
+26   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.Logo}.
+27   * @author rod widdowson
+28   */
+29  public class LogoImpl extends AbstractSAMLObject implements Logo {
+30      
+31      /** Logo URL. */
+32      private LocalizedString localizedURL;
+33  
+34      /** X-Dimension of the logo. */
+35      private Integer width;
+36  
+37      /** Y-Dimension of the logo. */
+38      private Integer height;
+39  
+40      /**
+41       * Constructor.
+42       * 
+43       * @param namespaceURI namespaceURI
+44       * @param elementLocalName elementLocalName
+45       * @param namespacePrefix namespacePrefix
+46       */
+47      protected LogoImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+48          super(namespaceURI, elementLocalName, namespacePrefix);
+49      }
+50  
+51  
+52      /** {@inheritDoc} */
+53      public Integer getHeight() {
+54          return height;
+55      }
+56  
+57      /** {@inheritDoc} */
+58      public void setHeight(Integer newHeight) {
+59           height = prepareForAssignment(height, newHeight);
+60      }
+61  
+62      /** {@inheritDoc} */
+63      public Integer getWidth() {
+64          return width;
+65      }
+66  
+67      /** {@inheritDoc} */
+68      public void setWidth(Integer newWidth) {
+69          width = prepareForAssignment(width, newWidth);
+70      }
+71  
+72      /** {@inheritDoc} */
+73      public LocalizedString getURL() {
+74          return localizedURL;
+75      }
+76  
+77      /** {@inheritDoc} */
+78      public void setURL(LocalizedString newURL) {
+79          localizedURL = newURL;
+80      }
+81  
+82      /** {@inheritDoc} */
+83      public String getXMLLang() {
+84          localizedURL.getLanguage();
+85          return null;
+86      }
+87  
+88  
+89      /** {@inheritDoc} */
+90      public void setXMLLang(String newLang) {
+91          localizedURL.setLanguage(newLang);
+92      }
+93  
+94      /** {@inheritDoc} */
+95      public List<XMLObject> getOrderedChildren() {
+96          return null;
+97      }
+98  
+99      /**
+100      * {@inheritDoc}
+101      */
+102     public int hashCode() {
+103         int hash = 1;
+104         hash = hash * 31 + localizedURL.hashCode();
+105         hash = hash * 31 + height;
+106         hash = hash * 31 + width;
+107         return hash;
+108     }
+109 }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoMarshaller.html new file mode 100644 index 0000000..518959b --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoMarshaller.html @@ -0,0 +1,75 @@ + + + + +LogoMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.xml.LangBearing;
+22  import org.opensaml.xml.XMLObject;
+23  import org.opensaml.xml.io.MarshallingException;
+24  import org.opensaml.xml.util.XMLHelper;
+25  import org.w3c.dom.Attr;
+26  import org.w3c.dom.Element;
+27  
+28  /**
+29   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.Logo} objects.
+30   */
+31  public class LogoMarshaller extends AbstractSAMLObjectMarshaller {
+32  
+33      /**
+34       * {@inheritDoc}
+35       */
+36      protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
+37          Logo logo = (Logo) samlObject;
+38  
+39          if (logo.getXMLLang() != null) {
+40              Attr attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), SAMLConstants.XML_NS,
+41                      LangBearing.XML_LANG_ATTR_LOCAL_NAME, SAMLConstants.XML_PREFIX);
+42              attribute.setValue(logo.getXMLLang());
+43              domElement.setAttributeNodeNS(attribute);
+44          }
+45          if (logo.getHeight() != null) {
+46              domElement.setAttributeNS(null, Logo.HEIGHT_ATTR_NAME, logo.getHeight().toString());
+47          }
+48          if (logo.getWidth() != null) {
+49              domElement.setAttributeNS(null, Logo.WIDTH_ATTR_NAME, logo.getWidth().toString());
+50          }
+51      }
+52  
+53      /** {@inheritDoc} */
+54      protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
+55          Logo logo = (Logo) samlObject;
+56  
+57          if (logo.getURL() != null) {
+58              XMLHelper.appendTextContent(domElement, logo.getURL().getLocalString());
+59          }
+60      }
+61  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoUnmarshaller.html new file mode 100644 index 0000000..50dedc1 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/LogoUnmarshaller.html @@ -0,0 +1,81 @@ + + + + +LogoUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
+20  import org.opensaml.common.xml.SAMLConstants;
+21  import org.opensaml.saml2.metadata.LocalizedString;
+22  import org.opensaml.xml.LangBearing;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.io.UnmarshallingException;
+25  import org.w3c.dom.Attr;
+26  
+27  /**
+28   * A thread-safe Unmarshaller for {@link org.opensaml.saml2.metadata.Logo} objects.
+29   */
+30  public class LogoUnmarshaller extends AbstractSAMLObjectUnmarshaller {
+31  
+32      
+33      /** {@inheritDoc} */
+34      protected void processElementContent(XMLObject samlObject, String elementContent) {
+35          Logo logo = (Logo) samlObject;
+36  
+37          LocalizedString url = logo.getURL();
+38          if (url == null) {
+39              url = new LocalizedString();
+40          }
+41  
+42          url.setLocalizedString(elementContent);
+43          logo.setURL(url);
+44      }
+45      
+46      /**  {@inheritDoc} */
+47      protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
+48          Logo logo = (Logo) samlObject;
+49  
+50          if (attribute.getLocalName().equals(LangBearing.XML_LANG_ATTR_LOCAL_NAME)
+51                  && SAMLConstants.XML_NS.equals(attribute.getNamespaceURI())) {
+52  
+53              LocalizedString url = logo.getURL();
+54              if (url == null) {
+55                  url = new LocalizedString();
+56              }
+57  
+58              url.setLanguage(attribute.getValue());
+59              logo.setURL(url);
+60          } else if (attribute.getLocalName().equals(Logo.HEIGHT_ATTR_NAME)) {
+61              logo.setHeight(Integer.valueOf(attribute.getValue()));
+62          } else if (attribute.getLocalName().equals(Logo.WIDTH_ATTR_NAME)) {
+63              logo.setWidth(Integer.valueOf(attribute.getValue()));
+64          }
+65      }
+66  
+67  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURL.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURL.html new file mode 100644 index 0000000..0b74910 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURL.html @@ -0,0 +1,70 @@ + + + + +PrivacyStatementURL xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import javax.xml.namespace.QName;
+20  
+21  import org.opensaml.common.SAMLObject;
+22  import org.opensaml.saml2.metadata.LocalizedString;
+23  
+24  /**
+25   * PrivacyStatementURL.
+26   *
+27   * See IdP Discovery and Login UI Metadata Extension Profile.
+28   *
+29   * @author Rod Widdowson August 2010
+30   * 
+31   * Reflects the PrivacyStatementURL in the IdP Discovery and Login UI Metadata Extension Profile.
+32   * 
+33   */
+34  public interface PrivacyStatementURL extends LocalizedURI {
+35      
+36      /** Element local name. */
+37      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "PrivacyStatementURL";
+38      
+39      /** Default element name. */
+40      public static final QName DEFAULT_ELEMENT_NAME = new QName(UIInfo.MDUI_NS, 
+41              DEFAULT_ELEMENT_LOCAL_NAME, UIInfo.MDUI_PREFIX);
+42      
+43      /**
+44       * Gets the PrivacyStatementURL of the EndPoint.
+45       * 
+46       * @return the PrivacyStatementURL of the EndPoint
+47       */
+48      public LocalizedString getURL();
+49      
+50      /**
+51       * Sets the PrivacyStatementURL of the EndPoint.
+52       * 
+53       * @param newName PrivacyStatementURL of the EndPoint
+54       */
+55      public void setURL(LocalizedString newName);
+56  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLBuilder.html new file mode 100644 index 0000000..fe459a9 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLBuilder.html @@ -0,0 +1,60 @@ + + + + +PrivacyStatementURLBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+20  
+21  
+22  /**
+23   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.PrivacyStatementURL} objects.
+24   * @author Rod Widdowson
+25   */
+26  public class PrivacyStatementURLBuilder extends AbstractSAMLObjectBuilder<PrivacyStatementURL> {
+27  
+28      /**
+29       * Constructor.
+30       */
+31      public PrivacyStatementURLBuilder() {
+32  
+33      }
+34  
+35      /** {@inheritDoc} */
+36      public PrivacyStatementURL buildObject() {
+37          return buildObject(UIInfo.MDUI_NS, 
+38                             PrivacyStatementURL.DEFAULT_ELEMENT_LOCAL_NAME, 
+39                             UIInfo.MDUI_PREFIX);
+40      }
+41  
+42      /** {@inheritDoc} */
+43      public PrivacyStatementURL buildObject(String namespaceURI, String localName, String namespacePrefix) {
+44          return new PrivacyStatementURLImpl(namespaceURI, localName, namespacePrefix);
+45      }
+46  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLImpl.html new file mode 100644 index 0000000..8102468 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLImpl.html @@ -0,0 +1,72 @@ + + + + +PrivacyStatementURLImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import java.util.List;
+20  
+21  import org.opensaml.common.impl.AbstractSAMLObject;
+22  import org.opensaml.saml2.metadata.LocalizedString;
+23  import org.opensaml.xml.LangBearing;
+24  import org.opensaml.xml.XMLObject;
+25  import org.opensaml.xml.util.DatatypeHelper;
+26  
+27  
+28  /**
+29   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.PrivacyStatementURL}.
+30   * @author Rod Widdowson
+31   */
+32  
+33  public class PrivacyStatementURLImpl extends LocalizedURIImpl implements PrivacyStatementURL {
+34  
+35      /**
+36       * Constructor.
+37       * 
+38       * @param namespaceURI the namespaceURI
+39       * @param elementLocalName the elementLocalName
+40       * @param namespacePrefix the namespacePrefix
+41       */
+42      protected PrivacyStatementURLImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+43          super(namespaceURI, elementLocalName, namespacePrefix);
+44      }
+45  
+46      /** {@inheritDoc} */
+47      public LocalizedString getURL() {
+48          return getURI();
+49      }
+50  
+51      /** {@inheritDoc} */
+52      public void setURL(LocalizedString newPrivacyURL) {
+53          setURI(newPrivacyURL);
+54      }
+55  
+56  
+57  
+58  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLMarshaller.html new file mode 100644 index 0000000..7675d8a --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLMarshaller.html @@ -0,0 +1,38 @@ + + + + +PrivacyStatementURLMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  
+20  /**
+21   * A thread safe Marshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.PrivacyStatementURL} objects.
+22   */
+23  public class PrivacyStatementURLMarshaller extends LocalizedURIMarshaller {
+24  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLUnmarshaller.html new file mode 100644 index 0000000..0ad80df --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/PrivacyStatementURLUnmarshaller.html @@ -0,0 +1,38 @@ + + + + +PrivacyStatementURLUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  
+20  /**
+21   * A thread-safe unmarshaller for {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.PrivacyStatementURL} objects.
+22   */
+23  public class PrivacyStatementURLUnmarshaller extends LocalizedURIUnmarshaller {
+24  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfo.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfo.html new file mode 100644 index 0000000..d544d37 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfo.html @@ -0,0 +1,119 @@ + + + + +UIInfo xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import java.util.List;
+20  
+21  import javax.xml.namespace.QName;
+22  
+23  import org.opensaml.common.SAMLObject;
+24  
+25  /**
+26   * See IdP Discovery and Login UI Metadata Extension Profile.
+27   *
+28   * @author Rod Widdowson August 2010
+29   * 
+30   * Reflects the UINFO in the IdP Discovery and Login UI Metadata Extension Profile,
+31   *
+32   */
+33  public interface UIInfo extends SAMLObject {
+34      /** Namespace for Discovery Service metadata extensions. */
+35      public static final String MDUI_NS = "urn:oasis:names:tc:SAML:metadata:ui";
+36  
+37      /** Default namespace prefix used by this library. */
+38      public static final String  MDUI_PREFIX = "mdui";
+39  
+40      /** Name of the element inside the Extensions. */
+41      public static final String DEFAULT_ELEMENT_LOCAL_NAME = "UIInfo";
+42  
+43      /** Default element name. */
+44      public static final QName DEFAULT_ELEMENT_NAME = new QName(MDUI_NS, DEFAULT_ELEMENT_LOCAL_NAME,
+45              MDUI_PREFIX);
+46      
+47      /** Language attribute name. */
+48      public static final String LANG_ATTRIB_NAME = "lang";
+49      
+50      /** 
+51       * Get the Display Names
+52       * 
+53       * The <DisplayName> element specifies a set of localized names fit for 
+54       * display to users.  Such names are meant to allow a user to distinguish 
+55       * and identify the entity acting in a particular role.
+56       * @return the names
+57       */
+58      public List <DisplayName> getDisplayNames();
+59      
+60      /**
+61       * Return the descriptions.
+62       * 
+63       * The <Description> element specifies a set of brief, localized descriptions 
+64       * fit for display to users. In the case of service providers this SHOULD be a 
+65       * description of the service being offered.  In the case of an identity provider 
+66       * this SHOULD be a description of the community serviced.  In all cases this text 
+67       * SHOULD be standalone, meaning it is not meant to be filled in to some template 
+68       * text (e.g. 'This service offers $description').
+69       * @return descriptions
+70       */
+71      public List <Description> getDescriptions();
+72      
+73      /** 
+74       * Get the logos.
+75       * 
+76       * The <Logo> element specifies a set of localized logos fit for display to users.
+77       *  
+78       * @return a list of logos
+79       */
+80      public List <Logo> getLogos();
+81      
+82      /** 
+83       * Get the URLs.
+84       * 
+85       * The <InformationURL> specifies URLs to localized information, about the entity 
+86       * acting in a given role, meant to be viewed by users.  The contents found at 
+87       * these URLs SHOULD give a more complete set of information about than what is 
+88       * provided by the <Description> element 
+89       * 
+90       * @return the URLs
+91       */
+92      public List <InformationURL> getInformationURLs();
+93      
+94      /**
+95       * Get the Privacy Statement URLs.
+96       * 
+97       * The <PrivacyStatementURL> specifies URLs to localized privacy statements.  
+98       * Such statements are meant to provide a user with information about how 
+99       * information will be used and managed by the entity
+100      * 
+101      * @return the URLs
+102      */
+103     public List <PrivacyStatementURL> getPrivacyStatementURLs(); 
+104 
+105 }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoBuilder.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoBuilder.html new file mode 100644 index 0000000..26c4a19 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoBuilder.html @@ -0,0 +1,55 @@ + + + + +UIInfoBuilder xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+17  
+18  import org.opensaml.common.impl.AbstractSAMLObjectBuilder;
+19  
+20  /**
+21   * Builder of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.UIInfo}.
+22   */
+23  public class UIInfoBuilder extends AbstractSAMLObjectBuilder<UIInfo> {
+24  
+25      /**
+26       * Constructor.
+27       */
+28      public UIInfoBuilder() {
+29  
+30      }
+31  
+32      /** {@inheritDoc} */
+33      public UIInfo buildObject() {
+34          return buildObject(UIInfo.MDUI_NS, UIInfo.DEFAULT_ELEMENT_LOCAL_NAME, UIInfo.MDUI_PREFIX);
+35      }
+36  
+37      /** {@inheritDoc} */
+38      public UIInfo buildObject(String namespaceURI, String localName, String namespacePrefix) {
+39          return new UIInfoImpl(namespaceURI, localName, namespacePrefix);
+40      }
+41  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoImpl.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoImpl.html new file mode 100644 index 0000000..23aefe7 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoImpl.html @@ -0,0 +1,115 @@ + + + + +UIInfoImpl xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import java.util.ArrayList;
+20  import java.util.List;
+21  
+22  import org.opensaml.common.impl.AbstractSAMLObject;
+23  import org.opensaml.xml.XMLObject;
+24  import org.opensaml.xml.util.XMLObjectChildrenList;
+25  
+26  /**
+27   * Concrete implementation of {@link edu.internet2.middleware.shibboleth.wayf.idpdisco.UIInfo}.
+28   * @author Rod Widdowson
+29   */
+30  public class UIInfoImpl extends AbstractSAMLObject implements UIInfo {
+31      
+32      /** localized descriptions of the endpoint. */
+33      private final XMLObjectChildrenList<Description> descriptions;
+34      
+35      /** localized displayNames of the endpoint. */
+36      private final XMLObjectChildrenList<DisplayName> displayNames;
+37          
+38      /** localized Logos for the endpoint. */
+39      private final XMLObjectChildrenList<Logo> logos;
+40   
+41      /** localized URLs for the endpoint. */
+42      private final XMLObjectChildrenList<InformationURL> urls;
+43   
+44      /** localized PravcyStatementURLs for the endpoint. */
+45      private final XMLObjectChildrenList<PrivacyStatementURL> privacyStatementURLs;
+46   
+47      /**
+48       * Constructor.
+49       * @param namespaceURI namespaceURI
+50       * @param elementLocalName elementLocalName
+51       * @param namespacePrefix namespacePrefix
+52       */
+53      protected UIInfoImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
+54          super(namespaceURI, elementLocalName, namespacePrefix);
+55          
+56          descriptions = new XMLObjectChildrenList<Description>(this);
+57          displayNames = new XMLObjectChildrenList<DisplayName>(this);
+58          logos = new XMLObjectChildrenList<Logo>(this);
+59          urls = new XMLObjectChildrenList<InformationURL>(this);
+60          privacyStatementURLs = new XMLObjectChildrenList<PrivacyStatementURL>(this);
+61      }
+62  
+63      
+64      /** {@inheritDoc} */
+65      public List<Description> getDescriptions() {
+66          return descriptions;
+67      }
+68  
+69      /** {@inheritDoc} */
+70      public List<DisplayName> getDisplayNames() {
+71          return displayNames;
+72      }
+73  
+74      /** {@inheritDoc} */
+75      public List<InformationURL> getInformationURLs() {
+76          return urls;
+77      }
+78  
+79      /** {@inheritDoc} */
+80      public List<Logo> getLogos() {
+81          return logos;
+82      }
+83  
+84      /** {@inheritDoc} */
+85      public List<PrivacyStatementURL> getPrivacyStatementURLs() {
+86          return privacyStatementURLs;
+87      }
+88  
+89      /** {@inheritDoc} */
+90      public List<XMLObject> getOrderedChildren() {
+91          ArrayList<XMLObject> children = new ArrayList<XMLObject>();
+92          
+93          children.addAll(descriptions);
+94          children.addAll(displayNames);
+95          children.addAll(urls);
+96          children.addAll(logos);
+97          children.addAll(privacyStatementURLs);
+98          return children;
+99      }
+100 
+101 }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoMarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoMarshaller.html new file mode 100644 index 0000000..9f44418 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoMarshaller.html @@ -0,0 +1,41 @@ + + + + +UIInfoMarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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  
+18  package edu.internet2.middleware.shibboleth.wayf.idpdisco;
+19  
+20  import org.opensaml.common.impl.AbstractSAMLObjectMarshaller;
+21  
+22  /**
+23   * A thread safe Marshaller for {@link @linkedu.internet2.middleware.shibboleth.wayf.idpdisco.UIInfo} objects.
+24   */
+25  public class UIInfoMarshaller extends AbstractSAMLObjectMarshaller {
+26  
+27  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoUnmarshaller.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoUnmarshaller.html new file mode 100644 index 0000000..53bc920 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/UIInfoUnmarshaller.html @@ -0,0 +1,61 @@ + + + + +UIInfoUnmarshaller xref + + + +
View Javadoc
+
+1   /*
+2    * Copyright 2010 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.wayf.idpdisco;
+18  
+19  import org.opensaml.common.impl.AbstractSAMLObjectUnmarshaller;
+20  import org.opensaml.xml.XMLObject;
+21  import org.opensaml.xml.io.UnmarshallingException;
+22  
+23  /**
+24   * A thread-safe Unmarshaller for {@link org.opensaml.saml2.metadata.UIInfo} objects.
+25   */
+26  public class UIInfoUnmarshaller extends AbstractSAMLObjectUnmarshaller {
+27  
+28      /** {@inheritDoc} */
+29      protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
+30              throws UnmarshallingException {
+31          UIInfo info = (UIInfo) parentSAMLObject;
+32  
+33          if (childSAMLObject instanceof Description) {
+34              info.getDescriptions().add((Description) childSAMLObject);
+35          } else if (childSAMLObject instanceof DisplayName) {
+36              info.getDisplayNames().add((DisplayName) childSAMLObject);
+37          } else if (childSAMLObject instanceof InformationURL) {
+38              info.getInformationURLs().add((InformationURL) childSAMLObject);
+39          } else if (childSAMLObject instanceof Logo) {
+40              info.getLogos().add((Logo) childSAMLObject);
+41          } else if (childSAMLObject instanceof PrivacyStatementURL) {
+42              info.getPrivacyStatementURLs().add((PrivacyStatementURL) childSAMLObject);
+43          } else {
+44              super.processChildElement(parentSAMLObject, childSAMLObject);
+45          }
+46      }
+47  }
+
+
+ + diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/package-frame.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/package-frame.html new file mode 100644 index 0000000..b1d6d3d --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/package-frame.html @@ -0,0 +1,195 @@ + + + + + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.wayf.idpdisco + + + + +

+ edu.internet2.middleware.shibboleth.wayf.idpdisco +

+ +

Classes

+ + + + + \ No newline at end of file diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/package-summary.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/package-summary.html new file mode 100644 index 0000000..8ff9135 --- /dev/null +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/idpdisco/package-summary.html @@ -0,0 +1,352 @@ + + + + + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.wayf.idpdisco + + + +
+ +
+
+ +
+ +

Package edu.internet2.middleware.shibboleth.wayf.idpdisco

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Class Summary
+ Description +
+ DescriptionBuilder +
+ DescriptionImpl +
+ DescriptionMarshaller +
+ DescriptionUnmarshaller +
+ DiscoHints +
+ DiscoHintsBuilder +
+ DiscoHintsImpl +
+ DiscoHintsMarshaller +
+ DiscoHintsUnmarshaller +
+ DisplayName +
+ DisplayNameBuilder +
+ DisplayNameImpl +
+ DisplayNameMarshaller +
+ DisplayNameUnmarshaller +
+ DomainHint +
+ DomainHintBuilder +
+ DomainHintImpl +
+ DomainHintMarshaller +
+ DomainHintUnmarshaller +
+ GeolocationHint +
+ GeolocationHintBuilder +
+ GeolocationHintImpl +
+ GeolocationHintMarshaller +
+ GeolocationHintUnmarshaller +
+ IPHint +
+ IPHintBuilder +
+ IPHintImpl +
+ IPHintMarshaller +
+ IPHintUnmarshaller +
+ InformationURL +
+ InformationURLBuilder +
+ InformationURLImpl +
+ InformationURLMarshaller +
+ InformationURLUnmarshaller +
+ LocalizedName +
+ LocalizedNameImpl +
+ LocalizedNameMarshaller +
+ LocalizedNameUnmarshaller +
+ LocalizedURI +
+ LocalizedURIImpl +
+ LocalizedURIMarshaller +
+ LocalizedURIUnmarshaller +
+ Logo +
+ LogoBuilder +
+ LogoImpl +
+ LogoMarshaller +
+ LogoUnmarshaller +
+ PrivacyStatementURL +
+ PrivacyStatementURLBuilder +
+ PrivacyStatementURLImpl +
+ PrivacyStatementURLMarshaller +
+ PrivacyStatementURLUnmarshaller +
+ UIInfo +
+ UIInfoBuilder +
+ UIInfoImpl +
+ UIInfoMarshaller +
+ UIInfoUnmarshaller +
+ +
+ +
+
+ +
+
+ Copyright © 2006-2010 Internet2. All Rights Reserved. + + \ No newline at end of file diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/package-frame.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/package-frame.html index 2d58240..6a13fe0 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/package-frame.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/package-frame.html @@ -2,8 +2,8 @@ - - Shibboleth Discovery Service 1.1.1 Reference Package edu.internet2.middleware.shibboleth.wayf + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.wayf diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/package-summary.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/package-summary.html index 22bbd46..b2c5c51 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/package-summary.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/package-summary.html @@ -2,8 +2,8 @@ - - Shibboleth Discovery Service 1.1.1 Reference Package edu.internet2.middleware.shibboleth.wayf + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.wayf @@ -117,6 +117,6 @@
- Copyright © 2006-2009 Internet2. All Rights Reserved. + Copyright © 2006-2010 Internet2. All Rights Reserved. \ No newline at end of file diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/Plugin.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/Plugin.html index 0c6391a..390d7b9 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/Plugin.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/Plugin.html @@ -1,172 +1,172 @@ - + Plugin xref
View Javadoc
 
-1   /**
-2    * Copyright [2006] [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  package edu.internet2.middleware.shibboleth.wayf.plugins;
-17  
-18  import java.util.Collection;
-19  import java.util.List;
-20  import java.util.Map;
-21  
-22  import javax.servlet.http.HttpServletRequest;
-23  import javax.servlet.http.HttpServletResponse;
-24  
-25  import org.opensaml.saml2.metadata.provider.MetadataProvider;
-26  
-27  import edu.internet2.middleware.shibboleth.wayf.IdPSite;
-28  
-29  /**
-30   * 
-31   * The Plugin interface is used to affect the 'hints' that the WAYF offers to the users.  
-32   * <p>
-33   * The WAYF can register any number of plugins.  Each plugin is called when the metadata is loaded or realoaded
-34   * (so it can do any indexing) and at the three entry points into the WAYF - Lookup (main entry), Search and Select.
-35   * Plugins are called in the order in which they are declared to the WAYF. 
-36   * <p>
-37   * Each plugin is called once when the user has made a selection.
-38   * <p>
-39   * For Search and Lookup, each plugin is called multiple times, once for each metadata provider which has 
-40   * been declared to this particular WAYF instance.  The plugin can return a context which is handed to subsequent calls.
-41   * <p>
-42   * The idea is that each plugin can affect the displayed lists of IdPs.  As a reminder the WAYF displays two lists of 
-43   * IdPs - the complete list, displayed either as a single list or a list of lists, and the hint list (which was
-44   * previously only populated from the _saml_idp cookie.  In the search case the WAYF displays a third list of
-45   * the search hits. 
-46   * <p>
-47   * When the plugin in called it is given the current set of potential IdPs as a Map from EntityID to {@link IdPSite}
-48   * and lists representing the current hint list and search results.  A Plugin can remove an entry from 
-49   * the map or the lists.  Additionally it can insert an IdPSite found in the Map into the hint or search lists.
-50   * Thus the plugin can restrict the number of sites that the WAYF instance displays in the 'complete list' and
-51   * can add or remove IdPs from the hint list.
-52   * <p>
-53   * At any stage the plugin can take control of the current request and redirect or forward it.  It signals that
-54   * it has done this to the WAYF by means of an exception.
-55   * <p> 
-56   *  The _saml_idp cookie handling code is written as a WAYF plugin.  Other plugins have been written to allow IdPs
-57   *  to be presented as hints based on the client's IP address or to redirect back to the SP once the choice of
-58   *  IdP has been made.
-59   *  <p>
-60   *  Object implementing this interface are created during WAYF discovery service initialization.  There are 
-61   *  expected to implement a constructor which takes a {@link org.w3c.dom.Element} as the only parameter and they are 
-62   *  created via this constructor, with the parameter being the appropriate section of the WAYF configuration file 
-63   *  
-64   * @version Discussion
-65   *
-66   */
-67  public interface Plugin {
-68  
-69          /**
-70           *  Whenever the WAYF discoveres that the metadata is stale, it reloads it and calls each plugin at this method.
-71           * 
-72           * @param metadata - where to get the data from.
-73           * @return the value which will be provided as input to subsequent calls to {@link #lookup Lookup} and 
-74           * {@link #search Search}
-75           */
-76          PluginMetadataParameter refreshMetadata(MetadataProvider metadata);
-77          
-78          /**
-79           * The WAYF calls each plugin at this entry point when it is first contacted.  
-80           * 
-81           * @param req - Describes the current request.  A Plugin might use it to find any appropriate cookies 
-82           * @param res - Describes the current response.  A Plugin might use it to redirect a the request. 
-83           * @param parameter Describes the metadata.
-84           * @param context Any processing context returned from a previous call.
-85           * @param validIdps The list of IdPs which is currently views as possibly matches for the pattern. 
-86           *                  The Key is the EntityId for the IdP and the value the object which describes 
-87           *                  the Idp 
-88           * @param idpList The set of Idps which are currently considered as potential hints.    
-89           * @return a context to hand to subsequent calls
-90           * @throws WayfRequestHandled if the plugin has handled the request (for instance it has
-91           * issues a redirect)
-92           *
-93           * Each plugin is called multiple times,
-94           * once for each metadata provider which is registered (Depending on the precise configuration of the WAYF
-95           * metadata providers whose metadata does not include the target may be dropped).  Initially the plugin is
-96           * called with a context parameter of <code>null</code>.  In subsequent calls, the value returned from
-97           * the previous call is passed in as the context parameter. 
-98           * 
-99           * The plugin may remove IdPSite objects from the validIdps list.
-100          * 
-101          * The plugin may add or remove them to the idpList.  IdPSite Objects which are to be added to the idpList 
-102          * should be looked up by EntityIdName in validIdps by EntityId.  Hence any metadata processing shoudl 
-103          * store the entityID. 
-104          * 
-105          */
-106         PluginContext lookup(HttpServletRequest req, 
-107                                                  HttpServletResponse res, 
-108                                                  PluginMetadataParameter parameter, 
-109                                                  Map<String, IdPSite> validIdps, 
-110                                                  PluginContext context, 
-111                                                  List<IdPSite> idpList) throws WayfRequestHandled;
-112 
-113         /**
-114          * This method is called when the user specified a search operation.  The processing is similar to 
-115          * that described for {@link #lookup lookup}.
-116          * Two additional paramaters are provided, the search parameter which was provided, and the current 
-117          * proposed list of candidate IdPs.  The plugin is at liberty to alter both the list of hints and the 
-118          * list of valid IdPs. 
-119          * 
-120          * @param req Describes the current request.  The Plugin could use it to find any appropriate cookies 
-121          * @param res Describes the result - this is needed if (for instance) a plung needs to change cookie values
-122          * @param parameter Describes the metadata
-123          * @param pattern The Search pattern provided
-124          * @param validIdps The list of IdPs which is currently views as possibly matches for the pattern.  
-125          *                  The Key is the Idp Name an the value the idp
-126          * @param context Any processing context returned from a previous call.
-127          * @param searchResult the resukt of any search
-128          * @param idpList The set of Idps which are currently considered as potential hints.  Each Idp is associated
-129          * with a numeric weight, where the lower the number is the more likely the IdP is to be a candidate.  
-130          * As descibed above the WAYF uses this to provide hint list to the GUI (or even to dispatch 
-131          * immediately to the IdP).  
-132          * @return a context to hand to subsequent calls
-133          * @throws WayfRequestHandled if the plugin has handled the request (for instance it has
-134          * issues a redirect)
-135          */
-136         PluginContext search(HttpServletRequest req, 
-137                                         HttpServletResponse res, 
-138                                         PluginMetadataParameter parameter, 
-139                                         String pattern, 
-140                                         Map<String, IdPSite> validIdps, 
-141                                         PluginContext context, 
-142                                         Collection<IdPSite> searchResult,
-143                                         List<IdPSite> idpList) throws WayfRequestHandled;
-144         
-145         /**
-146          * This method is called, for every plugin, after a user has selected an IdP.  The plugin is expected 
-147          * to use it to update any in memory state (via the {@link PluginMetadataParameter} parameter or permananent 
-148          * state (for instance by writing back a cookie.
-149          * @param req Describes the current request. 
-150          * @param res Describes the current response
-151          * @param parameter  Describes the metadata
-152          * @throws WayfRequestHandled if the plugin has handled the request (for instance it has
-153          * issues a redirect)
-154          */
-155         void selected(HttpServletRequest req, 
-156                       HttpServletResponse res, 
-157                       PluginMetadataParameter parameter, 
-158                       String idP) throws WayfRequestHandled;
-159 }
+1   /**
+2    * Copyright [2006] [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  package edu.internet2.middleware.shibboleth.wayf.plugins;
+17  
+18  import java.util.Collection;
+19  import java.util.List;
+20  import java.util.Map;
+21  
+22  import javax.servlet.http.HttpServletRequest;
+23  import javax.servlet.http.HttpServletResponse;
+24  
+25  import org.opensaml.saml2.metadata.provider.MetadataProvider;
+26  
+27  import edu.internet2.middleware.shibboleth.wayf.IdPSite;
+28  
+29  /**
+30   * 
+31   * The Plugin interface is used to affect the 'hints' that the WAYF offers to the users.  
+32   * <p>
+33   * The WAYF can register any number of plugins.  Each plugin is called when the metadata is loaded or realoaded
+34   * (so it can do any indexing) and at the three entry points into the WAYF - Lookup (main entry), Search and Select.
+35   * Plugins are called in the order in which they are declared to the WAYF. 
+36   * <p>
+37   * Each plugin is called once when the user has made a selection.
+38   * <p>
+39   * For Search and Lookup, each plugin is called multiple times, once for each metadata provider which has 
+40   * been declared to this particular WAYF instance.  The plugin can return a context which is handed to subsequent calls.
+41   * <p>
+42   * The idea is that each plugin can affect the displayed lists of IdPs.  As a reminder the WAYF displays two lists of 
+43   * IdPs - the complete list, displayed either as a single list or a list of lists, and the hint list (which was
+44   * previously only populated from the _saml_idp cookie.  In the search case the WAYF displays a third list of
+45   * the search hits. 
+46   * <p>
+47   * When the plugin in called it is given the current set of potential IdPs as a Map from EntityID to {@link IdPSite}
+48   * and lists representing the current hint list and search results.  A Plugin can remove an entry from 
+49   * the map or the lists.  Additionally it can insert an IdPSite found in the Map into the hint or search lists.
+50   * Thus the plugin can restrict the number of sites that the WAYF instance displays in the 'complete list' and
+51   * can add or remove IdPs from the hint list.
+52   * <p>
+53   * At any stage the plugin can take control of the current request and redirect or forward it.  It signals that
+54   * it has done this to the WAYF by means of an exception.
+55   * <p> 
+56   *  The _saml_idp cookie handling code is written as a WAYF plugin.  Other plugins have been written to allow IdPs
+57   *  to be presented as hints based on the client's IP address or to redirect back to the SP once the choice of
+58   *  IdP has been made.
+59   *  <p>
+60   *  Object implementing this interface are created during WAYF discovery service initialization.  There are 
+61   *  expected to implement a constructor which takes a {@link org.w3c.dom.Element} as the only parameter and they are 
+62   *  created via this constructor, with the parameter being the appropriate section of the WAYF configuration file 
+63   *  
+64   * @version Discussion
+65   *
+66   */
+67  public interface Plugin {
+68  
+69          /**
+70           *  Whenever the WAYF discoveres that the metadata is stale, it reloads it and calls each plugin at this method.
+71           * 
+72           * @param metadata - where to get the data from.
+73           * @return the value which will be provided as input to subsequent calls to {@link #lookup Lookup} and 
+74           * {@link #search Search}
+75           */
+76          PluginMetadataParameter refreshMetadata(MetadataProvider metadata);
+77          
+78          /**
+79           * The WAYF calls each plugin at this entry point when it is first contacted.  
+80           * 
+81           * @param req - Describes the current request.  A Plugin might use it to find any appropriate cookies 
+82           * @param res - Describes the current response.  A Plugin might use it to redirect a the request. 
+83           * @param parameter Describes the metadata.
+84           * @param context Any processing context returned from a previous call.
+85           * @param validIdps The list of IdPs which is currently views as possibly matches for the pattern. 
+86           *                  The Key is the EntityId for the IdP and the value the object which describes 
+87           *                  the Idp 
+88           * @param idpList The set of Idps which are currently considered as potential hints.    
+89           * @return a context to hand to subsequent calls
+90           * @throws WayfRequestHandled if the plugin has handled the request (for instance it has
+91           * issues a redirect)
+92           *
+93           * Each plugin is called multiple times,
+94           * once for each metadata provider which is registered (Depending on the precise configuration of the WAYF
+95           * metadata providers whose metadata does not include the target may be dropped).  Initially the plugin is
+96           * called with a context parameter of <code>null</code>.  In subsequent calls, the value returned from
+97           * the previous call is passed in as the context parameter. 
+98           * 
+99           * The plugin may remove IdPSite objects from the validIdps list.
+100          * 
+101          * The plugin may add or remove them to the idpList.  IdPSite Objects which are to be added to the idpList 
+102          * should be looked up by EntityIdName in validIdps by EntityId.  Hence any metadata processing shoudl 
+103          * store the entityID. 
+104          * 
+105          */
+106         PluginContext lookup(HttpServletRequest req, 
+107                                                  HttpServletResponse res, 
+108                                                  PluginMetadataParameter parameter, 
+109                                                  Map<String, IdPSite> validIdps, 
+110                                                  PluginContext context, 
+111                                                  List<IdPSite> idpList) throws WayfRequestHandled;
+112 
+113         /**
+114          * This method is called when the user specified a search operation.  The processing is similar to 
+115          * that described for {@link #lookup lookup}.
+116          * Two additional paramaters are provided, the search parameter which was provided, and the current 
+117          * proposed list of candidate IdPs.  The plugin is at liberty to alter both the list of hints and the 
+118          * list of valid IdPs. 
+119          * 
+120          * @param req Describes the current request.  The Plugin could use it to find any appropriate cookies 
+121          * @param res Describes the result - this is needed if (for instance) a plung needs to change cookie values
+122          * @param parameter Describes the metadata
+123          * @param pattern The Search pattern provided
+124          * @param validIdps The list of IdPs which is currently views as possibly matches for the pattern.  
+125          *                  The Key is the Idp Name an the value the idp
+126          * @param context Any processing context returned from a previous call.
+127          * @param searchResult the resukt of any search
+128          * @param idpList The set of Idps which are currently considered as potential hints.  Each Idp is associated
+129          * with a numeric weight, where the lower the number is the more likely the IdP is to be a candidate.  
+130          * As descibed above the WAYF uses this to provide hint list to the GUI (or even to dispatch 
+131          * immediately to the IdP).  
+132          * @return a context to hand to subsequent calls
+133          * @throws WayfRequestHandled if the plugin has handled the request (for instance it has
+134          * issues a redirect)
+135          */
+136         PluginContext search(HttpServletRequest req, 
+137                                         HttpServletResponse res, 
+138                                         PluginMetadataParameter parameter, 
+139                                         String pattern, 
+140                                         Map<String, IdPSite> validIdps, 
+141                                         PluginContext context, 
+142                                         Collection<IdPSite> searchResult,
+143                                         List<IdPSite> idpList) throws WayfRequestHandled;
+144         
+145         /**
+146          * This method is called, for every plugin, after a user has selected an IdP.  The plugin is expected 
+147          * to use it to update any in memory state (via the {@link PluginMetadataParameter} parameter or permananent 
+148          * state (for instance by writing back a cookie.
+149          * @param req Describes the current request. 
+150          * @param res Describes the current response
+151          * @param parameter  Describes the metadata
+152          * @throws WayfRequestHandled if the plugin has handled the request (for instance it has
+153          * issues a redirect)
+154          */
+155         void selected(HttpServletRequest req, 
+156                       HttpServletResponse res, 
+157                       PluginMetadataParameter parameter, 
+158                       String idP) throws WayfRequestHandled;
+159 }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/PluginContext.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/PluginContext.html index 23967b7..b2f158e 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/PluginContext.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/PluginContext.html @@ -1,44 +1,44 @@ - + PluginContext xref
View Javadoc
 
-1   /**
-2    * Copyright [2006] [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.wayf.plugins;
-18  
-19  /**
-20   * This is a marker interface.
-21   * <p>
-22   * Objects which implement PluginContext are passed between sucessive calls to a plugins implementations of
-23   * {@link Plugin#lookup lookup} and {@link Plugin#search search} as the plugin 
-24   * is called for each {@link org.opensaml.saml2.metadata.provider.MetadataProvider}.
-25   * <p>
-26   * @author Rod Widdowson
-27   * @version Discussion
-28   */
-29  public interface PluginContext {
-30  
-31  }
+1   /**
+2    * Copyright [2006] [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.wayf.plugins;
+18  
+19  /**
+20   * This is a marker interface.
+21   * <p>
+22   * Objects which implement PluginContext are passed between sucessive calls to a plugins implementations of
+23   * {@link Plugin#lookup lookup} and {@link Plugin#search search} as the plugin 
+24   * is called for each {@link org.opensaml.saml2.metadata.provider.MetadataProvider}.
+25   * <p>
+26   * @author Rod Widdowson
+27   * @version Discussion
+28   */
+29  public interface PluginContext {
+30  
+31  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/PluginMetadataParameter.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/PluginMetadataParameter.html index e07d9e0..b5d416e 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/PluginMetadataParameter.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/PluginMetadataParameter.html @@ -1,43 +1,43 @@ - + PluginMetadataParameter xref
View Javadoc
 
-1   /**
-2    * Copyright [2006] [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  package edu.internet2.middleware.shibboleth.wayf.plugins;
-17  
-18  
-19  /**
-20   * The PluginParameter is a marker interface which a WAYF {@link Plugin} can use to associate extra information 
-21   * with the metadata.  Each plugin returns a PluginParameter from {@link Plugin#refreshMetadata RefreshMetadata}
-22   * and this is in turn presented back to then Plugin when it is called  during WAYF processing. 
-23   * <p>
-24   * @author Rod Widdowson
-25   * @version Discussion
-26   *
-27   */
-28  public interface PluginMetadataParameter {
-29  
-30  }
+1   /**
+2    * Copyright [2006] [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  package edu.internet2.middleware.shibboleth.wayf.plugins;
+17  
+18  
+19  /**
+20   * The PluginParameter is a marker interface which a WAYF {@link Plugin} can use to associate extra information 
+21   * with the metadata.  Each plugin returns a PluginParameter from {@link Plugin#refreshMetadata RefreshMetadata}
+22   * and this is in turn presented back to then Plugin when it is called  during WAYF processing. 
+23   * <p>
+24   * @author Rod Widdowson
+25   * @version Discussion
+26   *
+27   */
+28  public interface PluginMetadataParameter {
+29  
+30  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/WayfRequestHandled.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/WayfRequestHandled.html index bb9d473..8facffe 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/WayfRequestHandled.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/WayfRequestHandled.html @@ -1,30 +1,30 @@ - + WayfRequestHandled xref
View Javadoc
 
-1   package edu.internet2.middleware.shibboleth.wayf.plugins;
-2   
-3   /**
-4    * 
-5    * This Exception can be signalled by a plugin to indicate to the WAYF that it has handled the 
-6    * request and all processing should stop.
-7    * 
-8    * @author Rod Widdowson
-9    */
-10  public class WayfRequestHandled extends Exception {
-11  
-12     /**
-13      * Required Serialization constant.
-14      */
-15      private static final long serialVersionUID = 3022489208153734092L;
-16  
-17  }
+1   package edu.internet2.middleware.shibboleth.wayf.plugins;
+2   
+3   /**
+4    * 
+5    * This Exception can be signalled by a plugin to indicate to the WAYF that it has handled the 
+6    * request and all processing should stop.
+7    * 
+8    * @author Rod Widdowson
+9    */
+10  public class WayfRequestHandled extends Exception {
+11  
+12     /**
+13      * Required Serialization constant.
+14      */
+15      private static final long serialVersionUID = 3022489208153734092L;
+16  
+17  }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/package-frame.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/package-frame.html index f1f59a9..e12c25c 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/package-frame.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/package-frame.html @@ -2,8 +2,8 @@ - - Shibboleth Discovery Service 1.1.1 Reference Package edu.internet2.middleware.shibboleth.wayf.plugins + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.wayf.plugins diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/package-summary.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/package-summary.html index 09d4e41..7f243ac 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/package-summary.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/package-summary.html @@ -2,8 +2,8 @@ - - Shibboleth Discovery Service 1.1.1 Reference Package edu.internet2.middleware.shibboleth.wayf.plugins + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.wayf.plugins @@ -77,6 +77,6 @@
- Copyright © 2006-2009 Internet2. All Rights Reserved. + Copyright © 2006-2010 Internet2. All Rights Reserved. \ No newline at end of file diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/BindingFilter.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/BindingFilter.html index 8b1fa09..c99499a 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/BindingFilter.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/BindingFilter.html @@ -1,187 +1,191 @@ - + BindingFilter xref
View Javadoc
 
-1   /*
-2    * Copyright 2008 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.wayf.plugins.provider;
-18  
-19  import java.util.Iterator;
-20  import java.util.List;
-21  
-22  import org.opensaml.saml2.common.Extensions;
-23  import org.opensaml.saml2.metadata.EntitiesDescriptor;
-24  import org.opensaml.saml2.metadata.EntityDescriptor;
-25  import org.opensaml.saml2.metadata.RoleDescriptor;
-26  import org.opensaml.saml2.metadata.SPSSODescriptor;
-27  import org.opensaml.saml2.metadata.provider.FilterException;
-28  import org.opensaml.saml2.metadata.provider.MetadataFilter;
-29  import org.opensaml.samlext.idpdisco.DiscoveryResponse;
-30  import org.opensaml.xml.XMLObject;
-31  import org.slf4j.Logger;
-32  import org.slf4j.LoggerFactory;
-33  
-34  /**
-35   * See SDSJ-48.  If we get a DS endpoint then we need to check that the binding is provided
-36   * and that it is correct.
-37   * 
-38   * @author Rod Widdowson
-39   *
-40   */
-41  public class BindingFilter implements MetadataFilter {
-42  
-43      /**
-44       * Log for the warning. 
-45       */
-46      private static final Logger LOG = LoggerFactory.getLogger(BindingFilter.class.getName());
-47      
-48      /**
-49       * Set if we just want to warn on failure.
-50       */
-51      private final boolean warnOnFailure;
-52      
-53      /**
-54       * Only the protected constructor should be visible.
-55       */
-56      private BindingFilter() {
-57          this.warnOnFailure = false;
-58      }
-59      
-60      /**
-61       * Initialize the filter.
-62       * @param warn do we warn or do we fail if we see badness?
-63       */
-64      public BindingFilter(boolean warn) {
-65          this.warnOnFailure = warn;
-66      }
-67      
-68      /**
-69       * Apply the filter.
-70       * @see org.opensaml.saml2.metadata.provider.MetadataFilter#doFilter(org.opensaml.xml.XMLObject)
-71       * @param metadata what to filter.
-72       * @throws FilterException if it sees any missed or bad bindings.
-73       */
-74      public void doFilter(XMLObject metadata) throws FilterException {
-75  
-76          if (metadata instanceof EntitiesDescriptor) {
-77              
-78              checkEntities((EntitiesDescriptor) metadata);
-79              
-80          } else if (metadata instanceof EntityDescriptor) {
-81              EntityDescriptor entity = (EntityDescriptor) metadata;
-82              
-83              if (!checkEntity(entity)) {
-84                  if (warnOnFailure) {
-85                      LOG.warn("Badly formatted binding for " + entity.getEntityID());
-86                  } else {
-87                      LOG.error("Badly formatted binding for top level entity " + entity.getEntityID());
-88                  }
-89              }
-90          }
-91      }
-92  
-93      /**
-94       * If the entity has an SP characteristic, and it has a DS endpoint
-95       * then check its binding.
-96       * 
-97       * @param entity what to check.
-98       * @return true if all is OK.
-99       */
-100     private static boolean checkEntity(EntityDescriptor entity) {
-101         List<RoleDescriptor> roles = entity.getRoleDescriptors();
-102         
-103         for (RoleDescriptor role:roles) {
-104             
-105             //
-106             // Check every role
-107             //
-108             if (role instanceof SPSSODescriptor) {
-109                 
-110                 //
-111                 // Grab hold of all the extensions for SPSSO descriptors
-112                 //
-113                 
-114                 Extensions exts = role.getExtensions();
-115                 if (exts != null) {
-116                     //
-117                     // We have some children check them form <DiscoveryResponse>
-118                     //
-119                     List<XMLObject> children = exts.getOrderedChildren();
-120                     
-121                     for (XMLObject obj : children) {
-122                         if (obj instanceof DiscoveryResponse) {
-123                             //
-124                             // And check or the binding
-125                             //
-126                             DiscoveryResponse ds = (DiscoveryResponse) obj;
-127                             String binding = ds.getBinding(); 
-128 
-129                             if (!DiscoveryResponse.IDP_DISCO_NS.equals(binding)) {
-130                                 return false;
-131                             }
-132                         }
-133                     }
-134                 }
-135             }
-136         }
-137         return true;
-138     }
-139     
-140     /**
-141      * Check an EntitiesDescriptor call checkentities for the Entities and ourselves
-142      *  recursively for the EntitesDescriptors.
-143      *  
-144      * @param entities what to check.
-145      */
-146     private void checkEntities(EntitiesDescriptor entities) {
-147         List<EntitiesDescriptor> childEntities = entities.getEntitiesDescriptors();
-148         List<EntityDescriptor> children = entities.getEntityDescriptors();
-149         
-150         if (children != null) {
-151             Iterator<EntityDescriptor> itr;
-152             EntityDescriptor entity;
-153             itr = children.iterator();
-154             
-155             while (itr.hasNext()) {
-156                 entity = itr.next();
-157                 if (!checkEntity(entity)) { 
-158                     if (warnOnFailure) {
-159                         LOG.warn("Badly formatted binding for " + entity.getEntityID());
-160                     } else {
-161                         LOG.error("Badly formatted binding for " + entity.getEntityID() + ". Entity has been removed");
-162                         itr.remove();
-163                     }
-164                 }
-165             }
-166         }
-167         
-168         if (childEntities != null) {
-169             for (EntitiesDescriptor descriptor : childEntities) {
-170                 checkEntities(descriptor);
-171             }
-172         }
-173     }
-174 }
+1   /*
+2    * Copyright 2008 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.wayf.plugins.provider;
+18  
+19  import java.util.Collection;
+20  import java.util.HashSet;
+21  import java.util.Iterator;
+22  import java.util.List;
+23  
+24  import org.opensaml.saml2.common.Extensions;
+25  import org.opensaml.saml2.metadata.EntitiesDescriptor;
+26  import org.opensaml.saml2.metadata.EntityDescriptor;
+27  import org.opensaml.saml2.metadata.RoleDescriptor;
+28  import org.opensaml.saml2.metadata.SPSSODescriptor;
+29  import org.opensaml.saml2.metadata.provider.FilterException;
+30  import org.opensaml.saml2.metadata.provider.MetadataFilter;
+31  import org.opensaml.samlext.idpdisco.DiscoveryResponse;
+32  import org.opensaml.xml.XMLObject;
+33  import org.slf4j.Logger;
+34  import org.slf4j.LoggerFactory;
+35  
+36  /**
+37   * See SDSJ-48.  If we get a DS endpoint then we need to check that the binding is provided
+38   * and that it is correct.
+39   * 
+40   * @author Rod Widdowson
+41   *
+42   */
+43  public class BindingFilter implements MetadataFilter {
+44  
+45      /**
+46       * Log for the warning. 
+47       */
+48      private static final Logger LOG = LoggerFactory.getLogger(BindingFilter.class.getName());
+49      
+50      /**
+51       * Set if we just want to warn on failure.
+52       */
+53      private final boolean warnOnFailure;
+54      
+55      /**
+56       * Only the protected constructor should be visible.
+57       */
+58      private BindingFilter() {
+59          this.warnOnFailure = false;
+60      }
+61      
+62      /**
+63       * Initialize the filter.
+64       * @param warn do we warn or do we fail if we see badness?
+65       */
+66      public BindingFilter(boolean warn) {
+67          this.warnOnFailure = warn;
+68      }
+69      
+70      /**
+71       * Apply the filter.
+72       * @see org.opensaml.saml2.metadata.provider.MetadataFilter#doFilter(org.opensaml.xml.XMLObject)
+73       * @param metadata what to filter.
+74       * @throws org.opensaml.saml2.metadata.provider.FilterException if it sees any missed or bad bindings.
+75       */
+76      public void doFilter(XMLObject metadata) throws FilterException {
+77  
+78          if (metadata instanceof EntitiesDescriptor) {
+79              
+80              checkEntities((EntitiesDescriptor) metadata);
+81              
+82          } else if (metadata instanceof EntityDescriptor) {
+83              EntityDescriptor entity = (EntityDescriptor) metadata;
+84              
+85              if (!checkEntity(entity)) {
+86                  if (warnOnFailure) {
+87                      LOG.warn("Badly formatted binding for " + entity.getEntityID());
+88                  } else {
+89                      LOG.error("Badly formatted binding for top level entity " + entity.getEntityID());
+90                  }
+91              }
+92          }
+93      }
+94  
+95      /**
+96       * If the entity has an SP characteristic, and it has a DS endpoint
+97       * then check its binding.
+98       * 
+99       * @param entity what to check.
+100      * @return true if all is OK.
+101      */
+102     private static boolean checkEntity(EntityDescriptor entity) {
+103         List<RoleDescriptor> roles = entity.getRoleDescriptors();
+104         
+105         for (RoleDescriptor role:roles) {
+106             
+107             //
+108             // Check every role
+109             //
+110             if (role instanceof SPSSODescriptor) {
+111                 
+112                 //
+113                 // Grab hold of all the extensions for SPSSO descriptors
+114                 //
+115                 
+116                 Extensions exts = role.getExtensions();
+117                 if (exts != null) {
+118                     //
+119                     // We have some children check them form <DiscoveryResponse>
+120                     //
+121                     List<XMLObject> children = exts.getOrderedChildren();
+122                     
+123                     for (XMLObject obj : children) {
+124                         if (obj instanceof DiscoveryResponse) {
+125                             //
+126                             // And check or the binding
+127                             //
+128                             DiscoveryResponse ds = (DiscoveryResponse) obj;
+129                             String binding = ds.getBinding(); 
+130 
+131                             if (!DiscoveryResponse.IDP_DISCO_NS.equals(binding)) {
+132                                 return false;
+133                             }
+134                         }
+135                     }
+136                 }
+137             }
+138         }
+139         return true;
+140     }
+141     
+142     /**
+143      * Check an EntitiesDescriptor call checkentities for the Entities and ourselves
+144      *  recursively for the EntitesDescriptors.
+145      *  
+146      * @param entities what to check.
+147      */
+148     private void checkEntities(EntitiesDescriptor entities) {
+149         List<EntitiesDescriptor> childEntities = entities.getEntitiesDescriptors();
+150         List<EntityDescriptor> children = entities.getEntityDescriptors();
+151         Collection<EntityDescriptor> excludes = new HashSet<EntityDescriptor>();
+152         
+153         if (children != null) {
+154             Iterator<EntityDescriptor> itr;
+155             EntityDescriptor entity;
+156             itr = children.iterator();
+157             
+158             while (itr.hasNext()) {
+159                 entity = itr.next();
+160                 if (!checkEntity(entity)) { 
+161                     if (warnOnFailure) {
+162                         LOG.warn("Badly formatted binding for " + entity.getEntityID());
+163                     } else {
+164                         LOG.error("Badly formatted binding for " + entity.getEntityID() + ". Entity has been removed");
+165                         excludes.add(entity);
+166                     }
+167                 }
+168             }
+169             children.removeAll(excludes);
+170         }
+171         
+172         if (childEntities != null) {
+173             for (EntitiesDescriptor descriptor : childEntities) {
+174                 checkEntities(descriptor);
+175             }
+176         }
+177     }
+178 }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/ListFilter.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/ListFilter.html index d0b7acc..ad96e7d 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/ListFilter.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/ListFilter.html @@ -1,196 +1,202 @@ - + ListFilter xref
View Javadoc
 
-1   /*
-2    * Copyright 2008 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.wayf.plugins.provider;
-18  
-19  import java.util.HashSet;
-20  import java.util.Iterator;
-21  import java.util.List;
-22  import java.util.Set;
-23  
-24  import org.opensaml.saml2.metadata.EntitiesDescriptor;
-25  import org.opensaml.saml2.metadata.EntityDescriptor;
-26  import org.opensaml.saml2.metadata.provider.FilterException;
-27  import org.opensaml.saml2.metadata.provider.MetadataFilter;
-28  import org.opensaml.xml.XMLObject;
-29  import org.slf4j.Logger;
-30  import org.slf4j.LoggerFactory;
-31  import org.w3c.dom.Element;
-32  import org.w3c.dom.NodeList;
-33  
-34  import edu.internet2.middleware.shibboleth.wayf.XMLConstants;
-35  
-36  /**
-37   * See SDSJ-57.  Explicit 
-38   * 
-39   * @author Rod Widdowson
-40   *
-41   */
-42  public class ListFilter implements MetadataFilter {
-43  
-44      /**
-45       * Log for any messages.
-46       */
-47      private static final Logger LOG = LoggerFactory.getLogger(ListFilter.class.getName());
-48      
-49      /**
-50       * Set if this is a blacklist.
-51       */
-52      private boolean excludeEntries;
-53      
-54      /**
-55       * The list of entities.
-56       */
-57      private final Set<String> filterEntities;
-58      
-59      /**
-60       * The name of the filter (needed for debug).
-61       */
-62      private final String filterName;
-63      
-64      /**
-65       * Only the protected constructor should be visible.
-66       */
-67      private ListFilter() {
-68          this.excludeEntries = false;
-69          this.filterEntities = new HashSet<String>(0);
-70          this.filterName = "anonymous";
-71      }
-72      
-73      /**
-74       * Initialize the filter.
-75       * @param config the configuration
-76       *
-77       * The configuration looks liken this
-78       * <code> <Filter identifier="WhiteList" 
-79       *                type ="edu.internet2.middleware.shibboleth.wayf.plugins.provider.ListFilter"
-80       *                excludeEntries = "true" >
-81       *        <EntityId>foo</EntityId>
-82       *        [...]
-83       *        </Filter>
-84       *  </code>
-85       */
-86      public ListFilter(Element config) {
-87          String excludeEntriesValue;
-88          this.filterEntities = new HashSet<String>(10);
-89          this.filterName = config.getAttribute("identifier");
-90          excludeEntriesValue = config.getAttribute("excludeEntries");
-91          
-92          if (null == excludeEntriesValue || 0 == excludeEntriesValue.length()) {
-93              this.excludeEntries = true;
-94          } else {
-95              this.excludeEntries = Boolean.getBoolean(excludeEntriesValue);
-96          }
-97          
-98          NodeList itemElements = config.getElementsByTagNameNS(XMLConstants.CONFIG_NS, "EntityId");
-99          
-100         if (excludeEntries) {
-101             LOG.debug("Populating blacklist " + filterName);
-102         } else {
-103             LOG.debug("Populating whitelist " + filterName);
-104         }  
-105         
-106         for (int i = 0; i < itemElements.getLength(); i++) {
-107             Element element = (Element) itemElements.item(i);
-108             String entityId = element.getTextContent();
-109             
-110             LOG.debug("\t" + entityId);
-111             this.filterEntities.add(entityId);
-112         }
-113     }
-114     
-115     /**
-116      * Apply the filter.
-117      * @see org.opensaml.saml2.metadata.provider.MetadataFilter#doFilter(org.opensaml.xml.XMLObject)
-118      * @param metadata what to filter.
-119      * @throws FilterException if it sees any missed or bad bindings.
-120      */
-121     public void doFilter(XMLObject metadata) throws FilterException {
-122 
-123         if (metadata instanceof EntitiesDescriptor) { 
-124             filterEntities((EntitiesDescriptor)metadata);
-125         } else if (metadata instanceof EntityDescriptor) {
-126             EntityDescriptor entity = (EntityDescriptor) metadata;
-127             String entityName = entity.getEntityID();
-128             
-129             if (excludeEntries) {
-130                 if (filterEntities.contains(entityName)) {
-131                     LOG.error("Metadata provider contains a single <EntityDescriptor> (" + entityName + 
-132                               ") which is in exclude list");
-133                 }
-134             } else if (!filterEntities.contains(entity.getEntityID())) {
-135                 LOG.error("Metadata provider contains a single <EntityDescriptor>  (" + entityName + 
-136                           ") which is not on include list");
-137             }
-138         }
-139     }
-140 
-141     /**
-142      * Filter an EntitiesDescriptor .  We do this explictly for the Entities and call ourselves
-143      *  recursively for the EntitesDescriptors.
-144      *  
-145      * @param entities what to check.
-146      */
-147     private void filterEntities(EntitiesDescriptor entities) {
-148         String entitiesName = entities.getName();
-149         List<EntitiesDescriptor> childEntities = entities.getEntitiesDescriptors();
-150         List<EntityDescriptor> children = entities.getEntityDescriptors();
-151         
-152         //
-153         // Go through and apply the filter
-154         //
-155 
-156         if (children != null) {
-157             Iterator<EntityDescriptor> itr;
-158             EntityDescriptor entity;
-159             itr = children.iterator();
-160             
-161             while (itr.hasNext()) {
-162                 entity = itr.next();
-163                 String entityName = entity.getEntityID();
-164                 if (excludeEntries) {
-165 
-166                     if (filterEntities.contains(entityName)) {
-167                         LOG.debug("Filter " + filterName + ": Removing blacklisted "  + entityName + " from " + entitiesName);
-168                         itr.remove();
-169                     }
-170                 } else if (!filterEntities.contains(entityName)) {
-171                     LOG.debug("Filter " + filterName + ": Removing non-whitelisted "  + entityName + " from " + entitiesName);
-172                     itr.remove();
-173                 }
-174             } 
-175         }
-176         
-177         if (childEntities != null) {
-178             for (EntitiesDescriptor descriptor : childEntities) {
-179                 filterEntities(descriptor);
-180             }
-181         }
-182     }
-183 }
+1   /*
+2    * Copyright 2008 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.wayf.plugins.provider;
+18  
+19  import java.util.Collection;
+20  import java.util.HashSet;
+21  import java.util.Iterator;
+22  import java.util.List;
+23  import java.util.Set;
+24  
+25  import org.opensaml.saml2.metadata.EntitiesDescriptor;
+26  import org.opensaml.saml2.metadata.EntityDescriptor;
+27  import org.opensaml.saml2.metadata.provider.FilterException;
+28  import org.opensaml.saml2.metadata.provider.MetadataFilter;
+29  import org.opensaml.xml.XMLObject;
+30  import org.slf4j.Logger;
+31  import org.slf4j.LoggerFactory;
+32  import org.w3c.dom.Element;
+33  import org.w3c.dom.NodeList;
+34  
+35  import edu.internet2.middleware.shibboleth.wayf.XMLConstants;
+36  
+37  /**
+38   * See SDSJ-57.  Explicit 
+39   * 
+40   * @author Rod Widdowson
+41   *
+42   */
+43  public class ListFilter implements MetadataFilter {
+44  
+45      /**
+46       * Log for any messages.
+47       */
+48      private static final Logger LOG = LoggerFactory.getLogger(ListFilter.class.getName());
+49      
+50      /**
+51       * Set if this is a blacklist.
+52       */
+53      private boolean excludeEntries;
+54      
+55      /**
+56       * The list of entities.
+57       */
+58      private final Set<String> filterEntities;
+59      
+60      /**
+61       * The name of the filter (needed for debug).
+62       */
+63      private final String filterName;
+64      
+65      /**
+66       * Only the protected constructor should be visible.
+67       */
+68      private ListFilter() {
+69          this.excludeEntries = false;
+70          this.filterEntities = new HashSet<String>(0);
+71          this.filterName = "anonymous";
+72      }
+73      
+74      /**
+75       * Initialize the filter.
+76       * @param config the configuration
+77       *
+78       * The configuration looks liken this
+79       * <code> <Filter identifier="WhiteList" 
+80       *                type ="edu.internet2.middleware.shibboleth.wayf.plugins.provider.ListFilter"
+81       *                excludeEntries = "true" >
+82       *        <EntityId>foo</EntityId>
+83       *        [...]
+84       *        </Filter>
+85       *  </code>
+86       */
+87      public ListFilter(Element config) {
+88          String excludeEntriesValue;
+89          this.filterEntities = new HashSet<String>(10);
+90          this.filterName = config.getAttribute("identifier");
+91          excludeEntriesValue = config.getAttribute("excludeEntries");
+92          
+93          if (null == excludeEntriesValue || 0 == excludeEntriesValue.length()) {
+94              this.excludeEntries = true;
+95          } else {
+96              this.excludeEntries = Boolean.parseBoolean(excludeEntriesValue);
+97          }
+98          
+99          NodeList itemElements = config.getElementsByTagNameNS(XMLConstants.CONFIG_NS, "EntityId");
+100         
+101         if (excludeEntries) {
+102             LOG.debug("Populating blacklist " + filterName);
+103         } else {
+104             LOG.debug("Populating whitelist " + filterName);
+105         }  
+106         
+107         for (int i = 0; i < itemElements.getLength(); i++) {
+108             Element element = (Element) itemElements.item(i);
+109             String entityId = element.getTextContent();
+110             
+111             LOG.debug("\t" + entityId);
+112             this.filterEntities.add(entityId);
+113         }
+114     }
+115     
+116     /**
+117      * Apply the filter.
+118      * @see org.opensaml.saml2.metadata.provider.MetadataFilter#doFilter(org.opensaml.xml.XMLObject)
+119      * @param metadata what to filter.
+120      * @throws FilterException if it sees any missed or bad bindings.
+121      */
+122     public void doFilter(XMLObject metadata) throws FilterException {
+123 
+124         if (metadata instanceof EntitiesDescriptor) { 
+125             filterEntities((EntitiesDescriptor)metadata);
+126         } else if (metadata instanceof EntityDescriptor) {
+127             EntityDescriptor entity = (EntityDescriptor) metadata;
+128             String entityName = entity.getEntityID();
+129             
+130             if (excludeEntries) {
+131                 if (filterEntities.contains(entityName)) {
+132                     LOG.error("Metadata provider contains a single <EntityDescriptor> (" + entityName + 
+133                               ") which is in exclude list");
+134                 }
+135             } else if (!filterEntities.contains(entity.getEntityID())) {
+136                 LOG.error("Metadata provider contains a single <EntityDescriptor>  (" + entityName + 
+137                           ") which is not on include list");
+138             }
+139         }
+140     }
+141 
+142     /**
+143      * Filter an EntitiesDescriptor .  We do this explictly for the Entities and call ourselves
+144      *  recursively for the EntitesDescriptors.
+145      *  
+146      * @param entities what to check.
+147      */
+148     private void filterEntities(EntitiesDescriptor entities) {
+149         String entitiesName = entities.getName();
+150         List<EntitiesDescriptor> childEntities = entities.getEntitiesDescriptors();
+151         List<EntityDescriptor> children = entities.getEntityDescriptors();
+152         Collection<EntityDescriptor> excludes = new HashSet<EntityDescriptor>();
+153         
+154         //
+155         // Go through and apply the filter
+156         //
+157 
+158         if (children != null) {
+159             Iterator<EntityDescriptor> itr;
+160             EntityDescriptor entity;
+161             itr = children.iterator();
+162             
+163             while (itr.hasNext()) {
+164                 entity = itr.next();
+165                 String entityName = entity.getEntityID();
+166                 if (excludeEntries) {
+167 
+168                     if (filterEntities.contains(entityName)) {
+169                         LOG.debug("Filter " + filterName + ": Removing blacklisted "  
+170                                 + entityName + " from " + entitiesName);
+171                         excludes.add(entity);
+172                     }
+173                 } else if (!filterEntities.contains(entityName)) {
+174                     LOG.debug("Filter " + filterName + ": Removing non-whitelisted "  
+175                             + entityName + " from " + entitiesName);
+176 
+177                     excludes.add(entity);
+178                 }
+179             } 
+180             children.removeAll(excludes);
+181         }
+182         
+183         if (childEntities != null) {
+184             for (EntitiesDescriptor descriptor : childEntities) {
+185                 filterEntities(descriptor);
+186             }
+187         }
+188     }
+189 }
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/SamlCookiePlugin.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/SamlCookiePlugin.html index 9e6528e..239909e 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/SamlCookiePlugin.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/SamlCookiePlugin.html @@ -1,557 +1,557 @@ - + SamlCookiePlugin xref
View Javadoc
 
-1   package edu.internet2.middleware.shibboleth.wayf.plugins.provider;
-2   
-3   import java.io.UnsupportedEncodingException;
-4   import java.net.URLDecoder;
-5   import java.net.URLEncoder;
-6   import java.util.ArrayList;
-7   import java.util.Collection;
-8   import java.util.Iterator;
-9   import java.util.List;
-10  import java.util.Map;
-11  
-12  import javax.servlet.http.Cookie;
-13  import javax.servlet.http.HttpServletRequest;
-14  import javax.servlet.http.HttpServletResponse;
-15  
-16  import org.apache.log4j.Logger;
-17  import org.opensaml.saml2.metadata.provider.MetadataProvider;
-18  import org.opensaml.xml.util.Base64;
-19  import org.w3c.dom.Element;
-20  
-21  import edu.internet2.middleware.shibboleth.wayf.DiscoveryServiceHandler;
-22  import edu.internet2.middleware.shibboleth.wayf.IdPSite;
-23  import edu.internet2.middleware.shibboleth.wayf.WayfException;
-24  import edu.internet2.middleware.shibboleth.wayf.plugins.Plugin;
-25  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginContext;
-26  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginMetadataParameter;
-27  import edu.internet2.middleware.shibboleth.wayf.plugins.WayfRequestHandled;
-28  
-29  /**
-30   * This is a test implementation of the saml cookie lookup stuff to 
-31   * see whether it fits the plugin architecture.
-32   * 
-33   * @author Rod Widdowson
-34   *
-35   */
-36  public class SamlCookiePlugin implements Plugin {
-37          
-38      /**
-39       * The parameter which controls the cache.
-40       */
-41      private static final String PARAMETER_NAME = "cache";
-42  
-43      /**
-44       * Parameter to say make it last a long time.
-45       */
-46      private static final String PARAMETER_PERM = "perm";
-47  
-48      /**
-49       * Parameter to say just keep this as long as the brower is open.
-50       */
-51      private static final String PARAMETER_SESSION = "session";
-52      
-53      /**
-54       * Handle for logging. 
-55       */
-56      private static Logger log = Logger.getLogger(SamlCookiePlugin.class.getName());
-57  
-58      /**
-59       * As specified in the SAML2 profiles specification.
-60       */
-61      private static final String COOKIE_NAME = "_saml_idp";
-62  
-63      /**
-64       * By default we keep the cookie around for a week.
-65       */
-66      private static final int DEFAULT_CACHE_EXPIRATION = 6048000;
-67      
-68      /**
-69       * Do we always go where the cookie tells us, or do we just provide the cookie as a hint.
-70       */
-71      private boolean alwaysFollow;
-72  
-73      /**
-74       * Is our job to clean up the cookie. 
-75       */
-76      private boolean deleteCookie;
-77      
-78      /**
-79       * Lipservice towards having a common domain cookie. 
-80       */
-81      private String cacheDomain; 
-82      
-83      /**
-84       * How long the cookie our will be active? 
-85       */
-86      private int cacheExpiration;
-87      
-88      /**
-89       * This constructor is called during wayf initialization with it's
-90       * own little bit of XML config.
-91       * 
-92       * @param element - further information to be gleaned from the DOM.
-93       */
-94      public SamlCookiePlugin(Element element) {
-95          /*
-96           * <Plugin idenfifier="WayfCookiePlugin" 
-97           *         type="edu.internet2.middleware.shibboleth.wayf.plugins.provider.SamlCookiePlugin"
-98           *         alwaysFollow = "FALSE"
-99           *         deleteCookie = "FALSE"
-100          *         cacheExpiration = "number" 
-101          *         cacheDomain = "string"/> 
-102          */
-103         log.info("New plugin");
-104         String s;
-105 
-106         s = element.getAttribute("alwaysFollow");
-107         if (s != null && !s.equals("") ) {
-108             alwaysFollow = Boolean.valueOf(s).booleanValue();
-109         } else {
-110             alwaysFollow = true;
-111         }
-112             
-113         s = element.getAttribute("deleteCookie");
-114         if (s != null && !s.equals("")) {
-115             deleteCookie = Boolean.valueOf(s).booleanValue();
-116         } else {
-117             deleteCookie = false;
-118         }
-119             
-120         s = element.getAttribute("cacheDomain");
-121         if ((s != null) && !s.equals("")) {
-122             cacheDomain = s;
-123         } else {
-124             cacheDomain = "";
-125         }
-126         
-127         s  = element.getAttribute("cacheExpiration");
-128         if ((s != null) && !s.equals("")) {
-129             
-130             try {
-131 
-132                 cacheExpiration = Integer.parseInt(s);
-133             } catch (NumberFormatException ex) {
-134                     
-135                 log.error("Invalid CacheExpiration value - " + s);
-136                 cacheExpiration = DEFAULT_CACHE_EXPIRATION;                       
-137             }
-138         } else {
-139             cacheExpiration = DEFAULT_CACHE_EXPIRATION;
-140         }
-141     }
-142     
-143     /**
-144      * Create a plugin with the hard-wired default settings.
-145      */
-146     private SamlCookiePlugin() {
-147         alwaysFollow = false;
-148         deleteCookie = false;
-149         cacheExpiration = DEFAULT_CACHE_EXPIRATION;
-150     }
-151 
-152     /**
-153      * This is the 'hook' in the lookup part of Discovery Service processing. 
-154      * 
-155      * @param req - Describes the current request.  Used to find any appropriate cookies 
-156      * @param res - Describes the current response.  Used to redirect the request. 
-157      * @param parameter - Describes the metadata.
-158      * @param context - Any processing context returned from a previous call. We set this on first call and
-159      *                  use non null to indicate that we don't go there again.
-160      * @param validIdps The list of IdPs which is currently views as possibly matches for the pattern. 
-161      *                  The Key is the EntityId for the IdP and the value the object which describes 
-162      *                  the Idp 
-163      * @param idpList The set of Idps which are currently considered as potential hints.    
-164      * @return a context to hand to subsequent calls
-165      * @throws WayfRequestHandled if the plugin has handled the request.
-166      * issues a redirect)
-167      * 
-168      * @see edu.internet2.middleware.shibboleth.wayf.plugins.Plugin#lookup
-169      */
-170     public PluginContext lookup(HttpServletRequest req,
-171                                 HttpServletResponse res,  
-172                                 PluginMetadataParameter parameter, 
-173                                 Map<String, IdPSite> validIdps,
-174                                 PluginContext context,
-175                                 List <IdPSite> idpList) throws WayfRequestHandled {
-176             
-177         if (context != null) {
-178             //
-179             // We only need to be called once
-180             //
-181             return context;
-182         }
-183             
-184         if (deleteCookie) {
-185             deleteCookie(req, res);
-186             //
-187             // Only need to be called once - so set up a parameter
-188             //
-189             return new Context() ;
-190         } 
-191         List <String> idps = getIdPCookie(req, res, cacheDomain).getIdPList();
-192             
-193         for (String idpName : idps) {
-194             IdPSite idp = validIdps.get(idpName);
-195             if (idp != null) {
-196                 if (alwaysFollow) {
-197                     try {
-198                         DiscoveryServiceHandler.forwardRequest(req, res, idp);
-199                     } catch (WayfException e) {
-200                         // Do nothing we are going to throw anyway
-201                         ;
-202                     }
-203                     throw new WayfRequestHandled();
-204                 }
-205                 //
-206                 // This IDP is ok 
-207                 //
-208                 idpList.add(idp);
-209             }
-210         } 
-211             
-212         return null;
-213     }
-214 
-215     /**
-216      * Plugin point which is called when the data is refreshed.
-217      * @param metadata - where to get the data from.
-218      * @return the value which will be provided as input to subsequent calls
-219      * @see edu.internet2.middleware.shibboleth.wayf.plugins.Plugin#refreshMetadata
-220      */
-221     public PluginMetadataParameter refreshMetadata(MetadataProvider metadata) {
-222         //
-223         // We don't care about metadata - we are given all that we need
-224         //
-225         return null;
-226     }
-227 
-228     /**
-229      * Plgin point for searching.
-230      * 
-231      * @throws WayfRequestHandled 
-232      * @param req Describes the current request. 
-233      * @param res Describes the current response.
-234      * @param parameter Describes the metadata.
-235      * @param pattern What we are searchign for. 
-236      * @param validIdps The list of IdPs which is currently views as possibly matches for the pattern. 
-237      *                  The Key is the EntityId for the IdP and the value the object which describes 
-238      *                  the Idp 
-239      * @param context Any processing context returned from a previous call. We set this on first call and
-240      *                use non null to indicate that we don't go there again.
-241      * @param searchResult What the search yielded. 
-242      * @param idpList The set of Idps which are currently considered as potential hints.    
-243      * @return a context to hand to subsequent calls.
-244      * @see edu.internet2.middleware.shibboleth.wayf.plugins.Plugin#search
-245      * @throws WayfRequestHandled if the plugin has handled the request.
-246      * 
-247      */
-248     public PluginContext search(HttpServletRequest req,
-249                                 HttpServletResponse res, 
-250                                 PluginMetadataParameter parameter, 
-251                                 String pattern,
-252                                 Map<String, IdPSite> validIdps,
-253                                 PluginContext context,
-254                                 Collection<IdPSite> searchResult,
-255                                 List<IdPSite> idpList) throws WayfRequestHandled {
-256         //
-257         // Don't distinguish between lookup and search
-258         //
-259         return lookup(req, res, parameter, validIdps, context, idpList);
-260     }
-261 
-262     /**
-263      * Plugin point for selection.
-264      * 
-265      * @see edu.internet2.middleware.shibboleth.wayf.plugins.Plugin#selected(javax.servlet.http.HttpServletRequest.
-266      *  javax.servlet.http.HttpServletResponse, 
-267      *  edu.internet2.middleware.shibboleth.wayf.plugins.PluginMetadataParameter, 
-268      *  java.lang.String)
-269      * @param req Describes the current request. 
-270      * @param res Describes the current response.
-271      * @param parameter Describes the metadata.
-272      * @param idP Describes the idp.
-273      * 
-274      */
-275     public void selected(HttpServletRequest req, HttpServletResponse res,
-276                          PluginMetadataParameter parameter, String idP) {
-277             
-278         SamlIdPCookie cookie = getIdPCookie(req, res, cacheDomain);
-279         String param = req.getParameter(PARAMETER_NAME);
-280         
-281         if (null == param || param.equals("")) {
-282             return;
-283         } else if (param.equalsIgnoreCase(PARAMETER_SESSION)) {
-284             cookie.addIdPName(idP, -1);
-285         } else if (param.equalsIgnoreCase(PARAMETER_PERM)) {
-286             cookie.addIdPName(idP, cacheExpiration);
-287         }
-288     }
-289     
-290     //
-291     // Private classes for internal use
-292     //
-293     
-294     /**
-295      * This is just a marker tag.
-296      */
-297     private static class Context implements PluginContext {}
-298     
-299     /** 
-300      * Class to abstract away the saml cookie for us.
-301      */
-302     public final class SamlIdPCookie  {
-303 
-304             
-305         /**
-306          * The associated request.
-307          */
-308         private final HttpServletRequest req;
-309         /**
-310          * The associated response.
-311          */
-312         private final HttpServletResponse res;
-313         /**
-314          * The associated domain.
-315          */
-316         private final String domain;
-317         /**
-318          * The IdPs.
-319          */
-320         private final List <String> idPList = new ArrayList<String>();
-321             
-322         /**
-323          * Constructs a <code>SamlIdPCookie</code> from the provided string (which is the raw data. 
-324          * 
-325          * @param codedData
-326          *            the information read from the cookie
-327          * @param request Describes the current request. 
-328          * @param response Describes the current response.
-329          * @param domainName - if non null the domain for any *created* cookie.
-330          */
-331         private SamlIdPCookie(String codedData, 
-332                               HttpServletRequest request, 
-333                               HttpServletResponse response, 
-334                               String domainName) {
-335                     
-336             this.req = request;
-337             this.res = response;
-338             this.domain = domainName;
-339                     
-340             int start;
-341             int end;
-342                     
-343             if (codedData == null || codedData.equals(""))  {
-344                 log.info("Empty cookie");
-345                 return;
-346             }
-347             //
-348             // An earlier version saved the cookie without URL encoding it, hence there may be 
-349             // spaces which in turn means we may be quoted.  Strip any quotes.
-350             //
-351             if (codedData.charAt(0) == '"' && codedData.charAt(codedData.length()-1) == '"') {
-352                 codedData = codedData.substring(1,codedData.length()-1);
-353             }
-354                     
-355             try {
-356                 codedData = URLDecoder.decode(codedData, "UTF-8");
-357             } catch (UnsupportedEncodingException e) {
-358                 log.error("could not decode cookie");
-359                 return;
-360             }
-361                     
-362             start = 0;
-363             end = codedData.indexOf(' ', start);
-364             while (end > 0) {
-365                 String value = codedData.substring(start, end);
-366                 start = end + 1;
-367                 end = codedData.indexOf(' ', start);
-368                 if (!value.equals("")) {
-369                     idPList.add(new String(Base64.decode(value)));
-370                 }
-371             }
-372             if (start < codedData.length()) {
-373                 String value = codedData.substring(start);
-374                 if (!value.equals("")) {
-375                     idPList.add(new String(Base64.decode(value)));
-376                 }
-377             }
-378         }
-379         /**
-380          * Create a SamlCookie with no data inside.
-381          * @param domainName - if non null, the domain of the new cookie 
-382          * @param request Describes the current request. 
-383          * @param response Describes the current response.
-384          *
-385          */
-386         private SamlIdPCookie(HttpServletRequest request, HttpServletResponse response, String domainName) {
-387             this.req = request;
-388             this.res = response;
-389             this.domain = domainName;
-390         }
-391 
-392         /**
-393          * Add the specified Shibboleth IdP Name to the cookie list or move to 
-394          * the front and then write it back.
-395          * 
-396          * We always add to the front (and remove from wherever it was)
-397          * 
-398          * @param idPName    - The name to be added
-399          * @param expiration - The expiration of the cookie or zero if it is to be unchanged
-400          */
-401         private void addIdPName(String idPName, int expiration) {
-402 
-403             idPList.remove(idPName);
-404             idPList.add(0, idPName);
-405 
-406             writeCookie(expiration);
-407         }
-408             
-409         /**
-410          * Delete the <b>entire<\b> cookie contents
-411          */
-412 
-413 
-414         /**
-415          * Remove origin from the cachedata and write it back.
-416          * 
-417          * @param origin what to remove.
-418          * @param expiration How long it will live.
-419          */
-420             
-421         public void deleteIdPName(String origin, int expiration) {
-422             idPList.remove(origin);
-423             writeCookie(expiration);
-424         }
-425 
-426         /**
-427          * Write back the cookie.
-428          * 
-429          * @param expiration How long it will live
-430          */
-431         private void writeCookie(int expiration) {
-432             Cookie cookie = getCookie(req);
-433                     
-434             if (idPList.size() == 0) {
-435                 //
-436                 // Nothing to write, so delete the cookie
-437                 //
-438                 cookie.setPath("/");
-439                 cookie.setMaxAge(0);
-440                 res.addCookie(cookie);
-441                 return;
-442             }
-443 
-444             //
-445             // Otherwise encode up the cookie
-446             //
-447             StringBuffer buffer = new StringBuffer();
-448             Iterator <String> it = idPList.iterator();
-449                     
-450             while (it.hasNext()) {
-451                 String next = it.next();
-452                 String what = new String(Base64.encodeBytes(next.getBytes()));
-453                 buffer.append(what).append(' ');
-454             }
-455                     
-456             String value;
-457             try {
-458                 value = URLEncoder.encode(buffer.toString(), "UTF-8");
-459             } catch (UnsupportedEncodingException e) {
-460                 log.error("Could not encode cookie");
-461                 return;
-462             }
-463                     
-464             if (cookie == null) { 
-465                 cookie = new Cookie(COOKIE_NAME, value);
-466             } else {
-467                 cookie.setValue(value);
-468             }
-469             cookie.setComment("Used to cache selection of a user's Shibboleth IdP");
-470             cookie.setPath("/");
-471 
-472 
-473             cookie.setMaxAge(expiration);
-474                     
-475             if (domain != null && domain != "") {
-476                 cookie.setDomain(domain);
-477             }
-478             res.addCookie(cookie);
-479             
-480         }
-481     
-482         /**
-483          * Return the list of Idps for this cookie.
-484          * @return The list.
-485          */
-486         public List <String> getIdPList() {
-487             return idPList;
-488         }
-489     }
-490 
-491     /**
-492      * Extract the cookie from a request.
-493      * @param req the request.
-494      * @return the cookie.
-495      */
-496     private static Cookie getCookie(HttpServletRequest req) {
-497             
-498         Cookie[] cookies = req.getCookies();
-499         if (cookies != null) {
-500             for (int i = 0; i < cookies.length; i++) {
-501                 if (cookies[i].getName().equals(COOKIE_NAME)) { 
-502                     return cookies[i];
-503                 }
-504             }
-505         }
-506         return null;
-507     }
-508 
-509     /**
-510      * Delete the cookie from the response.
-511      * @param req The request.
-512      * @param res The response.
-513      */
-514     private static void deleteCookie(HttpServletRequest req, HttpServletResponse res) {
-515         Cookie cookie = getCookie(req);
-516             
-517         if (cookie == null) { 
-518             return; 
-519         }
-520             
-521         cookie.setPath("/");
-522         cookie.setMaxAge(0);
-523         res.addCookie(cookie);
-524     }
-525     /**
-526      * Load up the cookie and convert it into a SamlIdPCookie.  If there is no
-527      * underlying cookie return a null one.
-528      * @param req The request.
-529      * @param res The response.
-530      * @param domain - if this is set then any <b>created</b> cookies are set to this domain
-531      * @return the new object. 
-532      */
-533     
-534     private SamlIdPCookie getIdPCookie(HttpServletRequest req, HttpServletResponse res, String domain) {
-535         Cookie cookie = getCookie(req);
-536             
-537         if (cookie == null) {
-538             return new SamlIdPCookie(req, res, domain);
-539         } else {
-540             return new SamlIdPCookie(cookie.getValue(), req, res, domain);
-541         }
-542     }
-543 }
-544 
+1   package edu.internet2.middleware.shibboleth.wayf.plugins.provider;
+2   
+3   import java.io.UnsupportedEncodingException;
+4   import java.net.URLDecoder;
+5   import java.net.URLEncoder;
+6   import java.util.ArrayList;
+7   import java.util.Collection;
+8   import java.util.Iterator;
+9   import java.util.List;
+10  import java.util.Map;
+11  
+12  import javax.servlet.http.Cookie;
+13  import javax.servlet.http.HttpServletRequest;
+14  import javax.servlet.http.HttpServletResponse;
+15  
+16  import org.apache.log4j.Logger;
+17  import org.opensaml.saml2.metadata.provider.MetadataProvider;
+18  import org.opensaml.xml.util.Base64;
+19  import org.w3c.dom.Element;
+20  
+21  import edu.internet2.middleware.shibboleth.wayf.DiscoveryServiceHandler;
+22  import edu.internet2.middleware.shibboleth.wayf.IdPSite;
+23  import edu.internet2.middleware.shibboleth.wayf.WayfException;
+24  import edu.internet2.middleware.shibboleth.wayf.plugins.Plugin;
+25  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginContext;
+26  import edu.internet2.middleware.shibboleth.wayf.plugins.PluginMetadataParameter;
+27  import edu.internet2.middleware.shibboleth.wayf.plugins.WayfRequestHandled;
+28  
+29  /**
+30   * This is a test implementation of the saml cookie lookup stuff to 
+31   * see whether it fits the plugin architecture.
+32   * 
+33   * @author Rod Widdowson
+34   *
+35   */
+36  public class SamlCookiePlugin implements Plugin {
+37          
+38      /**
+39       * The parameter which controls the cache.
+40       */
+41      private static final String PARAMETER_NAME = "cache";
+42  
+43      /**
+44       * Parameter to say make it last a long time.
+45       */
+46      private static final String PARAMETER_PERM = "perm";
+47  
+48      /**
+49       * Parameter to say just keep this as long as the brower is open.
+50       */
+51      private static final String PARAMETER_SESSION = "session";
+52      
+53      /**
+54       * Handle for logging. 
+55       */
+56      private static Logger log = Logger.getLogger(SamlCookiePlugin.class.getName());
+57  
+58      /**
+59       * As specified in the SAML2 profiles specification.
+60       */
+61      private static final String COOKIE_NAME = "_saml_idp";
+62  
+63      /**
+64       * By default we keep the cookie around for a week.
+65       */
+66      private static final int DEFAULT_CACHE_EXPIRATION = 6048000;
+67      
+68      /**
+69       * Do we always go where the cookie tells us, or do we just provide the cookie as a hint.
+70       */
+71      private boolean alwaysFollow;
+72  
+73      /**
+74       * Is our job to clean up the cookie. 
+75       */
+76      private boolean deleteCookie;
+77      
+78      /**
+79       * Lipservice towards having a common domain cookie. 
+80       */
+81      private String cacheDomain; 
+82      
+83      /**
+84       * How long the cookie our will be active? 
+85       */
+86      private int cacheExpiration;
+87      
+88      /**
+89       * This constructor is called during wayf initialization with it's
+90       * own little bit of XML config.
+91       * 
+92       * @param element - further information to be gleaned from the DOM.
+93       */
+94      public SamlCookiePlugin(Element element) {
+95          /*
+96           * <Plugin idenfifier="WayfCookiePlugin" 
+97           *         type="edu.internet2.middleware.shibboleth.wayf.plugins.provider.SamlCookiePlugin"
+98           *         alwaysFollow = "FALSE"
+99           *         deleteCookie = "FALSE"
+100          *         cacheExpiration = "number" 
+101          *         cacheDomain = "string"/> 
+102          */
+103         log.info("New plugin");
+104         String s;
+105 
+106         s = element.getAttribute("alwaysFollow");
+107         if (s != null && !s.equals("") ) {
+108             alwaysFollow = Boolean.valueOf(s).booleanValue();
+109         } else {
+110             alwaysFollow = true;
+111         }
+112             
+113         s = element.getAttribute("deleteCookie");
+114         if (s != null && !s.equals("")) {
+115             deleteCookie = Boolean.valueOf(s).booleanValue();
+116         } else {
+117             deleteCookie = false;
+118         }
+119             
+120         s = element.getAttribute("cacheDomain");
+121         if ((s != null) && !s.equals("")) {
+122             cacheDomain = s;
+123         } else {
+124             cacheDomain = "";
+125         }
+126         
+127         s  = element.getAttribute("cacheExpiration");
+128         if ((s != null) && !s.equals("")) {
+129             
+130             try {
+131 
+132                 cacheExpiration = Integer.parseInt(s);
+133             } catch (NumberFormatException ex) {
+134                     
+135                 log.error("Invalid CacheExpiration value - " + s);
+136                 cacheExpiration = DEFAULT_CACHE_EXPIRATION;                       
+137             }
+138         } else {
+139             cacheExpiration = DEFAULT_CACHE_EXPIRATION;
+140         }
+141     }
+142     
+143     /**
+144      * Create a plugin with the hard-wired default settings.
+145      */
+146     private SamlCookiePlugin() {
+147         alwaysFollow = false;
+148         deleteCookie = false;
+149         cacheExpiration = DEFAULT_CACHE_EXPIRATION;
+150     }
+151 
+152     /**
+153      * This is the 'hook' in the lookup part of Discovery Service processing. 
+154      * 
+155      * @param req - Describes the current request.  Used to find any appropriate cookies 
+156      * @param res - Describes the current response.  Used to redirect the request. 
+157      * @param parameter - Describes the metadata.
+158      * @param context - Any processing context returned from a previous call. We set this on first call and
+159      *                  use non null to indicate that we don't go there again.
+160      * @param validIdps The list of IdPs which is currently views as possibly matches for the pattern. 
+161      *                  The Key is the EntityId for the IdP and the value the object which describes 
+162      *                  the Idp 
+163      * @param idpList The set of Idps which are currently considered as potential hints.    
+164      * @return a context to hand to subsequent calls
+165      * @throws WayfRequestHandled if the plugin has handled the request.
+166      * issues a redirect)
+167      * 
+168      * @see edu.internet2.middleware.shibboleth.wayf.plugins.Plugin#lookup
+169      */
+170     public PluginContext lookup(HttpServletRequest req,
+171                                 HttpServletResponse res,  
+172                                 PluginMetadataParameter parameter, 
+173                                 Map<String, IdPSite> validIdps,
+174                                 PluginContext context,
+175                                 List <IdPSite> idpList) throws WayfRequestHandled {
+176             
+177         if (context != null) {
+178             //
+179             // We only need to be called once
+180             //
+181             return context;
+182         }
+183             
+184         if (deleteCookie) {
+185             deleteCookie(req, res);
+186             //
+187             // Only need to be called once - so set up a parameter
+188             //
+189             return new Context() ;
+190         } 
+191         List <String> idps = getIdPCookie(req, res, cacheDomain).getIdPList();
+192             
+193         for (String idpName : idps) {
+194             IdPSite idp = validIdps.get(idpName);
+195             if (idp != null) {
+196                 if (alwaysFollow) {
+197                     try {
+198                         DiscoveryServiceHandler.forwardRequest(req, res, idp);
+199                     } catch (WayfException e) {
+200                         // Do nothing we are going to throw anyway
+201                         ;
+202                     }
+203                     throw new WayfRequestHandled();
+204                 }
+205                 //
+206                 // This IDP is ok 
+207                 //
+208                 idpList.add(idp);
+209             }
+210         } 
+211             
+212         return null;
+213     }
+214 
+215     /**
+216      * Plugin point which is called when the data is refreshed.
+217      * @param metadata - where to get the data from.
+218      * @return the value which will be provided as input to subsequent calls
+219      * @see edu.internet2.middleware.shibboleth.wayf.plugins.Plugin#refreshMetadata
+220      */
+221     public PluginMetadataParameter refreshMetadata(MetadataProvider metadata) {
+222         //
+223         // We don't care about metadata - we are given all that we need
+224         //
+225         return null;
+226     }
+227 
+228     /**
+229      * Plgin point for searching.
+230      * 
+231      * @throws WayfRequestHandled 
+232      * @param req Describes the current request. 
+233      * @param res Describes the current response.
+234      * @param parameter Describes the metadata.
+235      * @param pattern What we are searchign for. 
+236      * @param validIdps The list of IdPs which is currently views as possibly matches for the pattern. 
+237      *                  The Key is the EntityId for the IdP and the value the object which describes 
+238      *                  the Idp 
+239      * @param context Any processing context returned from a previous call. We set this on first call and
+240      *                use non null to indicate that we don't go there again.
+241      * @param searchResult What the search yielded. 
+242      * @param idpList The set of Idps which are currently considered as potential hints.    
+243      * @return a context to hand to subsequent calls.
+244      * @see edu.internet2.middleware.shibboleth.wayf.plugins.Plugin#search
+245      * @throws WayfRequestHandled if the plugin has handled the request.
+246      * 
+247      */
+248     public PluginContext search(HttpServletRequest req,
+249                                 HttpServletResponse res, 
+250                                 PluginMetadataParameter parameter, 
+251                                 String pattern,
+252                                 Map<String, IdPSite> validIdps,
+253                                 PluginContext context,
+254                                 Collection<IdPSite> searchResult,
+255                                 List<IdPSite> idpList) throws WayfRequestHandled {
+256         //
+257         // Don't distinguish between lookup and search
+258         //
+259         return lookup(req, res, parameter, validIdps, context, idpList);
+260     }
+261 
+262     /**
+263      * Plugin point for selection.
+264      * 
+265      * @see edu.internet2.middleware.shibboleth.wayf.plugins.Plugin#selected(javax.servlet.http.HttpServletRequest.
+266      *  javax.servlet.http.HttpServletResponse, 
+267      *  edu.internet2.middleware.shibboleth.wayf.plugins.PluginMetadataParameter, 
+268      *  java.lang.String)
+269      * @param req Describes the current request. 
+270      * @param res Describes the current response.
+271      * @param parameter Describes the metadata.
+272      * @param idP Describes the idp.
+273      * 
+274      */
+275     public void selected(HttpServletRequest req, HttpServletResponse res,
+276                          PluginMetadataParameter parameter, String idP) {
+277             
+278         SamlIdPCookie cookie = getIdPCookie(req, res, cacheDomain);
+279         String param = req.getParameter(PARAMETER_NAME);
+280         
+281         if (null == param || param.equals("")) {
+282             return;
+283         } else if (param.equalsIgnoreCase(PARAMETER_SESSION)) {
+284             cookie.addIdPName(idP, -1);
+285         } else if (param.equalsIgnoreCase(PARAMETER_PERM)) {
+286             cookie.addIdPName(idP, cacheExpiration);
+287         }
+288     }
+289     
+290     //
+291     // Private classes for internal use
+292     //
+293     
+294     /**
+295      * This is just a marker tag.
+296      */
+297     private static class Context implements PluginContext {}
+298     
+299     /** 
+300      * Class to abstract away the saml cookie for us.
+301      */
+302     public final class SamlIdPCookie  {
+303 
+304             
+305         /**
+306          * The associated request.
+307          */
+308         private final HttpServletRequest req;
+309         /**
+310          * The associated response.
+311          */
+312         private final HttpServletResponse res;
+313         /**
+314          * The associated domain.
+315          */
+316         private final String domain;
+317         /**
+318          * The IdPs.
+319          */
+320         private final List <String> idPList = new ArrayList<String>();
+321             
+322         /**
+323          * Constructs a <code>SamlIdPCookie</code> from the provided string (which is the raw data. 
+324          * 
+325          * @param codedData
+326          *            the information read from the cookie
+327          * @param request Describes the current request. 
+328          * @param response Describes the current response.
+329          * @param domainName - if non null the domain for any *created* cookie.
+330          */
+331         private SamlIdPCookie(String codedData, 
+332                               HttpServletRequest request, 
+333                               HttpServletResponse response, 
+334                               String domainName) {
+335                     
+336             this.req = request;
+337             this.res = response;
+338             this.domain = domainName;
+339                     
+340             int start;
+341             int end;
+342                     
+343             if (codedData == null || codedData.equals(""))  {
+344                 log.info("Empty cookie");
+345                 return;
+346             }
+347             //
+348             // An earlier version saved the cookie without URL encoding it, hence there may be 
+349             // spaces which in turn means we may be quoted.  Strip any quotes.
+350             //
+351             if (codedData.charAt(0) == '"' && codedData.charAt(codedData.length()-1) == '"') {
+352                 codedData = codedData.substring(1,codedData.length()-1);
+353             }
+354                     
+355             try {
+356                 codedData = URLDecoder.decode(codedData, "UTF-8");
+357             } catch (UnsupportedEncodingException e) {
+358                 log.error("could not decode cookie");
+359                 return;
+360             }
+361                     
+362             start = 0;
+363             end = codedData.indexOf(' ', start);
+364             while (end > 0) {
+365                 String value = codedData.substring(start, end);
+366                 start = end + 1;
+367                 end = codedData.indexOf(' ', start);
+368                 if (!value.equals("")) {
+369                     idPList.add(new String(Base64.decode(value)));
+370                 }
+371             }
+372             if (start < codedData.length()) {
+373                 String value = codedData.substring(start);
+374                 if (!value.equals("")) {
+375                     idPList.add(new String(Base64.decode(value)));
+376                 }
+377             }
+378         }
+379         /**
+380          * Create a SamlCookie with no data inside.
+381          * @param domainName - if non null, the domain of the new cookie 
+382          * @param request Describes the current request. 
+383          * @param response Describes the current response.
+384          *
+385          */
+386         private SamlIdPCookie(HttpServletRequest request, HttpServletResponse response, String domainName) {
+387             this.req = request;
+388             this.res = response;
+389             this.domain = domainName;
+390         }
+391 
+392         /**
+393          * Add the specified Shibboleth IdP Name to the cookie list or move to 
+394          * the front and then write it back.
+395          * 
+396          * We always add to the front (and remove from wherever it was)
+397          * 
+398          * @param idPName    - The name to be added
+399          * @param expiration - The expiration of the cookie or zero if it is to be unchanged
+400          */
+401         private void addIdPName(String idPName, int expiration) {
+402 
+403             idPList.remove(idPName);
+404             idPList.add(0, idPName);
+405 
+406             writeCookie(expiration);
+407         }
+408             
+409         /**
+410          * Delete the <b>entire<\b> cookie contents
+411          */
+412 
+413 
+414         /**
+415          * Remove origin from the cachedata and write it back.
+416          * 
+417          * @param origin what to remove.
+418          * @param expiration How long it will live.
+419          */
+420             
+421         public void deleteIdPName(String origin, int expiration) {
+422             idPList.remove(origin);
+423             writeCookie(expiration);
+424         }
+425 
+426         /**
+427          * Write back the cookie.
+428          * 
+429          * @param expiration How long it will live
+430          */
+431         private void writeCookie(int expiration) {
+432             Cookie cookie = getCookie(req);
+433                     
+434             if (idPList.size() == 0) {
+435                 //
+436                 // Nothing to write, so delete the cookie
+437                 //
+438                 cookie.setPath("/");
+439                 cookie.setMaxAge(0);
+440                 res.addCookie(cookie);
+441                 return;
+442             }
+443 
+444             //
+445             // Otherwise encode up the cookie
+446             //
+447             StringBuffer buffer = new StringBuffer();
+448             Iterator <String> it = idPList.iterator();
+449                     
+450             while (it.hasNext()) {
+451                 String next = it.next();
+452                 String what = new String(Base64.encodeBytes(next.getBytes()));
+453                 buffer.append(what).append(' ');
+454             }
+455                     
+456             String value;
+457             try {
+458                 value = URLEncoder.encode(buffer.toString(), "UTF-8");
+459             } catch (UnsupportedEncodingException e) {
+460                 log.error("Could not encode cookie");
+461                 return;
+462             }
+463                     
+464             if (cookie == null) { 
+465                 cookie = new Cookie(COOKIE_NAME, value);
+466             } else {
+467                 cookie.setValue(value);
+468             }
+469             cookie.setComment("Used to cache selection of a user's Shibboleth IdP");
+470             cookie.setPath("/");
+471 
+472 
+473             cookie.setMaxAge(expiration);
+474                     
+475             if (domain != null && domain != "") {
+476                 cookie.setDomain(domain);
+477             }
+478             res.addCookie(cookie);
+479             
+480         }
+481     
+482         /**
+483          * Return the list of Idps for this cookie.
+484          * @return The list.
+485          */
+486         public List <String> getIdPList() {
+487             return idPList;
+488         }
+489     }
+490 
+491     /**
+492      * Extract the cookie from a request.
+493      * @param req the request.
+494      * @return the cookie.
+495      */
+496     private static Cookie getCookie(HttpServletRequest req) {
+497             
+498         Cookie[] cookies = req.getCookies();
+499         if (cookies != null) {
+500             for (int i = 0; i < cookies.length; i++) {
+501                 if (cookies[i].getName().equals(COOKIE_NAME)) { 
+502                     return cookies[i];
+503                 }
+504             }
+505         }
+506         return null;
+507     }
+508 
+509     /**
+510      * Delete the cookie from the response.
+511      * @param req The request.
+512      * @param res The response.
+513      */
+514     private static void deleteCookie(HttpServletRequest req, HttpServletResponse res) {
+515         Cookie cookie = getCookie(req);
+516             
+517         if (cookie == null) { 
+518             return; 
+519         }
+520             
+521         cookie.setPath("/");
+522         cookie.setMaxAge(0);
+523         res.addCookie(cookie);
+524     }
+525     /**
+526      * Load up the cookie and convert it into a SamlIdPCookie.  If there is no
+527      * underlying cookie return a null one.
+528      * @param req The request.
+529      * @param res The response.
+530      * @param domain - if this is set then any <b>created</b> cookies are set to this domain
+531      * @return the new object. 
+532      */
+533     
+534     private SamlIdPCookie getIdPCookie(HttpServletRequest req, HttpServletResponse res, String domain) {
+535         Cookie cookie = getCookie(req);
+536             
+537         if (cookie == null) {
+538             return new SamlIdPCookie(req, res, domain);
+539         } else {
+540             return new SamlIdPCookie(cookie.getValue(), req, res, domain);
+541         }
+542     }
+543 }
+544 
 

diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/package-frame.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/package-frame.html index b7af423..e4a3b0a 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/package-frame.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/package-frame.html @@ -2,8 +2,8 @@ - - Shibboleth Discovery Service 1.1.1 Reference Package edu.internet2.middleware.shibboleth.wayf.plugins.provider + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.wayf.plugins.provider diff --git a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/package-summary.html b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/package-summary.html index 206dc1d..26b5292 100644 --- a/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/package-summary.html +++ b/doc/src-xref/edu/internet2/middleware/shibboleth/wayf/plugins/provider/package-summary.html @@ -2,8 +2,8 @@ - - Shibboleth Discovery Service 1.1.1 Reference Package edu.internet2.middleware.shibboleth.wayf.plugins.provider + + Shibboleth Discovery Service 1.1.2 Reference Package edu.internet2.middleware.shibboleth.wayf.plugins.provider @@ -82,6 +82,6 @@
- Copyright © 2006-2009 Internet2. All Rights Reserved. + Copyright © 2006-2010 Internet2. All Rights Reserved. \ No newline at end of file -- cgit v1.1