Class ObservationContextSource
java.lang.Object
org.springframework.ldap.core.support.ObservationContextSource
- All Implemented Interfaces:
ContextSource, BaseLdapPathContextSource, BaseLdapPathSource
An implementation of
ContextSource that returns DirContext instances
that record the time each operation takes.- Since:
- 3.3
-
Constructor Summary
ConstructorsConstructorDescriptionObservationContextSource(BaseLdapPathContextSource contextSource, io.micrometer.observation.ObservationRegistry observationRegistry) -
Method Summary
Modifier and TypeMethodDescriptionGet the base LDAP path as aLdapName.Deprecated.Get the base LDAP path as a String.getContext(String principal, String credentials) Gets aDirContextinstance authenticated using the supplied principal and credentials.Gets a read-onlyDirContext.Gets a read-writeDirContextinstance.
-
Constructor Details
-
ObservationContextSource
public ObservationContextSource(BaseLdapPathContextSource contextSource, io.micrometer.observation.ObservationRegistry observationRegistry)
-
-
Method Details
-
getReadOnlyContext
Description copied from interface:ContextSourceGets a read-onlyDirContext. The returnedDirContextmust be possible to perform read-only operations on.- Specified by:
getReadOnlyContextin interfaceContextSource- Returns:
- A DirContext instance, never null.
- Throws:
NamingException- if some error occurs creating an DirContext.
-
getReadWriteContext
Description copied from interface:ContextSourceGets a read-writeDirContextinstance.- Specified by:
getReadWriteContextin interfaceContextSource- Returns:
- A
DirContextinstance, nevernull. - Throws:
NamingException- if some error occurs creating anDirContext.
-
getContext
Description copied from interface:ContextSourceGets aDirContextinstance authenticated using the supplied principal and credentials. Typically to be used for plain authentication purposes. Note that this method will never make use of native Java LDAP pooling, even though this instance is configured to do so. This is to force password changes in the target directory to take effect as soon as possible.- Specified by:
getContextin interfaceContextSource- Parameters:
principal- The principal (typically a distinguished name of a user in the LDAP tree) to use for authentication.credentials- The credentials to use for authentication.- Returns:
- an authenticated
DirContextinstance, nevernull. - Throws:
NamingException
-
getBaseLdapPath
Deprecated.Description copied from interface:BaseLdapPathSourceGet the base LDAP path as aDistinguishedName.- Specified by:
getBaseLdapPathin interfaceBaseLdapPathSource- Returns:
- the base LDAP path as a
DistinguishedName. The path will be empty if no base path is specified.
-
getBaseLdapName
Description copied from interface:BaseLdapPathSourceGet the base LDAP path as aLdapName.- Specified by:
getBaseLdapNamein interfaceBaseLdapPathSource- Returns:
- the base LDAP path as a
LdapName. The path will be empty if no base path is specified.
-
getBaseLdapPathAsString
Description copied from interface:BaseLdapPathSourceGet the base LDAP path as a String.- Specified by:
getBaseLdapPathAsStringin interfaceBaseLdapPathSource- Returns:
- the base LDAP path as a An empty String will be returned if no base path is specified.
-