[java-identity-provider] 04/05: IDP-1423 Remove deprecated basicAuth from HTTP MetadataProviders

Rod Widdowson rdw at steadingsoftware.com
Mon Mar 4 08:33:18 EST 2019


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=00c698edffe9ef724ca1eb8fccb5e4e4e7c719d7

commit 00c698edffe9ef724ca1eb8fccb5e4e4e7c719d7
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Mar 4 13:23:52 2019 +0000

    IDP-1423 Remove deprecated basicAuth from HTTP MetadataProviders
    
    https://issues.shibboleth.net/jira/browse/IDP-1423
---
 .../AbstractDynamicHTTPMetadataProviderParser.java |  6 ---
 .../metadata/impl/HTTPMetadataProviderParser.java  |  7 ---
 .../impl/HTTPMetadataProvidersParserSupport.java   | 54 ++++------------------
 .../relyingparty/metadata/http-entities-client.xml |  2 +-
 .../main/resources/schema/shibboleth-metadata.xsd  | 32 -------------
 5 files changed, 9 insertions(+), 92 deletions(-)

diff --git a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/AbstractDynamicHTTPMetadataProviderParser.java b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/AbstractDynamicHTTPMetadataProviderParser.java
index bf3afcd..797f887 100644
--- a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/AbstractDynamicHTTPMetadataProviderParser.java
+++ b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/AbstractDynamicHTTPMetadataProviderParser.java
@@ -103,12 +103,6 @@ public abstract class AbstractDynamicHTTPMetadataProviderParser extends Abstract
                     httpClientSecurityParametersRef, httpClientSecurityParameters));
         }
 
-        if (element.hasAttributeNS(null, HTTPMetadataProvidersParserSupport.BASIC_AUTH_USER) ||
-           element.hasAttributeNS(null, HTTPMetadataProvidersParserSupport.BASIC_AUTH_PASSWORD)) {
-            builder.addPropertyValue("basicCredentials",
-                    HTTPMetadataProvidersParserSupport.buildBasicCredentials(element, parserContext));
-        }
-
         if (element.hasAttributeNS(null, "supportedContentTypes")) {
             final List<String> supportedContentTypes =
                     StringSupport.stringToList(
diff --git a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/HTTPMetadataProviderParser.java b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/HTTPMetadataProviderParser.java
index 05f330f..9f43ee3 100644
--- a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/HTTPMetadataProviderParser.java
+++ b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/HTTPMetadataProviderParser.java
@@ -85,13 +85,6 @@ public abstract class HTTPMetadataProviderParser extends AbstractReloadingMetada
         }
         builder.addConstructorArgValue(StringSupport.trimOrNull(element.getAttributeNS(null,
                 HTTPMetadataProvidersParserSupport.METADATA_URL)));
-
-        if (element.hasAttributeNS(null, HTTPMetadataProvidersParserSupport.BASIC_AUTH_USER)
-                || element.hasAttributeNS(null, HTTPMetadataProvidersParserSupport.BASIC_AUTH_PASSWORD)) {
-            builder.addPropertyValue("basicCredentials",
-                    HTTPMetadataProvidersParserSupport.buildBasicCredentials(element, parserContext));
-        }
-
     }
 // Checkstyle: CyclomaticComplexity ON
 
diff --git a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/HTTPMetadataProvidersParserSupport.java b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/HTTPMetadataProvidersParserSupport.java
index 68acfca..0c7a3b4 100644
--- a/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/HTTPMetadataProvidersParserSupport.java
+++ b/idp-profile-spring/src/main/java/net/shibboleth/idp/profile/spring/relyingparty/metadata/impl/HTTPMetadataProvidersParserSupport.java
@@ -21,11 +21,17 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.xml.namespace.QName;
 
+import org.opensaml.security.httpclient.HttpClientSecurityParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
 import net.shibboleth.ext.spring.util.SpringSupport;
 import net.shibboleth.idp.profile.spring.relyingparty.metadata.AbstractMetadataProviderParser;
-import net.shibboleth.idp.profile.spring.relyingparty.metadata.FileCachingHttpClientFactoryBean;
 import net.shibboleth.idp.profile.spring.relyingparty.metadata.HttpClientFactoryBean;
-import net.shibboleth.idp.profile.spring.relyingparty.metadata.InMemoryCachingHttpClientFactoryBean;
 import net.shibboleth.idp.profile.spring.relyingparty.metadata.TLSSocketFactoryFactoryBean;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -34,29 +40,11 @@ import net.shibboleth.utilities.java.support.primitive.DeprecationSupport.Object
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 import net.shibboleth.utilities.java.support.xml.ElementSupport;
 
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.opensaml.security.httpclient.HttpClientSecurityParameters;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
-import org.springframework.beans.factory.parsing.Location;
-import org.springframework.beans.factory.parsing.Problem;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.w3c.dom.Element;
-
 /**
  * Helper class for Spring configuration of HTTP metadata providers.
  */
 public final class HTTPMetadataProvidersParserSupport {
     
-    /** BASIC auth username. */
-    @Nonnull @NotEmpty public static final String BASIC_AUTH_USER = "basicAuthUser";
-
-    /** BASIC auth password. */
-    @Nonnull @NotEmpty public static final String BASIC_AUTH_PASSWORD = "basicAuthPassword";
-
     /** The URL for the metadata. */
     @Nonnull @NotEmpty public static final String METADATA_URL = "metadataURL";
 
@@ -109,32 +97,6 @@ public final class HTTPMetadataProvidersParserSupport {
     }
 
     /**
-     * Build the BeanDefinition for the POJO with the username and password.
-     * 
-     * @param element the HTTPMetadataProvider element
-     * @param parserContext parser context
-     * 
-     * @return the bean definition with the username and password.
-     */
-    @Nonnull protected static BeanDefinition buildBasicCredentials(final Element element,
-            @Nonnull final ParserContext parserContext) {
-        final BeanDefinitionBuilder builder =
-                BeanDefinitionBuilder.genericBeanDefinition(UsernamePasswordCredentials.class);
-
-        DeprecationSupport.warn(ObjectType.ATTRIBUTE, BASIC_AUTH_USER,
-                parserContext.getReaderContext().getResource().getDescription(), "httpClientSecurityParametersRef");
-        DeprecationSupport.warn(ObjectType.ATTRIBUTE, BASIC_AUTH_PASSWORD,
-                parserContext.getReaderContext().getResource().getDescription(), "httpClientSecurityParametersRef");
-
-        builder.setLazyInit(true);
-
-        builder.addConstructorArgValue(StringSupport.trimOrNull(element.getAttributeNS(null, BASIC_AUTH_USER)));
-        builder.addConstructorArgValue(StringSupport.trimOrNull(element.getAttributeNS(null, BASIC_AUTH_PASSWORD)));
-
-        return builder.getBeanDefinition();
-    }
-
-    /**
      * Build the BeanDefinition of the {@link HttpClientSecurityParameters} which contains the TLS trust engine
      * provided.
      * 
diff --git a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/http-entities-client.xml b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/http-entities-client.xml
index afea733..27303aa 100644
--- a/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/http-entities-client.xml
+++ b/idp-profile-spring/src/test/resources/net/shibboleth/idp/profile/spring/relyingparty/metadata/http-entities-client.xml
@@ -4,7 +4,7 @@
 	xsi:schemaLocation="urn:mace:shibboleth:2.0:metadata http://shibboleth.net/schema/idp/shibboleth-metadata.xsd
                        urn:oasis:names:tc:SAML:2.0:metadata http://docs.oasis-open.org/security/saml/v2.0/saml-schema-metadata-2.0.xsd"
 
-    parserPoolRef="myParserPool"  connectionTimeout="PT40M" basicAuthPassword="pass" basicAuthUser="user" disregardTLSCertificate="true" 
+    parserPoolRef="myParserPool"  connectionTimeout="PT40M" disregardTLSCertificate="true"
     	id="HTTPEntities" xsi:type="metadata:FileBackedHTTPMetadataProvider"
         backingFile="%{DIR}/spoolhttpentitiesClient.xml"
     	httpClientRef="apacheClient"
diff --git a/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd b/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
index 040c6c2..a43e7fb 100644
--- a/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
+++ b/idp-schema/src/main/resources/schema/shibboleth-metadata.xsd
@@ -221,20 +221,6 @@
                         </documentation>
                     </annotation>
                 </attribute>
-                <attribute name="basicAuthUser" type="string">
-                    <annotation>
-                        <documentation>
-                            The user name to provide, during basic authentication, when connecting to the remote server.
-                        </documentation>
-                    </annotation>
-                </attribute>
-                <attribute name="basicAuthPassword" type="string">
-                    <annotation>
-                        <documentation>
-                            The password to provide, during basic authentication, when connecting to the remote server.
-                        </documentation>
-                    </annotation>
-                </attribute>
                 <attribute name="tlsTrustEngineRef" type="string">
                     <annotation>
                         <documentation>
@@ -506,24 +492,6 @@
                         <documentation>Password for the HTTP proxy through which connections will be made.</documentation>
                     </annotation>
                 </attribute>
-                <attribute name="basicAuthUser" type="string">
-                    <annotation>
-                        <documentation>
-                            The user name to provide, during basic authentication, when connecting to the remote server.
-                            This is a convenience property for the case of a single basic auth user credential, and is 
-                            mutually exclusive with setting a credentialsProviderRef.
-                        </documentation>
-                    </annotation>
-                </attribute>
-                <attribute name="basicAuthPassword" type="string">
-                    <annotation>
-                        <documentation>
-                            The password to provide, during basic authentication, when connecting to the remote server.
-                            This is a convenience property for the case of a single basic auth user credential, and is 
-                            mutually exclusive with setting a credentialsProviderRef.
-                        </documentation>
-                    </annotation>
-                </attribute>
                 <attribute name="tlsTrustEngineRef" type="string">
                     <annotation>
                         <documentation>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list