@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ProxiedAuthorizationV1RequestControl extends Control
ProxiedAuthorizationV2RequestControl
instead if this version.
ResultCode.AUTHORIZATION_DENIED
result for a proxied authorization V2
control if the requester does not have the appropriate permission to use that
control, this result will not necessarily be used for the same condition with
the proxied authorization V1 control because this result code was not defined
until the release of the proxied authorization V2 specification.
code.
// Create a delete request to delete an entry. Include the proxied // authorization v1 request control in the delete request so that the // delete will be processed as user // "uid=alternate.user,ou=People,dc=example,dc=com" instead of the user // that's actually authenticated on the connection. DeleteRequest deleteRequest = new DeleteRequest("uid=test.user,ou=People,dc=example,dc=com"); deleteRequest.addControl(new ProxiedAuthorizationV1RequestControl( "uid=alternate.user,ou=People,dc=example,dc=com")); LDAPResult deleteResult; try { deleteResult = connection.delete(deleteRequest); // If we got here, then the delete was successful. } catch (LDAPException le) { // The delete failed for some reason. In addition to all of the normal // reasons a delete could fail (e.g., the entry doesn't exist, or has one // or more subordinates), proxied-authorization specific failures may // include that the authenticated user doesn't have permission to use the // proxied authorization control to impersonate the alternate user, that // the alternate user doesn't exist, or that the alternate user doesn't // have permission to perform the requested operation. deleteResult = le.toLDAPResult(); ResultCode resultCode = le.getResultCode(); String errorMessageFromServer = le.getDiagnosticMessage(); }
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROXIED_AUTHORIZATION_V1_REQUEST_OID
The OID (2.16.840.1.113730.3.4.12) for the proxied authorization v1 request
control.
|
Constructor and Description |
---|
ProxiedAuthorizationV1RequestControl(Control control)
Creates a new proxied authorization v1 request control which is decoded
from the provided generic control.
|
ProxiedAuthorizationV1RequestControl(DN proxyDN)
Creates a new proxied authorization V1 request control that will proxy as
the specified user.
|
ProxiedAuthorizationV1RequestControl(java.lang.String proxyDN)
Creates a new proxied authorization V1 request control that will proxy as
the specified user.
|
Modifier and Type | Method and Description |
---|---|
static ProxiedAuthorizationV1RequestControl |
decodeJSONControl(JSONObject controlObject,
boolean strict)
Attempts to decode the provided object as a JSON representation of a
proxied authorization v1 request control.
|
java.lang.String |
getControlName()
Retrieves the user-friendly name for this control, if available.
|
java.lang.String |
getProxyDN()
Retrieves the DN of the target user under whose authorization the
associated request should be performed.
|
JSONObject |
toJSONControl()
Retrieves a representation of this proxied authorization v1 request control
as a JSON object.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided
buffer.
|
decode, decode, decodeControls, decodeJSONControl, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, registerDecodeableControl, toString, writeTo
@NotNull public static final java.lang.String PROXIED_AUTHORIZATION_V1_REQUEST_OID
public ProxiedAuthorizationV1RequestControl(@NotNull java.lang.String proxyDN)
proxyDN
- The DN of the target user under whose authorization the
associated request should be performed. It must not be
null
, although it may be an empty string to
request an anonymous authorization.public ProxiedAuthorizationV1RequestControl(@NotNull DN proxyDN)
proxyDN
- The DN of the target user under whose authorization the
associated request should be performed. It must not be
null
.public ProxiedAuthorizationV1RequestControl(@NotNull Control control) throws LDAPException
control
- The generic control to be decoded as a proxied
authorization v1 request control.LDAPException
- If the provided control cannot be decoded as a
proxied authorization v1 request control.@NotNull public java.lang.String getProxyDN()
@NotNull public java.lang.String getControlName()
getControlName
in class Control
@NotNull public JSONObject toJSONControl()
oid
-- A mandatory string field whose value is the object
identifier for this control. For the proxied authorization v1 request
control, the OID is "2.16.840.1.113730.3.4.12".
control-name
-- An optional string field whose value is a
human-readable name for this control. This field is only intended for
descriptive purposes, and when decoding a control, the oid
field should be used to identify the type of control.
criticality
-- A mandatory Boolean field used to indicate
whether this control is considered critical.
value-base64
-- An optional string field whose value is a
base64-encoded representation of the raw value for this proxied
authorization v1 request control. Exactly one of the
value-base64
and value-json
fields must be present.
value-json
-- An optional JSON object field whose value is a
user-friendly representation of the value for this proxied
authorization v1 request control. Exactly one of the
value-base64
and value-json
fields must be present, and
if the value-json
field is used, then it will use the following
fields:
authorization-dn
-- A mandatory string field whose value is
the DN of the user as whom the request should be authorized.
toJSONControl
in class Control
@NotNull public static ProxiedAuthorizationV1RequestControl decodeJSONControl(@NotNull JSONObject controlObject, boolean strict) throws LDAPException
controlObject
- The JSON object to be decoded. It must not be
null
.strict
- Indicates whether to use strict mode when decoding
the provided JSON object. If this is true
,
then this method will throw an exception if the
provided JSON object contains any unrecognized
fields. If this is false
, then unrecognized
fields will be ignored.LDAPException
- If the provided JSON object cannot be parsed as a
valid proxied authorization v1 request control.