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 Sat, 30 Jan 2016 01:18:42 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1.5.6 c64673a97 -> b146c0f5a


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/b146c0f5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b146c0f5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b146c0f5

Branch: refs/heads/ignite-1.5.6
Commit: b146c0f5ac227e270d79c6bf18017676db6a1164
Parents: c64673a
Author: Valentin Kulichenko <valentin.kulichenko@gmail.com>
Authored: Wed Jan 27 18:52:00 2016 -0800
Committer: Valentin Kulichenko <valentin.kulichenko@gmail.com>
Committed: Fri Jan 29 17:18:31 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/b146c0f5/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