You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Vladimir Ozerov <vo...@gridgain.com> on 2017/11/10 07:42:12 UTC

Re: How can I get Ignite security plugin to work with JDBC thin client?

Hi Caleb,

This appears to be a problem with our query execution engine, rather than
with thin JDBC driver. I created a ticket to fix it [1].

[1] https://issues.apache.org/jira/browse/IGNITE-6856

On Tue, Oct 31, 2017 at 4:49 PM, Andrey Mashenkov <
andrey.mashenkov@gmail.com> wrote:

> Caleb,
>
> I've found authorization should work only when you use url like
> "jdbc:ignite://" with thick driver,
> and won't if  "jdbc:ignite:cfg://" is used.
>
> On Tue, Oct 31, 2017 at 4:33 PM, calebs <ca...@gmail.com> wrote:
>
>> The javadoc for the jdbc thick client states that property:
>> "ignite.client.credentials" is available to pass "Client credentials used
>> in
>> authentication process."
>>
>> Is this not being used for authentication/authorization?
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>
>
>
> --
> Best regards,
> Andrey V. Mashenkov
>

Re: How can I get Ignite security plugin to work with JDBC thin client?

Posted by Andrew Mashenkov <an...@gmail.com>.
I've create a ticket [1] for this issue.

[1] https://issues.apache.org/jira/browse/IGNITE-6941



-----
Regards, 
Andrew.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How can I get Ignite security plugin to work with JDBC thin client?

Posted by Andrew Mashenkov <an...@gmail.com>.
I've create a ticket [1] for this issue.

[1] https://issues.apache.org/jira/browse/IGNITE-6941



-----
Regards, 
Andrew.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How can I get Ignite security plugin to work with JDBC thin client?

Posted by calebs <ca...@gmail.com>.
Yes, but can you please open another IGNITE ticket to be resolved hopefully
in 2.4? 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: How can I get Ignite security plugin to work with JDBC thin client?

Posted by Andrey Mashenkov <an...@gmail.com>.
Hi Caleb,

JDBC Thin Client doesn't supports authorization for now.

On Wed, Nov 15, 2017 at 6:54 PM, calebs <ca...@gmail.com> wrote:

> Hi Valdimir,
>
> There are at least two problems that I've found here. The first is the
> query
> execution engine as you have just pointed out. The second one is the JDBC
> thin driver itself.
>
> In JdbcThinTcpIo.handshake, it doesn't pass in user credentials (i.e., user
> & password) as shown below, so how can the server identify the user during
> the hand shaking?
>
>     /**
>      * Used for versions: 2.1.5 and 2.3.0. The protocol version is changed
> but handshake format isn't changed.
>      *
>      * @param ver JDBC client version.
>      * @throws IOException On IO error.
>      * @throws SQLException On connection reject.
>      */
>     public void handshake(ClientListenerProtocolVersion ver) throws
> IOException, SQLException {
>         BinaryWriterExImpl writer = new BinaryWriterExImpl(null, new
> BinaryHeapOutputStream(HANDSHAKE_MSG_SIZE),
>             null, null);
>
>         writer.writeByte((byte) ClientListenerRequest.HANDSHAKE);
>
>         writer.writeShort(ver.major());
>         writer.writeShort(ver.minor());
>         writer.writeShort(ver.maintenance());
>
>         writer.writeByte(ClientListenerNioListener.JDBC_CLIENT);
>
>         writer.writeBoolean(distributedJoins);
>         writer.writeBoolean(enforceJoinOrder);
>         writer.writeBoolean(collocated);
>         writer.writeBoolean(replicatedOnly);
>         writer.writeBoolean(autoCloseServerCursor);
>         writer.writeBoolean(lazy);
>         writer.writeBoolean(skipReducerOnUpdate);
>
>         send(writer.array());
>
>         BinaryReaderExImpl reader = new BinaryReaderExImpl(null, new
> BinaryHeapInputStream(read()),
>             null, null, false);
>
>         boolean accepted = reader.readBoolean();
>
>         if (accepted) {
>             if (reader.available() > 0) {
>                 byte maj = reader.readByte();
>                 byte min = reader.readByte();
>                 byte maintenance = reader.readByte();
>
>                 String stage = reader.readString();
>
>                 long ts = reader.readLong();
>                 byte[] hash = reader.readByteArray();
>
>                 igniteVer = new IgniteProductVersion(maj, min, maintenance,
> stage, ts, hash);
>             }
>             else
>                 igniteVer = new IgniteProductVersion((byte)2, (byte)0,
> (byte)0, "Unknown", 0L, null);
>         }
>         else {
>             short maj = reader.readShort();
>             short min = reader.readShort();
>             short maintenance = reader.readShort();
>
>             String err = reader.readString();
>
>             ClientListenerProtocolVersion srvProtocolVer =
> ClientListenerProtocolVersion.create(maj, min, maintenance);
>
>             if (VER_2_1_5.equals(srvProtocolVer))
>                 handshake(VER_2_1_5);
>             else if (VER_2_1_0.equals(srvProtocolVer))
>                 handshake_2_1_0();
>             else {
>                 throw new SQLException("Handshake failed
> [driverProtocolVer=" + CURRENT_VER +
>                     ", remoteNodeProtocolVer=" + srvProtocolVer + ", err="
> +
> err + ']',
>                     SqlStateCode.CONNECTION_REJECTED);
>             }
>         }
>     }
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 
Best regards,
Andrey V. Mashenkov

Re: How can I get Ignite security plugin to work with JDBC thin client?

Posted by calebs <ca...@gmail.com>.
Hi Valdimir,

There are at least two problems that I've found here. The first is the query
execution engine as you have just pointed out. The second one is the JDBC
thin driver itself. 

In JdbcThinTcpIo.handshake, it doesn't pass in user credentials (i.e., user
& password) as shown below, so how can the server identify the user during
the hand shaking? 

    /**
     * Used for versions: 2.1.5 and 2.3.0. The protocol version is changed
but handshake format isn't changed.
     *
     * @param ver JDBC client version.
     * @throws IOException On IO error.
     * @throws SQLException On connection reject.
     */
    public void handshake(ClientListenerProtocolVersion ver) throws
