Package net.shibboleth.idp.attribute.resolver.spring.dc.ldap.impl

# Class LDAPDataConnectorParser.V2Parser

java.lang.Object
net.shibboleth.idp.attribute.resolver.spring.dc.ldap.impl.LDAPDataConnectorParser.V2Parser

Enclosing class:
  LDAPDataConnectorParser

protected static class LDAPDataConnectorParser.V2Parser extends Object
Utility class for parsing v2 schema configuration.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final Element`
`configElement`
LDAPDirectory XML element.
`private final String`
`connectorId`
DataConnector ID.
`private static final org.slf4j.Logger`
`LOG`
Class logger.
`private final String`
`logPrefix`
LogPrefix of parent.

## Constructor Summary

Constructors
Constructor
Description
`V2Parser(String id, Element config, String prefix)`
Creates a new V2Parser with the supplied LDAPDirectory element.

## Method Summary

Modifier and Type
Method
Description
`static ConnectionStrategy`
`buildConnectionStrategy(String connectionStrategy)`
Returns an appropriate `ConnectionStrategy`.
`static CertificateHostnameVerifier`
`buildHostnameVerifier(String disableHostnameVerification, String logPrefix)`
Factory method for overriding hostname verifier.
`static List<SearchResultHandler>`
`buildReferralHandlers(String followReferrals)`
Returns search result handlers or null if followReferrals is false.
`static SaslConfig`
`buildSaslConfig(String mechanism)`
Returns a SASL configuration for the supplied mechanism.
`static List<LdapEntryHandler>`
`buildSearchEntryHandlers(String lowercaseAttributeNames)`
Factory method for handling spring property replacement.
`static SearchConnectionValidator`
`buildSearchValidator(String validateDN, String validateFilter, String validatePeriod)`
Returns a search validator or null if validatePeriodically is false.
`static List<String>`
`buildStringList(String value)`
Converts the supplied value to a list of strings delimited by `XMLConstants.LIST_DELIMITERS` and comma.
`BeanDefinition`
`createCache(ParserContext parserContext)`
Create a results cache bean definition.
`BeanDefinition`
`createConnectionConfig(ParserContext parserContext)`
Creates a connection config bean definition from a v2 XML configuration.
`protected BeanDefinition`
`createCredentialConfig(ParserContext parserContext)`
Read StartTLS trust and authentication credentials.
`BeanDefinition`
`createMappingStrategy()`
Create the result mapping strategy.
`BeanDefinition`
`createPooledConnectionFactory(ParserContext parserContext)`
Creates a new pooled connection factory bean definition from a v2 XML configuration.
`protected BeanDefinition`
`createSaslConfig()`
Creates a new sasl config bean definition from a v2 XML configuration.
`BeanDefinition`
`createSearchOperation()`
Creates a new search operation bean definition from a v2 XML configuration.
`BeanDefinition`
`createTemplateBuilder()`
Construct the definition of the template driven search builder.
`BeanDefinition`
`createValidator()`
Create the validator.
`String`
`getBeanConnectionFactoryID()`
Get the bean ID of an externally defined Connection Factory.
`String`
`getBeanSearchBuilderID()`
Get the bean ID of an externally defined search builder.
`String`
`getBeanSearchOperationID()`
Get the bean ID of an externally defined Search Operation.
`(package private) Element`
`getConnectionPoolElement()`
Get the Pool configuration <ConnectionPool> element contents, warning if there is more than one.
`private String`
`getFilterText()`
Get the textual content of the <FilterTemplate>.
`(package private) String`
`getLogPrefix()`
The parent's log prefix.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### LOG

@Nonnull private static final org.slf4j.Logger LOG
Class logger.

### connectorId

@Nonnull @NotEmpty private final String connectorId
DataConnector ID.

### configElement

@Nonnull private final Element configElement
LDAPDirectory XML element.

### logPrefix

@Nonnull @NotEmpty private final String logPrefix
LogPrefix of parent.

## Constructor Details

### V2Parser

public V2Parser(@Nonnull String id, @Nonnull Element config, @Nonnull String prefix)
Creates a new V2Parser with the supplied LDAPDirectory element.

Parameters:
  `id` - Data connector ID
  `config` - LDAPDirectory element
  `prefix` - the parent's log prefix

## Method Details

### createConnectionConfig

@Nonnull public BeanDefinition createConnectionConfig(@Nonnull ParserContext parserContext)
Creates a connection config bean definition from a v2 XML configuration.

Parameters:
  `parserContext` - bean definition parsing context
Returns:
  connection config bean definition

### createCredentialConfig

@Nonnull protected BeanDefinition createCredentialConfig(@Nonnull ParserContext parserContext)
Read StartTLS trust and authentication credentials.

Parameters:
  `parserContext` - bean definition parsing context
Returns:
  credential config

### getFilterText

@Nullable private String getFilterText()
Get the textual content of the <FilterTemplate>. We have to look in two places and warn appropriately.

Returns:
  the filter or null.

### getBeanSearchBuilderID

@Nullable public String getBeanSearchBuilderID()
Get the bean ID of an externally defined search builder.

Returns:
  search builder bean ID

### getBeanConnectionFactoryID

@Nullable public String getBeanConnectionFactoryID()
Get the bean ID of an externally defined Connection Factory.

Returns:
  Connection Factory bean ID

### getBeanSearchOperationID

@Nullable public String getBeanSearchOperationID()
Get the bean ID of an externally defined Search Operation.

Returns:
  Search Operation bean ID

### createTemplateBuilder

@Nonnull public BeanDefinition createTemplateBuilder()
Construct the definition of the template driven search builder.

Returns:
  the bean definition for the template search builder.

### createSearchOperation

@Nonnull public BeanDefinition createSearchOperation()
Creates a new search operation bean definition from a v2 XML configuration.

Returns:
  search operation bean definition

### getConnectionPoolElement

@Nullable Element getConnectionPoolElement()
Get the Pool configuration <ConnectionPool> element contents, warning if there is more than one.

Returns:
  the <ConnectionPool> or null if there isn't one.

### createPooledConnectionFactory

@Nullable public BeanDefinition createPooledConnectionFactory(@Nonnull ParserContext parserContext)
Creates a new pooled connection factory bean definition from a v2 XML configuration.

Parameters:
  `parserContext` - used to create dependent bean definitions
Returns:
  pooled connection factory bean definition

### createSaslConfig

@Nullable protected BeanDefinition createSaslConfig()
Creates a new sasl config bean definition from a v2 XML configuration.

Returns:
  sasl config bean definition

### createMappingStrategy

@Nullable public BeanDefinition createMappingStrategy()
Create the result mapping strategy. See `MappingStrategy`.

Returns:
  mapping strategy

### createValidator

@Nullable public BeanDefinition createValidator()
Create the validator. See `Validator`.

Returns:
  validator

### createCache

@Nullable public BeanDefinition createCache(@Nonnull ParserContext parserContext)
Create a results cache bean definition. See `CacheConfigParser`.

Parameters:
  `parserContext` - bean parser context
Returns:
  results cache bean definition

### getLogPrefix

@Nonnull String getLogPrefix()
The parent's log prefix.

Returns:
  the log prefix. Set up in the constructor.

### buildStringList

@Nonnull public static List<String> buildStringList(@Nonnull String value)
Converts the supplied value to a list of strings delimited by `XMLConstants.LIST_DELIMITERS` and comma.

Parameters:
  `value` - to convert to a list
Returns:
  list of strings

### buildSearchValidator

@Nullable public static SearchConnectionValidator buildSearchValidator(@Nullable String validateDN, @Nullable String validateFilter, @Nullable String validatePeriod)
Returns a search validator or null if validatePeriodically is false.

Parameters:
  `validateDN` - baseDN to search on
  `validateFilter` - to search with
  `validatePeriod` - on which to search
Returns:
  search validator or null

### buildHostnameVerifier

@Nullable public static CertificateHostnameVerifier buildHostnameVerifier(@Nullable String disableHostnameVerification, @Nullable String logPrefix)
Factory method for overriding hostname verifier.

Parameters:
  `disableHostnameVerification` - whether to install a null verifier
  `logPrefix` - log prefix
Returns:
  custom verifier or null

### buildSearchEntryHandlers

@Nonnull public static List<LdapEntryHandler> buildSearchEntryHandlers(@Nullable String lowercaseAttributeNames)
Factory method for handling spring property replacement. Adds a `DnAttributeEntryHandler` by default. Adds a `CaseChangeEntryHandler` if lowercaseAttributeNames is true.

Parameters:
  `lowercaseAttributeNames` - boolean string value
Returns:
  list of search entry handlers

### buildReferralHandlers

@Nullable public static List<SearchResultHandler> buildReferralHandlers(@Nullable String followReferrals)
Returns search result handlers or null if followReferrals is false.

Parameters:
  `followReferrals` - whether to create a search referral handler
Returns:
  search result handlers or null

### buildSaslConfig

@Nonnull public static SaslConfig buildSaslConfig(@Nonnull String mechanism)
Returns a SASL configuration for the supplied mechanism.

Parameters:
  `mechanism` - SASL mechanism
Returns:
  SASL config

### buildConnectionStrategy

@Nonnull public static ConnectionStrategy buildConnectionStrategy(@Nullable String connectionStrategy)
Returns an appropriate `ConnectionStrategy`.

Parameters:
  `connectionStrategy` - the provided string (with properties stripped)
Returns:
  the appropriate `ConnectionStrategy`.