ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject ignite git commit: JDBC driver authentication fixed
Date Thu, 28 Jan 2016 02:52:04 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 644b198c6 -> a4cf78a62


JDBC driver authentication fixed


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a4cf78a6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a4cf78a6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a4cf78a6

Branch: refs/heads/master
Commit: a4cf78a6207e5782d6a9b90f14a52955aca2c208
Parents: 644b198
Author: Valentin Kulichenko <valentin.kulichenko@gmail.com>
Authored: Wed Jan 27 18:52:00 2016 -0800
Committer: Valentin Kulichenko <valentin.kulichenko@gmail.com>
Committed: Wed Jan 27 18:52:00 2016 -0800

----------------------------------------------------------------------
 .../apache/ignite/internal/jdbc/JdbcConnection.java   | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a4cf78a6/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
index a4be6f5..064a6f6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/jdbc/JdbcConnection.java
@@ -44,6 +44,9 @@ import org.apache.ignite.internal.client.GridClientDisconnectedException;
 import org.apache.ignite.internal.client.GridClientException;
 import org.apache.ignite.internal.client.GridClientFactory;
 import org.apache.ignite.internal.client.GridClientFutureTimeoutException;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.plugin.security.SecurityCredentials;
+import org.apache.ignite.plugin.security.SecurityCredentialsBasicProvider;
 
 import static java.sql.ResultSet.CONCUR_READ_ONLY;
 import static java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;
@@ -108,6 +111,15 @@ public class JdbcConnection implements Connection {
 
             cfg.setServers(Collections.singleton(props.getProperty(PROP_HOST) + ":" + props.getProperty(PROP_PORT)));
 
+            String user = props.getProperty("user");
+            String passwd = props.getProperty("password");
+
+            if (!F.isEmpty(user)) {
+                SecurityCredentials creds = new SecurityCredentials(user, passwd);
+
+                cfg.setSecurityCredentialsProvider(new SecurityCredentialsBasicProvider(creds));
+            }
+
             // Disable all fetching and caching for metadata.
             cfg.setEnableMetricsCache(false);
             cfg.setEnableAttributesCache(false);
@@ -575,4 +587,4 @@ public class JdbcConnection implements Connection {
     JdbcStatement createStatement0() throws SQLException {
         return (JdbcStatement)createStatement();
     }
-}
\ No newline at end of file
+}


Mime
View raw message