Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1958

SCRAM-SHA1 authentication is not available on Android

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.3, 2.13.3
    • Component/s: Authentication
    • Labels:
    • Environment:
      Android 21

      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:

      import javax.crypto.Mac;
      import javax.crypto.SecretKeyFactory;
      import javax.crypto.spec.PBEKeySpec;
      import javax.crypto.spec.SecretKeySpec;
      import javax.security.sasl.SaslClient;
      import javax.security.sasl.SaslException
      

      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
      that generate a loop with this:

      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            matfur92 Matteo Furlan
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: