@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class ProxiedAuthorizationV2RequestControl extends Control
ResultCode.AUTHORIZATION_DENIED
result
code.
// Create a delete request to delete an entry. Include the proxied // authorization v2 request control in the delete request so that the // delete will be processed as the user with username "alternate.user" // 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 ProxiedAuthorizationV2RequestControl( "u:alternate.user")); 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_V2_REQUEST_OID
The OID (2.16.840.1.113730.3.4.18) for the proxied authorization v2 request
control.
|
Constructor and Description |
---|
ProxiedAuthorizationV2RequestControl(Control control)
Creates a new proxied authorization v2 request control which is decoded
from the provided generic control.
|
ProxiedAuthorizationV2RequestControl(java.lang.String authorizationID)
Creates a new proxied authorization V2 request control that will proxy as
the specified user.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAuthorizationID()
Retrieves the authorization ID string that will be used to identify the
user under whose authorization the associated operation should be
performed.
|
java.lang.String |
getControlName()
Retrieves the user-friendly name for this control, if available.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP control to the provided
buffer.
|
decode, decode, decodeControls, deregisterDecodeableControl, encode, encodeControls, equals, getOID, getValue, hashCode, hasValue, isCritical, readFrom, registerDecodeableControl, toString, writeTo
public static final java.lang.String PROXIED_AUTHORIZATION_V2_REQUEST_OID
public ProxiedAuthorizationV2RequestControl(java.lang.String authorizationID)
authorizationID
- The authorization ID string that will be used to
identify the user under whose authorization the
associated operation should be performed. It may
take one of three forms: it can be an empty
string (to indicate that the operation should use
anonymous authorization), a string that begins
with "dn:" and is followed by the DN of the target
user, or a string that begins with "u:" and is
followed by the username for the target user
(where the process of mapping the provided
username to the corresponding entry will depend on
the server configuration). It must not be
null
.public ProxiedAuthorizationV2RequestControl(Control control) throws LDAPException
control
- The generic control to be decoded as a proxied
authorization v2 request control.LDAPException
- If the provided control cannot be decoded as a
proxied authorization v2 request control.public java.lang.String getAuthorizationID()
public java.lang.String getControlName()
getControlName
in class Control