Package com.mongodb

Interface SubjectProvider

All Known Implementing Classes:
KerberosSubjectProvider

@ThreadSafe public interface SubjectProvider
This interface enables applications to take full control of the lifecycle of the Subject with which authentication requests are executed. For each authentication request, the driver will call the getSubject() method and execute the SASL conversation via a call to Subject.doAs(Subject, PrivilegedAction).

Implementations of this interface will typically cache a Subject instance for some period of time before replacing it with a different instance, say, after the expiration time of a ticket has passed.

Applications should register an instance of a class implementation this interface as a mechanism property of a MongoCredential via a call to MongoCredential.withMechanismProperty(String, Object) using the key MongoCredential.JAVA_SUBJECT_PROVIDER_KEY

If use of the same Subject for the lifetime of the application is sufficient, an application can simply create a single Subject and associate it with a MongoCredential as a mechanism property using the key MongoCredential.JAVA_SUBJECT_KEY.

Since:
4.2
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the Subject to use for an authentication request.