Interface WhoAmIExtendedResult
-
- All Superinterfaces:
ExtendedResult
,ProtocolOp
,Response
,Result
public interface WhoAmIExtendedResult extends ExtendedResult
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description WhoAmIExtendedResult
addControl(Control control)
Adds the provided control to this protocol-op.WhoAmIExtendedResult
addControls(Iterable<? extends Control> controls)
Adds the provided controls to this protocol-op.WhoAmIExtendedResult
addReferralUri(String uri)
Adds the provided referral URI to this result.String
getAuthorizationId()
Returns the authorization ID of the user.Throwable
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.List<Control>
getControls()
Returns aList
containing the controls included with this protocol-op.LocalizableMessage
getDiagnosticMessage()
Returns the diagnostic message associated with this result.String
getDiagnosticMessageAsString()
Returns the diagnostic message associated with this result as a string.String
getMatchedDn()
Returns the matched DN associated with this result.String
getOid()
Returns the numeric OID, if any, associated with this extended result.List<String>
getReferralUris()
Returns aList
containing the referral URIs included with this result.ResultCode
getResultCode()
Returns the result code associated with this result.ByteString
getValue()
Returns the value, if any, associated with this extended result.boolean
hasValue()
Returnstrue
if this extended result has a value.boolean
isReferral()
Indicates whether a referral needs to be chased in order to complete the operation.boolean
isSuccess()
Indicates whether the request succeeded or not.WhoAmIExtendedResult
setAuthorizationId(String authorizationId)
Sets the authorization ID of the user.WhoAmIExtendedResult
setCause(Throwable cause)
Sets the throwable cause associated with this result if available.WhoAmIExtendedResult
setDiagnosticMessage(CharSequence message)
Sets the diagnostic message associated with this result.WhoAmIExtendedResult
setMatchedDn(String dn)
Sets the matched DN associated with this result.WhoAmIExtendedResult
setMatchedDn(Dn dn)
Sets the matched DN associated with this result.WhoAmIExtendedResult
setResultCode(ResultCode resultCode)
Sets the result code associated with this result.-
Methods inherited from interface org.forgerock.opendj.ldap.messages.ProtocolOp
containsControl, getControl
-
-
-
-
Method Detail
-
addControl
WhoAmIExtendedResult addControl(Control control)
Description copied from interface:ProtocolOp
Adds the provided control to this protocol-op.- Specified by:
addControl
in interfaceExtendedResult
- Specified by:
addControl
in interfaceProtocolOp
- Specified by:
addControl
in interfaceResponse
- Specified by:
addControl
in interfaceResult
- Parameters:
control
- The control to be added to this protocol-op.- Returns:
- This protocol-op.
-
addControls
WhoAmIExtendedResult addControls(Iterable<? extends Control> controls)
Description copied from interface:ProtocolOp
Adds the provided controls to this protocol-op.- Specified by:
addControls
in interfaceExtendedResult
- Specified by:
addControls
in interfaceProtocolOp
- Specified by:
addControls
in interfaceResponse
- Specified by:
addControls
in interfaceResult
- Parameters:
controls
- The controls to be added to this protocol-op.- Returns:
- This protocol-op.
-
addReferralUri
WhoAmIExtendedResult addReferralUri(String uri)
Description copied from interface:Result
Adds the provided referral URI to this result.- Specified by:
addReferralUri
in interfaceExtendedResult
- Specified by:
addReferralUri
in 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
null
if this result does not contain an authorization ID.
-
getCause
Throwable getCause()
Description copied from interface:Result
Returns 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:
getCause
in interfaceExtendedResult
- Specified by:
getCause
in interfaceResult
- Returns:
- The throwable cause, or
null
if none was provided.
-
getControl
<C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) throws DecodeException
Description copied from interface:ProtocolOp
Decodes and returns the first control in this protocol-op having an OID corresponding to the provided control decoder.- Specified by:
getControl
in interfaceExtendedResult
- Specified by:
getControl
in interfaceProtocolOp
- Specified by:
getControl
in 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
null
if 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
List<Control> getControls()
Description copied from interface:ProtocolOp
Returns aList
containing the controls included with this protocol-op. The returnedList
may be modified if permitted by this protocol-op.- Specified by:
getControls
in interfaceExtendedResult
- Specified by:
getControls
in interfaceProtocolOp
- Specified by:
getControls
in interfaceResult
- Returns:
- A
List
containing the controls.
-
getDiagnosticMessage
LocalizableMessage getDiagnosticMessage()
Description copied from interface:Result
Returns the diagnostic message associated with this result.- Specified by:
getDiagnosticMessage
in interfaceExtendedResult
- Specified by:
getDiagnosticMessage
in interfaceResult
- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null
).
-
getDiagnosticMessageAsString
String getDiagnosticMessageAsString()
Description copied from interface:Result
Returns the diagnostic message associated with this result as a string.- Specified by:
getDiagnosticMessageAsString
in interfaceExtendedResult
- Specified by:
getDiagnosticMessageAsString
in interfaceResult
- Returns:
- The diagnostic message, which may be empty if none was provided
(never
null
).
-
getMatchedDn
String getMatchedDn()
Description copied from interface:Result
Returns the matched DN associated with this result.- Specified by:
getMatchedDn
in interfaceExtendedResult
- Specified by:
getMatchedDn
in interfaceResult
- Returns:
- The matched DN, which may be empty if none was provided (never
null
).
-
getOid
String getOid()
Description copied from interface:ExtendedResult
Returns the numeric OID, if any, associated with this extended result.- Specified by:
getOid
in interfaceExtendedResult
- Returns:
- The numeric OID associated with this extended result, or
null
if there is no OID.
-
getReferralUris
List<String> getReferralUris()
Description copied from interface:Result
Returns aList
containing the referral URIs included with this result. The returnedList
may be modified if permitted by this result.- Specified by:
getReferralUris
in interfaceExtendedResult
- Specified by:
getReferralUris
in interfaceResult
- Returns:
- A
List
containing the referral URIs.
-
getResultCode
ResultCode getResultCode()
Description copied from interface:Result
Returns the result code associated with this result.- Specified by:
getResultCode
in interfaceExtendedResult
- Specified by:
getResultCode
in interfaceResult
- Returns:
- The result code.
-
getValue
ByteString getValue()
Description copied from interface:ExtendedResult
Returns the value, if any, associated with this extended result. Its format is defined by the specification of this extended result.- Specified by:
getValue
in interfaceExtendedResult
- Returns:
- The value associated with this extended result, or
null
if there is no value.
-
hasValue
boolean hasValue()
Description copied from interface:ExtendedResult
Returnstrue
if 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:
hasValue
in interfaceExtendedResult
- Returns:
true
if this extended result has a value, orfalse
if there is no value.
-
isReferral
boolean isReferral()
Description copied from interface:Result
Indicates whether a referral needs to be chased in order to complete the operation.Specifically, this method returns
true
if the result code is equal toResultCode.REFERRAL
.- Specified by:
isReferral
in interfaceExtendedResult
- Specified by:
isReferral
in interfaceResult
- Returns:
true
if a referral needs to be chased, otherwisefalse
.
-
isSuccess
boolean isSuccess()
Description copied from interface:Result
Indicates whether the request succeeded or not. This method will return {code true} for all non-error responses.- Specified by:
isSuccess
in interfaceExtendedResult
- Specified by:
isSuccess
in interfaceResult
- Returns:
true
if the request succeeded, otherwisefalse
.
-
setAuthorizationId
WhoAmIExtendedResult setAuthorizationId(String authorizationId)
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 benull
if this result does not contain an authorization ID.- Returns:
- This who am I result.
- Throws:
LocalizedIllegalArgumentException
- IfauthorizationId
was 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
WhoAmIExtendedResult setCause(Throwable cause)
Description copied from interface:Result
Sets 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:
setCause
in interfaceExtendedResult
- Specified by:
setCause
in interfaceResult
- Parameters:
cause
- The throwable cause, which may benull
indicating that none was provided.- Returns:
- This result.
-
setDiagnosticMessage
WhoAmIExtendedResult setDiagnosticMessage(CharSequence message)
Description copied from interface:Result
Sets the diagnostic message associated with this result.- Specified by:
setDiagnosticMessage
in interfaceExtendedResult
- Specified by:
setDiagnosticMessage
in interfaceResult
- Parameters:
message
- The diagnostic message, which may be empty ornull
indicating that none was provided.- Returns:
- This result.
-
setMatchedDn
WhoAmIExtendedResult setMatchedDn(String dn)
Description copied from interface:Result
Sets the matched DN associated with this result.- Specified by:
setMatchedDn
in interfaceExtendedResult
- Specified by:
setMatchedDn
in interfaceResult
- Parameters:
dn
- The matched DN associated, which may be empty ornull
indicating that none was provided.- Returns:
- This result.
-
setMatchedDn
WhoAmIExtendedResult setMatchedDn(Dn dn)
Description copied from interface:Result
Sets the matched DN associated with this result.- Specified by:
setMatchedDn
in interfaceExtendedResult
- Specified by:
setMatchedDn
in interfaceResult
- Parameters:
dn
- The matched DN associated, which may be empty ornull
indicating that none was provided.- Returns:
- This result.
-
setResultCode
WhoAmIExtendedResult setResultCode(ResultCode resultCode)
Description copied from interface:Result
Sets the result code associated with this result.- Specified by:
setResultCode
in interfaceExtendedResult
- Specified by:
setResultCode
in interfaceResult
- Parameters:
resultCode
- The result code.- Returns:
- This result.
-
-