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 ofSubjectProvider
suitable for use as the value of theMongoCredential.JAVA_SUBJECT_PROVIDER_KEY
mechanism property for Kerberos credentials, created viaMongoCredential.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 theSubject
with a new one.Subject
instances are created by first constructing aLoginContext
with the specified name, then calling itsLoginContext.login()
method, and finally acquiring theSubject
via a call toLoginContext.getSubject()
.- Since:
- 4.2
- See Also:
LoginContext
,Subject
,KerberosTicket
-
-
Constructor Summary
Constructors Constructor Description KerberosSubjectProvider()
Construct 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Subject
getSubject()
Gets aSubject
instance associated with aLoginContext
after its been logged in.
-
-
-
Method Detail
-
getSubject
@NonNull public Subject getSubject() throws LoginException
Gets aSubject
instance associated with aLoginContext
after its been logged in.- Specified by:
getSubject
in interfaceSubjectProvider
- Returns:
- the non-null
Subject
instance - Throws:
LoginException
- any exception resulting from a call toLoginContext.login()
-
-