Search in sources :

Example 1 with IntermediateClientRequestControl

use of com.unboundid.ldap.sdk.unboundidds.controls.IntermediateClientRequestControl in project ldapsdk by pingidentity.

the class LDAPConnectionTestCase method testCloseWithControls.

/**
 * Tests the {@code close} method variant that allows controls to be included.
 * <BR><BR>
 * Access to a Directory Server instance is required for complete processing.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testCloseWithControls() throws Exception {
    if (!isDirectoryInstanceAvailable()) {
        return;
    }
    Control[] controls = { new IntermediateClientRequestControl(null, null, null, null, "testCloseWithControls", null, null) };
    LDAPConnection conn = getAdminConnection();
    conn.close(controls);
}
Also used : ManageDsaITRequestControl(com.unboundid.ldap.sdk.controls.ManageDsaITRequestControl) IntermediateClientRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.IntermediateClientRequestControl) IntermediateClientRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.IntermediateClientRequestControl) Test(org.testng.annotations.Test)

Example 2 with IntermediateClientRequestControl

use of com.unboundid.ldap.sdk.unboundidds.controls.IntermediateClientRequestControl in project ssam by pingidentity.

the class SSAMController method getIntermediateClientRequestControl.

/**
 * Returns an intermediate client request control using the authzId of the
 * currently authenticated user.
 *
 * @return  an IntermediateClientRequestControl using the authorizationID of
 * the currently authenticated user
 */
private IntermediateClientRequestControl getIntermediateClientRequestControl() {
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    Object userDetails = authentication.getDetails();
    String authzId = userDetails instanceof LDAPUser ? ((LDAPUser) userDetails).getAuthzID() : "u:" + authentication.getName();
    return new IntermediateClientRequestControl(null, null, null, authzId, CLIENT_SESSION_ID, null, null);
}
Also used : Authentication(org.springframework.security.core.Authentication) IntermediateClientRequestControl(com.unboundid.ldap.sdk.unboundidds.controls.IntermediateClientRequestControl)

Aggregations

IntermediateClientRequestControl (com.unboundid.ldap.sdk.unboundidds.controls.IntermediateClientRequestControl)2 ManageDsaITRequestControl (com.unboundid.ldap.sdk.controls.ManageDsaITRequestControl)1 Authentication (org.springframework.security.core.Authentication)1 Test (org.testng.annotations.Test)1