SubjectProvider (driver-core 5.5.0 API) (original) (raw)

Interface SubjectProvider

All Known Implementing Classes:

[KerberosSubjectProvider](KerberosSubjectProvider.html "class in com.mongodb")


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 keyMongoCredential.JAVA_SUBJECT_PROVIDER_KEY

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

Since:

4.2

See Also:

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