Package com.mongodb
Class KerberosSubjectProvider
java.lang.Object
com.mongodb.KerberosSubjectProvider
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionConstruct an instance with the default login context name"com.sun.security.jgss.krb5.initiate".KerberosSubjectProvider(String loginContextName) Construct an instance with the specified login context name -
Method Summary
Modifier and TypeMethodDescriptionGets aSubjectinstance associated with aLoginContextafter its been logged in.
-
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
Construct an instance with the specified login context name- Parameters:
loginContextName- the login context name
-
-
Method Details
-
getSubject
Gets aSubjectinstance associated with aLoginContextafter its been logged in.- Specified by:
getSubjectin interfaceSubjectProvider- Returns:
- the non-null
Subjectinstance - Throws:
LoginException- any exception resulting from a call toLoginContext.login()
-