JDBC Authentication Plugin
On this page
New in version 2.2.
The MongoDB Connector for BI provides a client-side MySQL authentication plugin for Java that
integrates with MySQL's Connector/J JDBC driver.
The mongosql_auth
plugin allows a client to authenticate with a
BI Connector and MongoDB deployment running with authentication enabled
using one of the following authentication mechanisms:
SCRAM-SHA-1
SCRAM-SHA-256
PLAIN
(LDAP)GSSAPI
(Kerberos)
Note
The
SCRAM-SHA-1
andSCRAM-SHA-256
mechanisms hash the passwords in the client plugin; however, all other data is in cleartext. If possible, use with encrypted connections.The
PLAIN
mechanism sends the password in cleartext. Use encrypted connections with thePLAIN
mechanism .
Prerequisites
This plugin requires a version of MySQL Connector/J between 5.1.39 and the latest 5.1.x. It can't use MySQL Server or MySQL Connector/J 8.0 or later.
Installing the Plugin
To download the plugin .jar
file, choose one of the following
options:
Download from the GitHub repository
Select the
.jar
file from the download site.Save it to a local directory. Refer to the directory as needed.
Use Maven
Include the MongoSQL Authentication Plugin for MySQL Connector/J library in the
CLASSPATH
. The Maven coordinates are:<dependency> <groupId>org.mongodb</groupId> <artifactId>mongosql-auth</artifactId> <version>1.0.0</version> </dependency> Include MySQL Connector/J in the
CLASSPATH
. The Maven coordinates are:<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.49</version> </dependency> Add the authentication plugin in the MySQL connection string:
jdbc:mysql://127.0.0.1:3307?useSSL=false&authenticationPlugins=org.mongodb.mongosql.auth.plugin.MongoSqlAuthenticationPlugin You may also specify the authentication mechanism and authentication source as a query parameter on the
username
.ParameterDefault ValueAuthentication mechanismUsername and Password (SCRAM-SHA-1
).Authentication sourceadmin
for Username and Password (SCRAM-SHA-1
)$external
for LDAP (PLAIN
)
Example
Specify an authentication mechanism:
{username}?mechanism=PLAIN Specify an authentication source using default authentication mechanism:
{username}?source={somedb}