Interface DirContextFactory

    • Method Detail

      • obtainDirContext

        DirContext obtainDirContext​(CallbackHandler handler,
                                    DirContextFactory.ReferralMode mode)
                             throws NamingException
        Obtain a DirContext based on the credentials extracted from the given CallbackHandler.
        handler - the callback handler used to extract credentials in order to obtain a connected DirContext instance.
        mode - the referral mode for if a referral is encountered querying LDAP; the passed in referral mode can be null in which case the default of IGNORE will be assumed
        a ready to use DirContext for searching and attribute retrieval
      • returnContext

        void returnContext​(DirContext context)
        Return the DirContext once it is no longer required. The returned DirContext is not necessarily an InitialDirContext and as a result we can not assume it is closeable. Should only be called if a context was successfully obtained.
        context - the DirContext to return
      • discardContext

        default void discardContext​(DirContext context)
        Pass back a DirContext to this factory to be discarded. The context may be passed back either because it is detected as being invalid or possibly because it has been created to act as a specific account and so should not be pooled. Although the context is being discarded this method allows the factory to perform any additional clean up required around this context.
        context - the DirContext to discard.