IOException, SQLException {
        BinaryWriterExImpl writer = new BinaryWriterExImpl(null, new
BinaryHeapOutputStream(HANDSHAKE_MSG_SIZE),
            null, null);

        writer.writeByte((byte) ClientListenerRequest.HANDSHAKE);

        writer.writeShort(ver.major());
        writer.writeShort(ver.minor());
        writer.writeShort(ver.maintenance());

        writer.writeByte(ClientListenerNioListener.JDBC_CLIENT);

        writer.writeBoolean(distributedJoins);
        writer.writeBoolean(enforceJoinOrder);
        writer.writeBoolean(collocated);
        writer.writeBoolean(replicatedOnly);
        writer.writeBoolean(autoCloseServerCursor);
        writer.writeBoolean(lazy);
        writer.writeBoolean(skipReducerOnUpdate);

        send(writer.array());

        BinaryReaderExImpl reader = new BinaryReaderExImpl(null, new
BinaryHeapInputStream(read()),
            null, null, false);

        boolean accepted = reader.readBoolean();

        if (accepted) {
            if (reader.available() > 0) {
                byte maj = reader.readByte();
                byte min = reader.readByte();
                byte maintenance = reader.readByte();

                String stage = reader.readString();

                long ts = reader.readLong();
                byte[] hash = reader.readByteArray();

                igniteVer = new IgniteProductVersion(maj, min, maintenance,
stage, ts, hash);
            }
            else
                igniteVer = new IgniteProductVersion((byte)2, (byte)0,
(byte)0, "Unknown", 0L, null);
        }
        else {
            short maj = reader.readShort();
            short min = reader.readShort();
            short maintenance = reader.readShort();

            String err = reader.readString();

            ClientListenerProtocolVersion srvProtocolVer =
ClientListenerProtocolVersion.create(maj, min, maintenance);

            if (VER_2_1_5.equals(srvProtocolVer))
                handshake(VER_2_1_5);
            else if (VER_2_1_0.equals(srvProtocolVer))
                handshake_2_1_0();
            else {
                throw new SQLException("Handshake failed
[driverProtocolVer=" + CURRENT_VER +
                    ", remoteNodeProtocolVer=" + srvProtocolVer + ", err=" +
err + ']',
                    SqlStateCode.CONNECTION_REJECTED);
            }
        }
    }




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/