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 ofSubjectProvidersuitable for use as the value of theMongoCredential.JAVA_SUBJECT_PROVIDER_KEYmechanism property for Kerberos credentials, created viaMongoCredential.createGSSAPICredential(String).An instance of this class will cache a Kerberos
Subjectuntil its TGT is close to expiration, at which point it will replace theSubjectwith a new one.Subjectinstances are created by first constructing aLoginContextwith the specified name, then calling itsLoginContext.login()method, and finally acquiring theSubjectvia 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 SubjectgetSubject()Gets aSubjectinstance associated with aLoginContextafter its been logged in.
-
-
-
Method Detail
-
getSubject
@NonNull public Subject getSubject() throws LoginException
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()
-
-