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 theSubjectwith which authentication requests are executed. For each authentication request, the driver will call thegetSubject()method and execute the SASL conversation via a call toSubject.doAs(Subject, PrivilegedAction).Implementations of this interface will typically cache a
Subjectinstance 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
MongoCredentialvia a call toMongoCredential.withMechanismProperty(String, Object)using the keyMongoCredential.JAVA_SUBJECT_PROVIDER_KEYIf use of the same
Subjectfor the lifetime of the application is sufficient, an application can simply create a singleSubjectand associate it with aMongoCredentialas a mechanism property using the keyMongoCredential.JAVA_SUBJECT_KEY.- Since:
- 4.2
- See Also:
MongoCredential,MongoCredential.JAVA_SUBJECT_PROVIDER_KEY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SubjectgetSubject()Gets the Subject to use for an authentication request.
-
-
-
Method Detail
-
getSubject
@Nullable Subject getSubject() throws LoginException
Gets the Subject to use for an authentication request.- Returns:
- the
Subject, which may be null - Throws:
LoginException- a login exception
-
-