public final class Requests extends Object
All copy constructors of the form copyOfXXXRequest
perform deep
copies of their request parameter. More specifically, any controls,
modifications, and attributes contained within the response will be
duplicated.
Similarly, all unmodifiable views of request returned by methods of the form
unmodifiableXXXRequest
return deep unmodifiable views of their
request parameter. More specifically, any controls, modifications, and
attributes contained within the returned request will be unmodifiable.
Modifier and Type | Method and Description |
---|---|
static AbandonRequest |
copyOfAbandonRequest(AbandonRequest request)
Creates a new abandon request that is an exact copy of the provided
request.
|
static AddRequest |
copyOfAddRequest(AddRequest request)
Creates a new add request that is an exact copy of the provided request.
|
static BindRequest |
copyOfBindRequest(BindRequest request)
Creates a new bind request that is an exact copy of the provided request.
|
static CancelExtendedRequest |
copyOfCancelExtendedRequest(CancelExtendedRequest request)
Creates a new cancel extended request that is an exact copy of the
provided request.
|
static CompareRequest |
copyOfCompareRequest(CompareRequest request)
Creates a new compare request that is an exact copy of the provided
request.
|
static DeleteRequest |
copyOfDeleteRequest(DeleteRequest request)
Creates a new delete request that is an exact copy of the provided
request.
|
static GenericExtendedRequest |
copyOfGenericExtendedRequest(GenericExtendedRequest request)
Creates a new generic extended request that is an exact copy of the
provided request.
|
static ModifyDnRequest |
copyOfModifyDnRequest(ModifyDnRequest request)
Creates a new modify DN request that is an exact copy of the provided
request.
|
static ModifyRequest |
copyOfModifyRequest(ModifyRequest request)
Creates a new modify request that is an exact copy of the provided
request.
|
static PasswordModifyExtendedRequest |
copyOfPasswordModifyExtendedRequest(PasswordModifyExtendedRequest request)
Creates a new password modify extended request that is an exact copy of
the provided request.
|
static SearchRequest |
copyOfSearchRequest(SearchRequest request)
Creates a new search request that is an exact copy of the provided
request.
|
static StartTlsExtendedRequest |
copyOfStartTlsExtendedRequest(StartTlsExtendedRequest request)
Creates a new startTLS extended request that is an exact copy of the
provided request.
|
static UnbindRequest |
copyOfUnbindRequest(UnbindRequest request)
Creates a new unbind request that is an exact copy of the provided
request.
|
static WhoAmIExtendedRequest |
copyOfWhoAmIExtendedRequest(WhoAmIExtendedRequest request)
Creates a new Who Am I extended request that is an exact copy of the
provided request.
|
static Dn |
dnOfRequest(Request request)
Returns the DN of the entry targeted by the provided request, or
null if the target entry cannot be
determined. |
static boolean |
isCancel(Request request)
Checks whether the provided request is a Cancel extended request.
|
static boolean |
isPersistentSearch(Request request)
Returns whether the provided request is a persistent search request.
|
static AbandonRequest |
newAbandonRequest(int requestID)
Creates a new abandon request using the provided message ID.
|
static AddRequest |
newAddRequest(Dn name)
Creates a new add request using the provided distinguished name.
|
static AddRequest |
newAddRequest(Entry entry)
Creates a new add request backed by the provided entry.
|
static AddRequest |
newAddRequest(String... ldifLines)
Creates a new add request using the provided lines of LDIF decoded using
the default schema.
|
static AddRequest |
newAddRequest(String name)
Creates a new add request using the provided distinguished name decoded
using the default schema.
|
static BindRequest |
newAnonymousBindRequest()
Creates a new anonymous bind request initialized with an empty distinguished name, SIMPLE authentication type,
and an empty password.
|
static BindRequest |
newAnonymousSaslBindRequest(String traceString)
Creates a new anonymous SASL bind request as defined in RFC 4505.
|
static BindRequest |
newBindRequest()
Creates a new bind request initialized with an empty distinguished name, SIMPLE authentication type, and an empty
password.
|
static CancelExtendedRequest |
newCancelExtendedRequest(int requestID)
Creates a new cancel extended request using the provided message ID.
|
static ChangeRecord |
newChangeRecord(String... ldifLines)
Creates a new change record (an add, delete, modify, or modify DN
request) using the provided lines of LDIF decoded using the default
schema.
|
static CompareRequest |
newCompareRequest(Dn name,
AttributeDescription attributeDescription,
Object assertionValue)
Creates a new compare request using the provided distinguished name,
attribute name, and assertion value.
|
static CompareRequest |
newCompareRequest(String name,
String attributeDescription,
Object assertionValue)
Creates a new compare request using the provided distinguished name,
attribute name, and assertion value decoded using the default schema.
|
static BindRequest |
newCramMd5SaslBindRequest(String authenticationId,
char[] password)
Creates a new CRAM-MD5 SASL bind request as defined in draft-ietf-sasl-crammd5.
|
static DeleteRequest |
newDeleteRequest(Dn name)
Creates a new delete request using the provided distinguished name.
|
static DeleteRequest |
newDeleteRequest(String name)
Creates a new delete request using the provided distinguished name
decoded using the default schema.
|
static BindRequest |
newDigestMd5SaslBindRequest(String digestUri,
String authenticationId,
char[] password,
String authorizationId,
String realm,
Map<String,?> properties)
Creates a new DIGEST-MD5 SASL bind request as defined in RFC 2831.
|
static BindRequest |
newExternalSaslBindRequest(String authorizationId)
Creates a new External SASL bind request as defined in RFC 4422.
|
static GenericExtendedRequest |
newGenericExtendedRequest(String requestName)
Creates a new generic extended request using the provided name and no
value.
|
static GenericExtendedRequest |
newGenericExtendedRequest(String requestName,
Object requestValue)
Creates a new generic extended request using the provided name and
optional value.
|
static BindRequest |
newGssapiSaslBindRequest(String serverName,
Subject subject,
String authorizationId,
Map<String,?> properties)
Creates a new GSSAPI SASL bind request as defined in RFC 2831.
|
static InvalidRequest |
newInvalidRequest(Request.RequestType invalidRequestType,
String invalidRawDn,
LdapException reason)
Creates a new invalid request using the provided reason.
|
static ModifyDnRequest |
newModifyDnRequest(Dn name,
Rdn newRDN)
Creates a new modify DN request using the provided distinguished name and
new RDN.
|
static ModifyDnRequest |
newModifyDnRequest(String name,
String newRDN)
Creates a new modify DN request using the provided distinguished name and
new RDN decoded using the default schema.
|
static ModifyRequest |
newModifyRequest(Dn name)
Creates a new modify request using the provided distinguished name.
|
static ModifyRequest |
newModifyRequest(Entry fromEntry,
Entry toEntry)
Creates a new modify request containing a list of modifications which can
be used to transform
fromEntry into entry toEntry . |
static ModifyRequest |
newModifyRequest(String... ldifLines)
Creates a new modify request using the provided lines of LDIF decoded
using the default schema.
|
static ModifyRequest |
newModifyRequest(String name)
Creates a new modify request using the provided distinguished name
decoded using the default schema.
|
static PasswordModifyExtendedRequest |
newPasswordModifyExtendedRequest()
Creates a new password modify extended request, with no user identity,
old password, or new password.
|
static BindRequest |
newPlainSaslBindRequest(String authenticationId,
char[] password,
String authorizationId)
Creates a new Plain SASL bind request as defined in RFC 4616.
|
static BindRequest |
newSaslBindRequest(SaslClient saslClient)
Creates a new SASL bind request configured to use the provided
SaslClient . |
static SearchRequest |
newSearchRequest(Dn name,
SearchScope scope)
Creates a new search request using the provided distinguished name and scope.
|
static SearchRequest |
newSearchRequest(Dn name,
SearchScope scope,
Filter filter,
String... attributeDescriptions)
Creates a new search request using the provided distinguished name,
scope, and filter.
|
static SearchRequest |
newSearchRequest(String name,
SearchScope scope)
Creates a new search request using the provided distinguished name and scope.
|
static SearchRequest |
newSearchRequest(String name,
SearchScope scope,
String filter,
String... attributeDescriptions)
Creates a new search request using the provided distinguished name,
scope, and filter, decoded using the default schema.
|
static BindRequest |
newSimpleBindRequest(Dn name,
byte[] password)
Creates a new simple bind request having the provided name and password
suitable for name/password authentication.
|
static BindRequest |
newSimpleBindRequest(Dn name,
char[] password)
Creates a new simple bind request having the provided name and password
suitable for name/password authentication.
|
static BindRequest |
newSimpleBindRequest(Dn name,
String password)
Creates a new simple bind request having the provided name and password
suitable for name/password authentication.
|
static BindRequest |
newSimpleBindRequest(String name,
byte[] password)
Creates a new simple bind request having the provided name and password
suitable for name/password authentication.
|
static BindRequest |
newSimpleBindRequest(String name,
char[] password)
Creates a new simple bind request having the provided name and password
suitable for name/password authentication.
|
static BindRequest |
newSimpleBindRequest(String name,
String password)
Creates a new simple bind request having the provided name and password
suitable for name/password authentication.
|
static SearchRequest |
newSingleEntrySearchRequest(Dn name,
SearchScope scope,
Filter filter,
String... attributeDescriptions)
Creates a new search request for a single entry, using the provided distinguished name,
scope, and filter.
|
static SearchRequest |
newSingleEntrySearchRequest(String name,
SearchScope scope,
String filter,
String... attributeDescriptions)
Creates a new search request for a single entry, using the provided distinguished name,
scope, and filter, decoded using the default schema.
|
static StartTlsExtendedRequest |
newStartTlsExtendedRequest(SslOptions sslOptions)
Creates a new start TLS extended request which will use the provided SSL
context.
|
static UnbindRequest |
newUnbindRequest()
Creates a new unbind request.
|
static UnknownRequest |
newUnknownRequest(byte protocolOpType,
ByteString rawContent)
Creates a new unknown request backed by the provided bytes.
|
static WhoAmIExtendedRequest |
newWhoAmIExtendedRequest()
Creates a new Who Am I extended request.
|
static <R extends Request> |
shallowCopyOfRequest(R request,
Collection<String> excludeControlOids)
Creates a new request that is a shallow copy of the provided request, except for
controls list which is a new list containing the original controls (and not the original list
of controls) possibly filtered by the provided exclusion parameter.
|
static <R extends Request> |
shallowCopyOfRequest(R request,
String... excludeControlOids)
Creates a new request that is a shallow copy of the provided request, except for
controls list which is a new list containing the original controls (and not the original list
of controls) possibly filtered by the provided exclusion parameter.
|
static AbandonRequest |
unmodifiableAbandonRequest(AbandonRequest request)
Creates an unmodifiable abandon request of the provided request.
|
static AddRequest |
unmodifiableAddRequest(AddRequest request)
Creates an unmodifiable add request of the provided request.
|
static BindRequest |
unmodifiableBindRequest(BindRequest request)
Creates an unmodifiable bind request of the provided request.
|
static CancelExtendedRequest |
unmodifiableCancelExtendedRequest(CancelExtendedRequest request)
Creates an unmodifiable cancel extended request of the provided request.
|
static CompareRequest |
unmodifiableCompareRequest(CompareRequest request)
Creates an unmodifiable compare request of the provided request.
|
static DeleteRequest |
unmodifiableDeleteRequest(DeleteRequest request)
Creates an unmodifiable delete request of the provided request.
|
static GenericExtendedRequest |
unmodifiableGenericExtendedRequest(GenericExtendedRequest request)
Creates an unmodifiable generic extended request of the provided request.
|
static ModifyDnRequest |
unmodifiableModifyDnRequest(ModifyDnRequest request)
Creates an unmodifiable modify DN request of the provided request.
|
static ModifyRequest |
unmodifiableModifyRequest(ModifyRequest request)
Creates an unmodifiable modify request of the provided request.
|
static PasswordModifyExtendedRequest |
unmodifiablePasswordModifyExtendedRequest(PasswordModifyExtendedRequest request)
Creates an unmodifiable password modify extended request of the provided
request.
|
static SearchRequest |
unmodifiableSearchRequest(SearchRequest request)
Creates an unmodifiable search request of the provided request.
|
static StartTlsExtendedRequest |
unmodifiableStartTlsExtendedRequest(StartTlsExtendedRequest request)
Creates an unmodifiable startTLS extended request of the provided
request.
|
static UnbindRequest |
unmodifiableUnbindRequest(UnbindRequest request)
Creates an unmodifiable unbind request of the provided request.
|
static WhoAmIExtendedRequest |
unmodifiableWhoAmIExtendedRequest(WhoAmIExtendedRequest request)
Creates an unmodifiable new Who Am I extended request of the provided
request.
|
public static boolean isPersistentSearch(Request request)
request
- The request to test.true
if the provided request is a persistent search request, false
otherwise.public static boolean isCancel(Request request)
request
- The request to check.true
if the request is a Cancel request, false
otherwise.public static Dn dnOfRequest(Request request)
null
if the target entry cannot be
determined. This method will return null
for most extended operations and SASL bind requests because
the target DN cannot be recovered.request
- The request whose target entry DN is to be determined.null
if the target entry cannot be
determined.public static <R extends Request> R shallowCopyOfRequest(R request, String... excludeControlOids)
The intended usage is to be able to perform modification of the controls of a request without affecting the original request.
R
- The type of the requestrequest
- the original requestexcludeControlOids
- OIDs of controls to exclude from the new requestpublic static <R extends Request> R shallowCopyOfRequest(R request, Collection<String> excludeControlOids)
The intended usage is to be able to perform modification of the controls of a request without affecting the original request.
R
- The type of the requestrequest
- the original requestexcludeControlOids
- OIDs of controls to exclude from the new requestpublic static AbandonRequest copyOfAbandonRequest(AbandonRequest request)
request
- The abandon request to be copied.NullPointerException
- If request
was null
public static AddRequest copyOfAddRequest(AddRequest request)
request
- The add request to be copied.NullPointerException
- If request
was null
.public static CancelExtendedRequest copyOfCancelExtendedRequest(CancelExtendedRequest request)
request
- The cancel extended request to be copied.NullPointerException
- If request
was null
.public static CompareRequest copyOfCompareRequest(CompareRequest request)
request
- The compare request to be copied.NullPointerException
- If request
was null
.public static DeleteRequest copyOfDeleteRequest(DeleteRequest request)
request
- The add request to be copied.NullPointerException
- If request
was null
.public static BindRequest copyOfBindRequest(BindRequest request)
request
- The bind request to be copied.NullPointerException
- If request
was null
.public static GenericExtendedRequest copyOfGenericExtendedRequest(GenericExtendedRequest request)
request
- The generic extended request to be copied.NullPointerException
- If request
was null
.public static ModifyDnRequest copyOfModifyDnRequest(ModifyDnRequest request)
request
- The modify DN request to be copied.NullPointerException
- If request
was null
.public static ModifyRequest copyOfModifyRequest(ModifyRequest request)
request
- The modify request to be copied.NullPointerException
- If request
was null
.public static PasswordModifyExtendedRequest copyOfPasswordModifyExtendedRequest(PasswordModifyExtendedRequest request)
request
- The password modify extended request to be copied.NullPointerException
- If request
was null
.public static SearchRequest copyOfSearchRequest(SearchRequest request)
request
- The search request to be copied.NullPointerException
- If request
was null
.public static StartTlsExtendedRequest copyOfStartTlsExtendedRequest(StartTlsExtendedRequest request)
request
- The startTLS extended request to be copied.NullPointerException
- If request
was null
.public static UnbindRequest copyOfUnbindRequest(UnbindRequest request)
request
- The unbind request to be copied.NullPointerException
- If request
was null
.public static WhoAmIExtendedRequest copyOfWhoAmIExtendedRequest(WhoAmIExtendedRequest request)
request
- The who Am I extended request to be copied.NullPointerException
- If request
was null
.public static AbandonRequest newAbandonRequest(int requestID)
requestID
- The request ID of the request to be abandoned.public static AddRequest newAddRequest(Dn name)
name
- The distinguished name of the entry to be added.NullPointerException
- If name
was null
.public static AddRequest newAddRequest(Entry entry)
entry
will be reflected in the returned add request. The
returned add request supports updates to its list of controls, as well as
updates to the name and attributes if the underlying entry allows.entry
- The entry to be added.NullPointerException
- If entry
was null
.public static AddRequest newAddRequest(String name) throws LocalizedIllegalArgumentException
name
- The distinguished name of the entry to be added.LocalizedIllegalArgumentException
- If name
could not be decoded using the default
schema.NullPointerException
- If name
was null
.public static AddRequest newAddRequest(String... ldifLines) throws LocalizedIllegalArgumentException
ldifLines
- Lines of LDIF containing an LDIF add change record or an LDIF
entry record.LocalizedIllegalArgumentException
- If ldifLines
was empty, or contained invalid LDIF, or
could not be decoded using the default schema.NullPointerException
- If ldifLines
was null
.public static CancelExtendedRequest newCancelExtendedRequest(int requestID)
requestID
- The request ID of the request to be abandoned.public static ChangeRecord newChangeRecord(String... ldifLines) throws LocalizedIllegalArgumentException
ldifLines
- Lines of LDIF containing an LDIF change record or an LDIF
entry record.LocalizedIllegalArgumentException
- If ldifLines
was empty, or contained invalid LDIF, or
could not be decoded using the default schema.NullPointerException
- If ldifLines
was null
.public static CompareRequest newCompareRequest(Dn name, AttributeDescription attributeDescription, Object assertionValue)
If the assertion value is not an instance of ByteString
then it
will be converted using the ByteString.valueOfObject(Object)
method.
name
- The distinguished name of the entry to be compared.attributeDescription
- The name of the attribute to be compared.assertionValue
- The assertion value to be compared.NullPointerException
- If name
, attributeDescription
, or
assertionValue
was null
.public static CompareRequest newCompareRequest(String name, String attributeDescription, Object assertionValue) throws LocalizedIllegalArgumentException
If the assertion value is not an instance of ByteString
then it
will be converted using the ByteString.valueOfObject(Object)
method.
name
- The distinguished name of the entry to be compared.attributeDescription
- The name of the attribute to be compared.assertionValue
- The assertion value to be compared.LocalizedIllegalArgumentException
- If name
or attributeDescription
could not be
decoded using the default schema.NullPointerException
- If name
, attributeDescription
, or
assertionValue
was null
.public static DeleteRequest newDeleteRequest(Dn name)
name
- The distinguished name of the entry to be deleted.NullPointerException
- If name
was null
.public static DeleteRequest newDeleteRequest(String name) throws LocalizedIllegalArgumentException
name
- The distinguished name of the entry to be deleted.LocalizedIllegalArgumentException
- If name
could not be decoded using the default
schema.NullPointerException
- If name
was null
.public static BindRequest newAnonymousBindRequest()
This method is exactly equivalent to newBindRequest()
, but its usage may result in more readable code
in cases where the intent is to perform an anonymous bind request.
public static BindRequest newBindRequest()
public static BindRequest newSaslBindRequest(SaslClient saslClient)
SaslClient
. The returned bind request
will have the same SASL mechanism as the provided SASL client and its SASL credentials will be populated with
the SASL client's initial response if available.saslClient
- The SASL client which will drive the SASL authentication process.IllegalArgumentException
- If the provided SASL client has not been configured correctly.NullPointerException
- If saslClient
was null
.public static BindRequest newAnonymousSaslBindRequest(String traceString)
Clients should provide trace information, which has no semantic value, and can be used by administrators in order to identify the user. It should take one of two forms: an Internet email address, or an opaque string that does not contain the '@' (U+0040) character and that can be interpreted by the system administrator of the client's domain. For privacy reasons, an Internet email address or other information identifying the user should only be used with permission from the user.
traceString
- The optional trace information, which has no semantic value and can be used by administrators in order
to identify the user, may be null
.public static BindRequest newPlainSaslBindRequest(String authenticationId, char[] password, String authorizationId)
The authentication and optional authorization identities are specified using an authorization ID, or authzId
, as defined in RFC 4513 section 5.2.1.8.
authenticationId
- The authentication ID of the user. The authentication ID usually has the form "dn:" immediately followed
by the distinguished name of the user, or "u:" followed by a user ID string, but other forms are
permitted.password
- The password of the user that the client wishes to bind as. The password will be converted to a UTF-8
octet string.authorizationId
- The optional authorization ID of the user which represents an alternate authorization identity which
should be used for subsequent operations performed on the connection. The authorization ID usually has
the form "dn:" immediately followed by the distinguished name of the user, or "u:" followed by a user ID
string, but other forms are permitted.NullPointerException
- If authenticationId
or password
are null
.public static BindRequest newExternalSaslBindRequest(String authorizationId)
A client may either request that its authorization identity be automatically derived from its authentication credentials exchanged at a lower security layer, or it may explicitly provide a desired authorization identity.
The optional authorization identity is specified using an authorization ID, or authzId
, as defined in
RFC 4513 section 5.2.1.8.
authorizationId
- The optional authorization ID of the user which represents an alternate authorization identity which
should be used for subsequent operations performed on the connection. The authorization ID usually has
the form "dn:" immediately followed by the distinguished name of the user, or "u:" followed by a user ID
string, but other forms are permitted.public static BindRequest newCramMd5SaslBindRequest(String authenticationId, char[] password)
The CRAM-MD5 mechanism is intended to have limited use on the Internet. The mechanism offers inadequate protection against common attacks against application-level protocols and is prone to interoperability problems.
The authentication and optional authorization identities are specified using an authorization ID, or authzId
, as defined in RFC 4513 section 5.2.1.8.
authenticationId
- The authentication ID of the user. The authentication ID usually has the form "dn:" immediately followed
by the distinguished name of the user, or "u:" followed by a user ID string, but other forms are
permitted.password
- The password of the user that the client wishes to bind as. The password will be converted to a UTF-8
octet string.NullPointerException
- If authenticationId
or password
are null
.public static BindRequest newDigestMd5SaslBindRequest(String digestUri, String authenticationId, char[] password, String authorizationId, String realm, Map<String,?> properties)
Compared to CRAM-MD5, DIGEST-MD5 prevents chosen plain-text attacks, and permits the use of third party authentication servers, mutual authentication, and optimized re-authentication if a client has recently authenticated to a server.
The authentication and optional authorization identities are specified using an authorization ID, or authzId
, as defined in RFC 4513 section 5.2.1.8.
digestUri
- The digest-uri which indicates the principal name of the service with which the client wishes to connect.
Format is defined in RFC-2831. If the serv-type is not provided, ldap will be used
as default.authenticationId
- The authentication ID of the user. The authentication ID usually has the form "dn:" immediately followed
by the distinguished name of the user, or "u:" followed by a user ID string, but other forms are
permitted.password
- The password of the user that the client wishes to bind as. The password will be converted to a UTF-8
octet string.authorizationId
- The optional authorization ID of the user which represents an alternate authorization identity which
should be used for subsequent operations performed on the connection. The authorization ID usually has
the form "dn:" immediately followed by the distinguished name of the user, or "u:" followed by a user ID
string, but other forms are permitted.realm
- The optional name of the realm containing the user's account, which may be null
.properties
- The optional map containing additional SASL mechanism parameters, which may be null
.
See Sasl
and the Java SASL reference guide for more information
about the properties compatible with this SASL mechanism.NullPointerException
- If digestUri
, authenticationId
, or password
are null
.public static BindRequest newGssapiSaslBindRequest(String serverName, Subject subject, String authorizationId, Map<String,?> properties)
The optional authorization identity is specified using an authorization ID, or authzId
, as defined in
RFC 4513 section 5.2.1.8.
serverName
- The fully-qualified host name of the server to authenticate to.subject
- The Kerberos subject representing the user to be authenticated.authorizationId
- The optional authorization ID of the user which represents an alternate authorization identity which
should be used for subsequent operations performed on the connection. The authorization ID usually has
the form "dn:" immediately followed by the distinguished name of the user, or "u:" followed by a user ID
string, but other forms are permitted.properties
- The optional map containing additional SASL mechanism parameters, which may be null
. See Sasl
and the Java SASL reference guide for more information about the properties
compatible with this SASL mechanism.NullPointerException
- If serverName
or subject
are null
.public static GenericExtendedRequest newGenericExtendedRequest(String requestName)
requestName
- The dotted-decimal representation of the unique OID
corresponding to this extended request.NullPointerException
- If requestName
was null
.public static GenericExtendedRequest newGenericExtendedRequest(String requestName, Object requestValue)
If the request value is not an instance of ByteString
then it
will be converted using the ByteString.valueOfObject(Object)
method.
requestName
- The dotted-decimal representation of the unique OID
corresponding to this extended request.requestValue
- The content of this generic extended request in a form defined
by the extended operation, or null
if there is no
content.NullPointerException
- If requestName
was null
.public static InvalidRequest newInvalidRequest(Request.RequestType invalidRequestType, String invalidRawDn, LdapException reason)
invalidRequestType
- The Ldap protocol-op type of the invalid request.invalidRawDn
- The Dn which make this request invalid (might be null
if the request is invalid because of
another reason)reason
- The reason why the request is invalid.public static ModifyDnRequest newModifyDnRequest(Dn name, Rdn newRDN)
null
, indicating that the
renamed entry will remain under the same parent entry, and the old RDN
attribute values will not be deleted.name
- The distinguished name of the entry to be renamed.newRDN
- The new RDN of the entry.NullPointerException
- If name
or newRDN
was null
.public static ModifyDnRequest newModifyDnRequest(String name, String newRDN) throws LocalizedIllegalArgumentException
null
, indicating that the renamed entry will remain under the
same parent entry, and the old RDN attribute values will not be deleted.name
- The distinguished name of the entry to be renamed.newRDN
- The new RDN of the entry.LocalizedIllegalArgumentException
- If name
or newRDN
could not be decoded using
the default schema.NullPointerException
- If name
or newRDN
was null
.public static ModifyRequest newModifyRequest(Dn name)
name
- The distinguished name of the entry to be modified.NullPointerException
- If name
was null
.public static ModifyRequest newModifyRequest(Entry fromEntry, Entry toEntry)
fromEntry
into entry toEntry
.
The changes will be generated using a default set of
options
. More
specifically, only user attributes will be compared, attributes will be
compared using their matching rules, and all generated changes will be
reversible: it will contain only modifications of type
DELETE
then ADD
.
Finally, the modify request will use the distinguished name taken from
fromEntry
. Moreover, this method will not check to see if both
fromEntry
and toEntry
have the same distinguished name.
This method is equivalent to:
ModifyRequest request = Entries.diffEntries(fromEntry, toEntry);Or:
ModifyRequest request = Entries.diffEntries(fromEntry, toEntry, Options.defaultOptions());
fromEntry
- The source entry.toEntry
- The destination entry.fromEntry
into entry toEntry
.
The returned request will always be non-null
but may not
contain any modifications.NullPointerException
- If fromEntry
or toEntry
were null
.Entries.diffEntries(Entry, Entry)
public static ModifyRequest newModifyRequest(String name) throws LocalizedIllegalArgumentException
name
- The distinguished name of the entry to be modified.LocalizedIllegalArgumentException
- If name
could not be decoded using the default schema.NullPointerException
- If name
was null
.public static ModifyRequest newModifyRequest(String... ldifLines) throws LocalizedIllegalArgumentException
ldifLines
- Lines of LDIF containing a single LDIF modify change record.LocalizedIllegalArgumentException
- If ldifLines
was empty, or contained invalid LDIF, or
could not be decoded using the default schema.NullPointerException
- If ldifLines
was null
.public static PasswordModifyExtendedRequest newPasswordModifyExtendedRequest()
public static SearchRequest newSearchRequest(Dn name, SearchScope scope, Filter filter, String... attributeDescriptions)
name
- The distinguished name of the base entry relative to which the
search is to be performed.scope
- The scope of the search.filter
- The filter that defines the conditions that must be fulfilled
in order for an entry to be returned.attributeDescriptions
- The names of the attributes to be included with each entry.NullPointerException
- If the name
, scope
, or filter
were
null
.public static SearchRequest newSearchRequest(String name, SearchScope scope, String filter, String... attributeDescriptions) throws LocalizedIllegalArgumentException
name
- The distinguished name of the base entry relative to which the
search is to be performed.scope
- The scope of the search.filter
- The filter that defines the conditions that must be fulfilled
in order for an entry to be returned.attributeDescriptions
- The names of the attributes to be included with each entry.LocalizedIllegalArgumentException
- If name
could not be decoded using the default
schema, or if filter
is not a valid LDAP string
representation of a filter.NullPointerException
- If the name
, scope
, or filter
were
null
.public static SearchRequest newSearchRequest(Dn name, SearchScope scope)
It will use the (objectlass=*)
filter.
name
- The distinguished name of the base entry relative to which the
search is to be performed.scope
- The scope of the search.NullPointerException
- If the name
, scope
were null
.public static SearchRequest newSearchRequest(String name, SearchScope scope)
It will use the (objectlass=*)
filter.
name
- The distinguished name of the base entry relative to which the
search is to be performed.scope
- The scope of the search.NullPointerException
- If the name
, scope
were null
.public static SearchRequest newSingleEntrySearchRequest(Dn name, SearchScope scope, Filter filter, String... attributeDescriptions)
name
- The distinguished name of the base entry relative to which the
search is to be performed.scope
- The scope of the search.filter
- The filter that defines the conditions that must be fulfilled
in order for an entry to be returned.attributeDescriptions
- The names of the attributes to be included with each entry.NullPointerException
- If the name
, scope
, or filter
were
null
.public static SearchRequest newSingleEntrySearchRequest(String name, SearchScope scope, String filter, String... attributeDescriptions) throws LocalizedIllegalArgumentException
name
- The distinguished name of the base entry relative to which the
search is to be performed.scope
- The scope of the search.filter
- The filter that defines the conditions that must be fulfilled
in order for an entry to be returned.attributeDescriptions
- The names of the attributes to be included with each entry.LocalizedIllegalArgumentException
- If name
could not be decoded using the default
schema, or if filter
is not a valid LDAP string
representation of a filter.NullPointerException
- If the name
, scope
, or filter
were
null
.public static BindRequest newSimpleBindRequest(String name, byte[] password) throws LocalizedIllegalArgumentException
The LDAP protocol defines the Bind name to be a distinguished name, however some LDAP implementations have relaxed this constraint and allow other identities to be used, such as the user's email address.
name
- The name of the Directory object that the client wishes to
bind as, which may be empty.password
- The password of the Directory object that the client wishes to
bind as, which may be empty indicating that an unauthenticated
bind is to be performed.LocalizedIllegalArgumentException
- If name
could not be decoded using the default schema.NullPointerException
- If name
or password
was null
.public static BindRequest newSimpleBindRequest(Dn name, byte[] password)
The LDAP protocol defines the Bind name to be a distinguished name, however some LDAP implementations have relaxed this constraint and allow other identities to be used, such as the user's email address.
name
- The name of the Directory object that the client wishes to
bind as, which may be empty.password
- The password of the Directory object that the client wishes to
bind as, which may be empty indicating that an unauthenticated
bind is to be performed.NullPointerException
- If name
or password
was null
.public static BindRequest newSimpleBindRequest(String name, char[] password)
The LDAP protocol defines the Bind name to be a distinguished name, however some LDAP implementations have relaxed this constraint and allow other identities to be used, such as the user's email address.
name
- The name of the Directory object that the client wishes to
bind as, which may be empty.password
- The password of the Directory object that the client wishes to
bind as, which may be empty indicating that an unauthenticated
bind is to be performed. The password will be converted to a
UTF-8 octet string.NullPointerException
- If name
or password
was null
.public static BindRequest newSimpleBindRequest(String name, String password) throws LocalizedIllegalArgumentException
The LDAP protocol defines the Bind name to be a distinguished name, however some LDAP implementations have relaxed this constraint and allow other identities to be used, such as the user's email address.
name
- The name of the Directory object that the client wishes to
bind as, which may be empty.password
- The password of the Directory object that the client wishes to
bind as, which may be empty indicating that an unauthenticated
bind is to be performed. The password will be converted to a
UTF-8 octet string.LocalizedIllegalArgumentException
- If dn
is not a valid LDAP string representation of a DN.NullPointerException
- If name
or password
was null
.public static BindRequest newSimpleBindRequest(Dn name, char[] password)
The LDAP protocol defines the Bind name to be a distinguished name, however some LDAP implementations have relaxed this constraint and allow other identities to be used, such as the user's email address.
name
- The name of the Directory object that the client wishes to
bind as, which may be empty.password
- The password of the Directory object that the client wishes to
bind as, which may be empty indicating that an unauthenticated
bind is to be performed. The password will be converted to a
UTF-8 octet string.NullPointerException
- If name
or password
was null
.public static BindRequest newSimpleBindRequest(Dn name, String password)
The LDAP protocol defines the Bind name to be a distinguished name, however some LDAP implementations have relaxed this constraint and allow other identities to be used, such as the user's email address.
name
- The name of the Directory object that the client wishes to
bind as, which may be empty.password
- The password of the Directory object that the client wishes to
bind as, which may be empty indicating that an unauthenticated
bind is to be performed. The password will be converted to a
UTF-8 octet string.NullPointerException
- If name
or password
was null
.public static StartTlsExtendedRequest newStartTlsExtendedRequest(SslOptions sslOptions)
sslOptions
- The SslOptions that should be used when installing the TLS
layer.NullPointerException
- If sslContext
was null
.public static UnbindRequest newUnbindRequest()
public static UnknownRequest newUnknownRequest(byte protocolOpType, ByteString rawContent)
protocolOpType
- The LDAP protocol-op type which was not recognized as a standard LDAP one.rawContent
- Bytes of this unknown request.NullPointerException
- If rawContent
was null
.public static WhoAmIExtendedRequest newWhoAmIExtendedRequest()
public static AbandonRequest unmodifiableAbandonRequest(AbandonRequest request)
request
- The abandon request to be copied.NullPointerException
- If request
was null
public static AddRequest unmodifiableAddRequest(AddRequest request)
request
- The add request to be copied.NullPointerException
- If request
was null
.public static CancelExtendedRequest unmodifiableCancelExtendedRequest(CancelExtendedRequest request)
request
- The cancel extended request to be copied.NullPointerException
- If request
was null
.public static CompareRequest unmodifiableCompareRequest(CompareRequest request)
request
- The compare request to be copied.NullPointerException
- If request
was null
.public static DeleteRequest unmodifiableDeleteRequest(DeleteRequest request)
request
- The add request to be copied.NullPointerException
- If request
was null
.public static BindRequest unmodifiableBindRequest(BindRequest request)
The returned bind request creates defensive copies of the authentication value in order to maintain immutability.
request
- The bind request to be copied.NullPointerException
- If request
was null
.public static GenericExtendedRequest unmodifiableGenericExtendedRequest(GenericExtendedRequest request)
request
- The generic extended request to be copied.NullPointerException
- If request
was null
.public static ModifyDnRequest unmodifiableModifyDnRequest(ModifyDnRequest request)
request
- The modify DN request to be copied.NullPointerException
- If request
was null
.public static ModifyRequest unmodifiableModifyRequest(ModifyRequest request)
request
- The modify request to be copied.NullPointerException
- If request
was null
.public static PasswordModifyExtendedRequest unmodifiablePasswordModifyExtendedRequest(PasswordModifyExtendedRequest request)
request
- The password modify extended request to be copied.NullPointerException
- If request
was null
.public static SearchRequest unmodifiableSearchRequest(SearchRequest request)
request
- The search request to be copied.NullPointerException
- If request
was null
.public static StartTlsExtendedRequest unmodifiableStartTlsExtendedRequest(StartTlsExtendedRequest request)
request
- The startTLS extended request to be copied.NullPointerException
- If request
was null
.public static UnbindRequest unmodifiableUnbindRequest(UnbindRequest request)
request
- The unbind request to be copied.NullPointerException
- If request
was null
.public static WhoAmIExtendedRequest unmodifiableWhoAmIExtendedRequest(WhoAmIExtendedRequest request)
request
- The who Am I extended request to be copied.NullPointerException
- If request
was null
.Copyright 2010-2022 ForgeRock AS.