orientechnologies / OrientDB.Net.Core

Experimental Modular OrientDB .Net Core Driver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connecting to an HTTPS OrientDb instance

ComeOutToPlay opened this issue · comments

I started OrientDb with a certificate to run over HTTPS. That works. But I cannot connect with the .NET Core driver to the OrientDb server.

Configuration at orientdb-server-config.xml is as follows:

    <network>
        <sockets>
            <socket implementation="com.orientechnologies.orient.server.network.OServerTLSSocketFactory" name="ssl">
                <parameters>
                    <parameter value="false" name="network.ssl.clientAuth"/>
                    <parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/>
                    <parameter value="password" name="network.ssl.keyStorePassword"/>
                    <parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/>
                    <parameter value="password" name="network.ssl.trustStorePassword"/>
                </parameters>
            </socket>
            <socket implementation="com.orientechnologies.orient.server.network.OServerTLSSocketFactory" name="https">
                <parameters>
                    <parameter value="false" name="network.ssl.clientAuth"/>
                    <parameter value="config/cert/orientdb.ks" name="network.ssl.keyStore"/>
                    <parameter value="Store241" name="network.ssl.keyStorePassword"/>
                    <parameter value="config/cert/orientdb.ks" name="network.ssl.trustStore"/>
                    <parameter value="Store241" name="network.ssl.trustStorePassword"/>
                </parameters>
            </socket>
        </sockets>
        <protocols>
            <protocol implementation="com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary" name="binary"/>
            <protocol implementation="com.orientechnologies.orient.server.network.protocol.http.ONetworkProtocolHttpDb" name="http"/>
        </protocols>
        <listeners>
            <listener protocol="binary" socket="default" port-range="2424-2430" ip-address="0.0.0.0" />
            <listener protocol="http" socket="https" port-range="2434-2440" ip-address="0.0.0.0">

When I try to connect to the OrientDb server using this code I have an error. The code is as follows:

               IOrientServerConnection server = new OrientDBConfiguration()
                    .ConnectWith<byte[]>()
                    .Connect(new BinaryProtocol(hostname, rootUsername, rootPassword, port))
                    .SerializeWith.Serializer(new OrientDBRecordCSVSerializer())
                    .LogWith.Logger(ApplicationLogging.LoggerFactory.CreateLogger("OrientDb"))
                    .CreateFactory()
                    .CreateConnection();

I am using hostname="127.0.0.1" and port "2424" and I get this error:

com.orientechnologies.orient.core.exception.OConfigurationException: Session open with token flag false is not supported anymore please use token based sessions

I analyzed the code at OrientDBBinaryConnectionStream.cs and I see this logic. My code goes with ProtocolVersion 38 and UseTokenBasedSession runs with FALSE value.

			if (ConnectionMetaData.ProtocolVersion < 27)
			{
				ConnectionMetaData.UseTokenBasedSession = false;
			}

I do not know if what I am doing is right or wrong because of the documentation.

Any help will be appretiated.

I want to add this log from my OrientDb instance. I see that when using the binary protocol automatically 38 is used as protocol, so the flag in OrientDBBinaryConnectionStream.cs class sets UseTokenBasedSession as FALSE, but the log suggest me this to be TRUE.

2020-10-30 17:55:14:626 INFO  Listening binary connections on 127.0.0.1:2424 (protocol v.38, socket=default) [OServerNetworkListener]
2020-10-30 17:55:14:704 INFO  Listening http connections on 0.0.0.0:2434 (protocol v.10, socket=https) [OServerNetworkListener]

2020-10-30 17:55:15:142 INFO  OrientDB Server is active v3.1.4 - Veloce (build bc7b3fe5b4a2f6b20648c7b81def7dc3f299cfff, branch 3.1.x). [OServer]
2020-10-30 17:56:45:565 WARNI Session open with token flag false is not supported anymore please use token based sessions [OConnectionBinaryExecutor]