Package org.ldaptive.url
Class Url
java.lang.Object
org.ldaptive.url.Url
Class to represent an LDAP URL. See RFC 4516. Expects URLs of the form
scheme://hostname:port/baseDn?attrs?scope?filter. This implementation does not support URL extensions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String[]Attributes of the ldap url.private final StringBase DN of the ldap url.(package private) static final String[]Default return attributes, value is all user attributes.(package private) static final StringDefault base DN, value is "".(package private) static final StringDefault attribute filter value is '(objectClass=*)'.(package private) static final intDefault LDAP port, value is 389.(package private) static final intDefault LDAPI port, value is 0.(package private) static final intDefault LDAPS port, value is 636.(package private) static final DnDefault parsed base DN.(package private) static final FilterDefault parsed attribute filter.(package private) static final SearchScopeDefault scope, value isSearchScope.OBJECT.private static final DnParserFor parsing DNs.private final StringSearch filter of the ldap url.private static final FilterFunctionFor parsing filters.private static final inthash code seed.private final StringHostname of the ldap url.private static final StringLDAP scheme.private static final StringLDAPI scheme.private static final StringLDAPS scheme.private final DnParsed base DN of the ldap url.private final FilterParsed filter of the ldap url.private final intPort of the ldap url.private final StringScheme of the ldap url.private final SearchScopeSearch scope of the ldap url. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanformat()Returns a string representation of this LDAP URL.format(UrlFormatter formatter) Returns a string representation of this LDAP URL.String[]Returns the attributes.Returns the base DN.Returns the filter.Returns the hostname.Returns the parsed base DN.Returns the parsed filter.intgetPort()Returns the port.Returns the scheme.getScope()Returns the scope.inthashCode()booleanReturns whether attributes were supplied in this url.booleanReturns whether a base DN was supplied in this url.booleanReturns whether a filter was supplied in this url.booleanReturns false if a port was supplied in this url.booleanReturns whether a scope was supplied in this url.booleanReturns whether the scheme is 'ldaps'.toString()(package private) static voidvalidatePort(int port, boolean allowDefault) Determines whether the supplied port is valid.(package private) static voidvalidateScheme(String scheme) Determines whether the supplied scheme is valid.
-
Field Details
-
DEFAULT_LDAP_PORT
static final int DEFAULT_LDAP_PORTDefault LDAP port, value is 389.- See Also:
-
DEFAULT_LDAPS_PORT
static final int DEFAULT_LDAPS_PORTDefault LDAPS port, value is 636.- See Also:
-
DEFAULT_LDAPI_PORT
static final int DEFAULT_LDAPI_PORTDefault LDAPI port, value is 0.- See Also:
-
DEFAULT_BASE_DN
Default base DN, value is "".- See Also:
-
DEFAULT_PARSED_BASE_DN
Default parsed base DN. -
DEFAULT_FILTER
Default attribute filter value is '(objectClass=*)'.- See Also:
-
DEFAULT_PARSED_FILTER
Default parsed attribute filter. -
DEFAULT_SCOPE
Default scope, value isSearchScope.OBJECT. -
DEFAULT_ATTRIBUTES
Default return attributes, value is all user attributes. -
HASH_CODE_SEED
private static final int HASH_CODE_SEEDhash code seed.- See Also:
-
DN_PARSER
For parsing DNs. -
FILTER_FUNCTION
For parsing filters. -
LDAP_SCHEME
LDAP scheme.- See Also:
-
LDAPS_SCHEME
LDAPS scheme.- See Also:
-
LDAPI_SCHEME
LDAPI scheme.- See Also:
-
scheme
Scheme of the ldap url. -
hostname
Hostname of the ldap url. -
port
private final int portPort of the ldap url. -
baseDn
Base DN of the ldap url. -
parsedBaseDn
Parsed base DN of the ldap url. -
attributes
Attributes of the ldap url. -
scope
Search scope of the ldap url. -
filter
Search filter of the ldap url. -
parsedFilter
Parsed filter of the ldap url.
-
-
Constructor Details
-
Url
Copy constructor.- Parameters:
ldapURL- to copy properties from
-
Url
Url(String scheme, String hostname, int port, String baseDn, String[] attributes, SearchScope scope, String filter) Creates a new ldap url.- Parameters:
scheme- url schemehostname- url hostnameport- url portbaseDn- base DNattributes- attributesscope- search scopefilter- search filter
-
Url
Creates a new ldap url.- Parameters:
url- LDAP url
-
Url
Creates a new ldap url.- Parameters:
url- LDAP urlparser- to parse the url
-
-
Method Details
-
getScheme
Returns the scheme.- Returns:
- scheme
-
isSchemeLdaps
public boolean isSchemeLdaps()Returns whether the scheme is 'ldaps'.- Returns:
- whether the scheme is 'ldaps'
-
getHostname
Returns the hostname.- Returns:
- hostname
-
getPort
public int getPort()Returns the port. If no port was supplied, returns the default port for the scheme.- Returns:
- port
-
isDefaultPort
public boolean isDefaultPort()Returns false if a port was supplied in this url.- Returns:
- false if a port was supplied in this url
-
getBaseDn
Returns the base DN.- Returns:
- baseDn
-
getParsedBaseDn
Returns the parsed base DN.- Returns:
- parsed baseDn
-
isDefaultBaseDn
public boolean isDefaultBaseDn()Returns whether a base DN was supplied in this url.- Returns:
- whether a base DN was supplied in this url
-
getAttributes
Returns the attributes.- Returns:
- attributes
-
isDefaultAttributes
public boolean isDefaultAttributes()Returns whether attributes were supplied in this url.- Returns:
- whether an attributes were supplied in this url
-
getScope
Returns the scope.- Returns:
- scope
-
isDefaultScope
public boolean isDefaultScope()Returns whether a scope was supplied in this url.- Returns:
- whether a scope was supplied in this url
-
getFilter
Returns the filter.- Returns:
- filter
-
getParsedFilter
Returns the parsed filter.- Returns:
- parsed filter
-
isDefaultFilter
public boolean isDefaultFilter()Returns whether a filter was supplied in this url.- Returns:
- whether a filter was supplied in this url
-
format
Returns a string representation of this LDAP URL. Uses aMinimalUrlFormatterby default.- Returns:
- string form of the LDAP URL
-
format
Returns a string representation of this LDAP URL.- Parameters:
formatter- to produce the string- Returns:
- string form of the LDAP URL
-
validateScheme
Determines whether the supplied scheme is valid. Must be one of 'ldap', 'ldaps' or 'ldapi'.- Parameters:
scheme- to validate
-
validatePort
static void validatePort(int port, boolean allowDefault) Determines whether the supplied port is valid.- Parameters:
port- to validateallowDefault- whether to allow default port of -1
-
equals
-
hashCode
public int hashCode() -
toString
-