Package com.mongodb

Class KerberosSubjectProvider

java.lang.Object
com.mongodb.KerberosSubjectProvider
All Implemented Interfaces:
SubjectProvider

@ThreadSafe public class KerberosSubjectProvider extends Object implements SubjectProvider
An implementation of SubjectProvider suitable for use as the value of the MongoCredential.JAVA_SUBJECT_PROVIDER_KEY mechanism property for Kerberos credentials, created via MongoCredential.createGSSAPICredential(String).

An instance of this class will cache a Kerberos Subject until its TGT is close to expiration, at which point it will replace the Subject with a new one.

Subject instances are created by first constructing a LoginContext with the specified name, then calling its LoginContext.login() method, and finally acquiring the Subject via a call to LoginContext.getSubject().

Since:
4.2
See Also:
  • Constructor Details

    • KerberosSubjectProvider

      public KerberosSubjectProvider()
      Construct an instance with the default login context name "com.sun.security.jgss.krb5.initiate".

      For compatibility, falls back to "com.sun.security.jgss.initiate"

    • KerberosSubjectProvider

      public KerberosSubjectProvider(String loginContextName)
      Construct an instance with the specified login context name
      Parameters:
      loginContextName - the login context name
  • Method Details