Interface WhoAmIExtendedResult
- All Superinterfaces:
ExtendedResult,ProtocolOp,Response,Result
The who am I extended result as defined in RFC 4532. The result includes the
primary authorization identity, in its primary form, that the server has
associated with the user or application entity, but only if the who am I
request succeeded.
The authorization identity is specified using an authorization ID, or
authzId, as defined in RFC 4513 section 5.2.1.8.
The following example demonstrates use of the Who Am I? request and response.
Connection connection = ...;
String name = ...;
char[] password = ...;
Result result = connection.bind(name, password);
if (result.isSuccess()) {
WhoAmIExtendedRequest request = Requests.newWhoAmIExtendedRequest();
WhoAmIExtendedResult extResult = connection.extendedRequest(request);
if (extResult.isSuccess()) {
// Authz ID: " + extResult.getAuthorizationID());
}
}
-
Method Summary
Modifier and TypeMethodDescriptionaddControl(Control control) Adds the provided control to this protocol-op.addControls(Iterable<? extends Control> controls) Adds the provided controls to this protocol-op.addReferralUri(String uri) Adds the provided referral URI to this result.Returns the authorization ID of the user.getCause()Returns the throwable cause associated with this result if available.<C extends Control>
CgetControl(ControlDecoder<C> decoder, DecodeOptions options) Decodes and returns the first control in this protocol-op having an OID corresponding to the provided control decoder.Returns aListcontaining the controls included with this protocol-op.Returns the diagnostic message associated with this result.Returns the diagnostic message associated with this result as a string.Returns the matched DN associated with this result.getOid()Returns the numeric OID, if any, associated with this extended result.Returns aListcontaining the referral URIs included with this result.Returns the result code associated with this result.getValue()Returns the value, if any, associated with this extended result.booleanhasValue()Returnstrueif this extended result has a value.booleanIndicates whether a referral needs to be chased in order to complete the operation.booleanIndicates whether the request succeeded or not.removeControls(String oid) Removes all the controls having the specified OID.setAuthorizationId(String authorizationId) Sets the authorization ID of the user.Sets the throwable cause associated with this result if available.setDiagnosticMessage(CharSequence message) Sets the diagnostic message associated with this result.setMatchedDn(String dn) Sets the matched DN associated with this result.setMatchedDn(Dn dn) Sets the matched DN associated with this result.setResultCode(ResultCode resultCode) Sets the result code associated with this result.Methods inherited from interface org.forgerock.opendj.ldap.messages.ProtocolOp
containsControl, getControl
-
Method Details
-
addControl
Description copied from interface:ProtocolOpAdds the provided control to this protocol-op.- Specified by:
addControlin interfaceExtendedResult- Specified by:
addControlin interfaceProtocolOp- Specified by:
addControlin interfaceResponse- Specified by:
addControlin interfaceResult- Parameters:
control- The control to be added to this protocol-op.- Returns:
- This protocol-op.
-
addControls
Description copied from interface:ProtocolOpAdds the provided controls to this protocol-op.- Specified by:
addControlsin interfaceExtendedResult- Specified by:
addControlsin interfaceProtocolOp- Specified by:
addControlsin interfaceResponse- Specified by:
addControlsin interfaceResult- Parameters:
controls- The controls to be added to this protocol-op.- Returns:
- This protocol-op.
-
removeControls
Description copied from interface:ProtocolOpRemoves all the controls having the specified OID.- Specified by:
removeControlsin interfaceProtocolOp- Specified by:
removeControlsin interfaceResponse- Specified by:
removeControlsin interfaceResult- Parameters:
oid- The numeric OID of the protocol-op control to remove.- Returns:
- This protocol-op.
-
addReferralUri
Description copied from interface:ResultAdds the provided referral URI to this result.- Specified by:
addReferralUriin interfaceExtendedResult- Specified by:
addReferralUriin interfaceResult- Parameters:
uri- The referral URI to be added.- Returns:
- This result.
-
getAuthorizationId
String getAuthorizationId()Returns the authorization ID of the user. 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.- Returns:
- The authorization ID of the user, or
nullif this result does not contain an authorization ID.
-
getCause
Throwable getCause()Description copied from interface:ResultReturns the throwable cause associated with this result if available. A cause may be provided in cases where a result indicates a failure due to a client-side error.- Specified by:
getCausein interfaceExtendedResult- Specified by:
getCausein interfaceResult- Returns:
- The throwable cause, or
nullif none was provided.
-
getControl
<C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException Description copied from interface:ProtocolOpDecodes and returns the first control in this protocol-op having an OID corresponding to the provided control decoder.- Specified by:
getControlin interfaceExtendedResult- Specified by:
getControlin interfaceProtocolOp- Specified by:
getControlin interfaceResult- Type Parameters:
C- The type of control to be decoded and returned.- Parameters:
decoder- The control decoder.options- The set of decode options which should be used when decoding the control.- Returns:
- The decoded control, or
nullif the control is not included with this protocol-op. - Throws:
DecodeException- If the control could not be decoded because it was malformed in some way (e.g. the control value was missing, or its content could not be decoded).
-
getControls
Description copied from interface:ProtocolOpReturns aListcontaining the controls included with this protocol-op. The returnedListmay be modified if permitted by this protocol-op.- Specified by:
getControlsin interfaceExtendedResult- Specified by:
getControlsin interfaceProtocolOp- Specified by:
getControlsin interfaceResult- Returns:
- A
Listcontaining the controls.
-
getDiagnosticMessage
LocalizableMessage getDiagnosticMessage()Description copied from interface:ResultReturns the diagnostic message associated with this result.- Specified by:
getDiagnosticMessagein interfaceExtendedResult- Specified by:
getDiagnosticMessagein interfaceResult- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null).
-
getDiagnosticMessageAsString
String getDiagnosticMessageAsString()Description copied from interface:ResultReturns the diagnostic message associated with this result as a string.- Specified by:
getDiagnosticMessageAsStringin interfaceExtendedResult- Specified by:
getDiagnosticMessageAsStringin interfaceResult- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null).
-
getMatchedDn
String getMatchedDn()Description copied from interface:ResultReturns the matched DN associated with this result.- Specified by:
getMatchedDnin interfaceExtendedResult- Specified by:
getMatchedDnin interfaceResult- Returns:
- The matched DN, which may be empty if none was provided (never
null).
-
getOid
String getOid()Description copied from interface:ExtendedResultReturns the numeric OID, if any, associated with this extended result.- Specified by:
getOidin interfaceExtendedResult- Returns:
- The numeric OID associated with this extended result, or
nullif there is no OID.
-
getReferralUris
Description copied from interface:ResultReturns aListcontaining the referral URIs included with this result. The returnedListmay be modified if permitted by this result.- Specified by:
getReferralUrisin interfaceExtendedResult- Specified by:
getReferralUrisin interfaceResult- Returns:
- A
Listcontaining the referral URIs.
-
getResultCode
ResultCode getResultCode()Description copied from interface:ResultReturns the result code associated with this result.- Specified by:
getResultCodein interfaceExtendedResult- Specified by:
getResultCodein interfaceResult- Returns:
- The result code.
-
getValue
ByteString getValue()Description copied from interface:ExtendedResultReturns the value, if any, associated with this extended result. Its format is defined by the specification of this extended result.- Specified by:
getValuein interfaceExtendedResult- Returns:
- The value associated with this extended result, or
nullif there is no value.
-
hasValue
boolean hasValue()Description copied from interface:ExtendedResultReturnstrueif this extended result has a value. In some circumstances it may be useful to determine if a extended result has a value, without actually calculating the value and incurring any performance costs.- Specified by:
hasValuein interfaceExtendedResult- Returns:
trueif this extended result has a value, orfalseif there is no value.
-
isReferral
boolean isReferral()Description copied from interface:ResultIndicates whether a referral needs to be chased in order to complete the operation.Specifically, this method returns
trueif the result code is equal toResultCode.REFERRAL.- Specified by:
isReferralin interfaceExtendedResult- Specified by:
isReferralin interfaceResult- Returns:
trueif a referral needs to be chased, otherwisefalse.
-
isSuccess
boolean isSuccess()Description copied from interface:ResultIndicates whether the request succeeded or not. This method will return {code true} for all non-error responses.- Specified by:
isSuccessin interfaceExtendedResult- Specified by:
isSuccessin interfaceResult- Returns:
trueif the request succeeded, otherwisefalse.
-
setAuthorizationId
Sets the authorization ID of the user. 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.- Parameters:
authorizationId- The authorization ID of the user, which may benullif this result does not contain an authorization ID.- Returns:
- This who am I result.
- Throws:
LocalizedIllegalArgumentException- IfauthorizationIdwas non-empty and did not contain a valid authorization ID type.UnsupportedOperationException- If this who am I extended result does not permit the authorization ID to be set.
-
setCause
Description copied from interface:ResultSets the throwable cause associated with this result if available. A cause may be provided in cases where a result indicates a failure due to a client-side error.- Specified by:
setCausein interfaceExtendedResult- Specified by:
setCausein interfaceResult- Parameters:
cause- The throwable cause, which may benullindicating that none was provided.- Returns:
- This result.
-
setDiagnosticMessage
Description copied from interface:ResultSets the diagnostic message associated with this result.- Specified by:
setDiagnosticMessagein interfaceExtendedResult- Specified by:
setDiagnosticMessagein interfaceResult- Parameters:
message- The diagnostic message, which may be empty ornullindicating that none was provided.- Returns:
- This result.
-
setMatchedDn
Description copied from interface:ResultSets the matched DN associated with this result.- Specified by:
setMatchedDnin interfaceExtendedResult- Specified by:
setMatchedDnin interfaceResult- Parameters:
dn- The matched DN associated, which may be empty ornullindicating that none was provided.- Returns:
- This result.
-
setMatchedDn
Description copied from interface:ResultSets the matched DN associated with this result.- Specified by:
setMatchedDnin interfaceExtendedResult- Specified by:
setMatchedDnin interfaceResult- Parameters:
dn- The matched DN associated, which may be empty ornullindicating that none was provided.- Returns:
- This result.
-
setResultCode
Description copied from interface:ResultSets the result code associated with this result.- Specified by:
setResultCodein interfaceExtendedResult- Specified by:
setResultCodein interfaceResult- Parameters:
resultCode- The result code.- Returns:
- This result.
-