[JAVA-1958] SCRAM-SHA1 authentication is not available on Android Created: 11/Sep/15 Updated: 01/Mar/18 Resolved: 04/Oct/16 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Authentication |
| Affects Version/s: | 3.0.3, 2.13.3 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Matteo Furlan | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | Android | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Android 21 |
||
| Issue Links: |
|
||||||||||||
| Description |
New description:As of MongoDB 3.0, the default authentication protocol is a SASL implementation of SCRAM-SHA1. The driver relies on the following classes to implement it:
Some or all of these are not available on Android, which does not offer a full implementation of the JRE. Also of note is that PLAIN and GSSAPI authentication mechanisms also rely on the availability of a SASL library, so those won't function properly either. Previous description:I'm developing an Android app that use the java mongodb driver 3.0.3 to connect to every instance of mongodb. At runtime I have some error: 09-11 19:13:50.898 7418-7418/it.mysite.mongodbviewer W/org.bson.ObjectId﹕ Failed to get process identifier from JMX, using random number instead java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/management/ManagementFactory; and com.mongodb.MongoException: java.lang.NoClassDefFoundError: com.mongodb.connection.ScramSha1Authenticator$ScramSha1SaslClient I/art﹕ Rejecting re-init on previously-failed class java.lang.Class Anyone has a solution? java/lang/management/ManagementFactory seems not to exist for Android, how can you solve? If this is the center of the problem. More information at http://stackoverflow.com/questions/32529484/mongodb-3-x-driver-android-compatibility/32531278#32531278 |
| Comments |
| Comment by Ross Lawley [ 04/Oct/16 ] |
|
Due to the limitations of Android JRE the classes aren't available. Currently, there are no plans to support this, so I'm closing the ticket as Won't Fix. |
| Comment by tzachi dar [ 25/Sep/15 ] |
|
Seems like I was able to find something very limited that work: |
| Comment by tzachi dar [ 25/Sep/15 ] |
|
Hi, I have tried to use the rest api instead of the mongodb on android. Storing objects seems to work fine (using the rest api). but when doing a query I can't seem to have the query details actually work. I try to follow the rules on http://docs.mongolab.com/data-api/#utf-8 for example, I try to follow this example: "f" example (include) - return all documents but include only the "firstName" and "lastName" fields: &apiKey=myAPIKey and it does not work. My query is "f= {\"CaptureDateTime\": 1}"; This is being translated to f%3D%7B%22CaptureDateTime%22%3A%201%7D and so my query is: String url = BASE_URL + dbName + "/collections/" + collectionName "?" + f%3D%7B%22CaptureDateTime%22%3A%201%7D "apiKey=" + apiKey; but I get all thoughts of objects. Do you know what I'm doing wrong? |
| Comment by Jeffrey Yemin [ 14/Sep/15 ] |
|
As I stated earlier we don't consider this a bug, but we will consider this as a feature request. |
| Comment by Matteo Furlan [ 12/Sep/15 ] |
|
Hi Jeff, |
| Comment by Jeffrey Yemin [ 11/Sep/15 ] |
|
Hi Matteo, The Java driver documentation has never claimed Android support, so I don't consider this to be a bug. As I answered on Stack Overflow, the reason it doesn't work is because Android does not contain the full set of classes required by a compliant implementation of the JRE. That said, I offered several workarounds and suggestions on Stack Overflow, and I'm happy to continue discussing the available options. |