In the proposed example the Metadata Adapter functionalities are delegated to the "LiteralBasedProvider" (please refer to this GitHub project for source code). That is a ready-made Metadata Adapter, based on Java, which is provided as part of the Lightstreamer SDK as sample for inspiration and/or extension.

If you want to implement your specific Metadata Adapter functionalities, and specifically the management of authentication, then you must specify a new port to listen for the Metadata Adapter.

Code:
<!-- Mandatory. The Metadata Adapter is the Java Proxy Adapter. -->
    <metadata_provider>

        <!-- Mandatory. The NetworkedMetadataProvider communicates with its
             remote counterpart through standard TCP sockets. It listens on
             a specific port and waits for its counterpart to connect. -->
        <adapter_class>com.lightstreamer.adapters.remote.metadata.NetworkedMetadataProvider</adapter_class>

        <!-- Optional. If "Y", ensures that all Table (i.e. Subscription)
             notifications (that is, all the invocations to the Notify New Tables
             and Notify Tables Close methods) pertaining to the same session will
             be sequential, with no overlapping; if "N", then concurrent
             invocations will be possible.
             Note that the final invocation to Notify Session Close is always
             guaranteed to occur after all the above notifications have terminated.
             
             If not defined, the default value is "Y" (i.e. do sequentialize). -->
        <!--
        <sequentialize_table_notifications>N</sequentialize_table_notifications>
        -->

        <!-- Mandatory, specific for NetworkedMetadataProvider.
             The request/reply port to listen on. -->
        <param name="request_reply_port">7700</param>

        <!-- Optional, specific for NetworkedMetadataProvider.
             The local network interface to bind to.
             If not specified, it will bind to any available interface. -->
        <!--
        <param name="interface">192.168.1.1</param>
        -->

        <!-- Optional.
             Name of the Proxy Metadata Adapter, to better identify its threads when
             assessing problems. If not specified, it will be assigned a progressive number. -->
        <!--
        <param name="name">MyFeedMetadata</param>
        -->

        <!-- Optional, specific for NetworkedMetadataProvider and its subclasses.
             If true, the Proxy Adapter will wait for the completion of the
             initialization of the remote counterpart before beginning to
             forward requests; any exception occurred during initialization
             will be received.
             It can be set to false only in order to enforce compatibility
             with remote servers compliant with ARI version older than 1.5,
             which don't support remote initialization requests;
             on the other hand, a setting to false would not be supported by
             remote servers compliant with ARI version 1.5 or newer.
             Default: true. -->
        <param name="init_remote">false</param>

        <!-- Optional, specific for NetworkedMetadataProvider, ignored if
             "init_remote" is false.
             Determines the initialization parameters to be sent to the remote
             counterpart.
             The supplied value is meant as a prefix, such that all parameters
             supplied to this Proxy Adapter and whose names start with this
             prefix will be sent (an empty value is also supported, to match
             all parameters).
             Moreover, the following parameters, with obvious meaning, will
             also be sent:
             - adapters_conf.id
             Default: if not defined, no initialization parameters will be
             sent at all. -->
        <!--
        <param name="remote_params_prefix">remote_</param>
        -->
        <!--
        <param name="remote_xxxx">my value for the remote counterpart</param>
        -->

        <!-- Optional.
             Timeout for sent requests. A negative value stands for an unlimited timeout.
             Timed out requests are considered as failed and later answers are ignored.
             Default: 10000 ms (10 seconds). -->
        <!--
        <param name="timeout">10000</param>
        -->

        <!-- Optional.
             If set to false, suppresses clearing of the cached profile data
             for a user when no sessions for the user are active. This is only for
             troubleshooting purpose, as profile data are always refreshed upon
             notifyUser requests.
             Default: true. -->
        <!--
        <param name="clear_on_session_close">true</param>
        -->

        <!-- Optional.
             Sets the minimum time (in milliseconds) cached profile data are kept;
             these cached data are needed in order to manage request processing before a session
             is fully started. Ignored if clear_on_session_close is false.
             Default: 10000 ms (10 seconds). -->
        <!--
        <param name="user_data_timeout">1000</param>
        -->

    </metadata_provider>
And on this new port you have to connect with a new program or a new part of the one already in use, that responds to all requests from the Lightstreamer server. For a complete description of the protocol to manage refer here.