Class MockBasicAuthenticationProvider

  • All Implemented Interfaces:
    HttpClientProvider, java.io.Closeable, java.lang.AutoCloseable

    public class MockBasicAuthenticationProvider
    extends java.lang.Object
    implements HttpClientProvider, java.io.Closeable
    • Field Detail

      • clientBuilder

        protected org.apache.http.impl.client.HttpClientBuilder clientBuilder
    • Constructor Detail

      • MockBasicAuthenticationProvider

        public MockBasicAuthenticationProvider()
    • Method Detail

      • prepareHttpClient

        public org.apache.http.impl.client.CloseableHttpClient prepareHttpClient​(java.lang.String url)
        Description copied from interface: HttpClientProvider
        This method should be called by the scanner before every execution of an Http command. It is typically a lightweight call since the provider returns the same client object if it is still valid. The provider will create a new client when needed, for example when the client has timed out. The url that the scanner is going to execute should be passed to HttpClientProvider.prepareHttpClient(String url) for cases where different Http clients are provided for different Urls. For example when different authentication is required.
        Specified by:
        prepareHttpClient in interface HttpClientProvider
        Parameters:
        url - The url the returned Http client will be used for.
        Returns:
        Http client to be used by the scanner
      • configureHttpClientProvider

        public void configureHttpClientProvider​(HttpDataSourceScanner scanner)
      • setCredentials

        protected void setCredentials​(HttpDataSourceScanner scanner,
                                      org.apache.http.client.CredentialsProvider credentialsProvider)
      • getAuthScope

        protected static org.apache.http.auth.AuthScope getAuthScope​(java.lang.String host,
                                                                     int port,
                                                                     java.lang.String realm,
                                                                     java.lang.String scheme)
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException