@Override public int hashCode() { return LdapUtils.computeHashCode(HASH_CODE_SEED, getOID(), getCriticality(), authorizationId); }
@Override public String toString() { return String.format( "[%s@%d::criticality=%s, authorizationId=%s]", getClass().getName(), hashCode(), getCriticality(), authorizationId); }
/** * Creates a new authorization identity response control. * * @param id authorization id * @param critical whether this control is critical */ public AuthorizationIdentityResponseControl(final String id, final boolean critical) { super(OID, critical); setAuthorizationId(id); }
/** * @param berValue to decode. * @param expected authorization identity response control to test. * * @throws Exception On test failure. */ @Test(groups = {"control"}, dataProvider = "response") public void decode(final byte[] berValue, final AuthorizationIdentityResponseControl expected) throws Exception { final AuthorizationIdentityResponseControl actual = new AuthorizationIdentityResponseControl( expected.getCriticality()); actual.decode(berValue); Assert.assertEquals(actual, expected); } }
/** * Authorization identity response control test data. * * @return response test data */ @DataProvider(name = "response") public Object[][] createData() { return new Object[][] { // dn:uid=1,ou=test,dc=ldaptive,dc=org // BER: // 64:6E:3A:75:69:64:3D:31:2C:6F:75:3D:74:65:73:74:2C:64:63:3D:6C:64:61: // 70:74:69:76:65:2C:64:63:3D:6F:72:67: new Object[] { LdapUtils.base64Decode("ZG46dWlkPTEsb3U9dGVzdCxkYz1sZGFwdGl2ZSxkYz1vcmc="), new AuthorizationIdentityResponseControl("dn:uid=1,ou=test,dc=ldaptive,dc=org"), }, }; }
@Override protected SearchResult performLdapSearch( final AuthenticationCriteria criteria, final AuthenticationHandlerResponse response) throws LdapException { final AuthorizationIdentityResponseControl ctrl = (AuthorizationIdentityResponseControl) response.getControl( AuthorizationIdentityResponseControl.OID); if (ctrl == null) { throw new IllegalStateException("Authorization Identity Response Control not found"); } logger.debug("found authorization identity response control {}", ctrl); final String authzId = ctrl.getAuthorizationId(); final String dn = authzId.split(":", 2)[1].trim(); final SearchOperation search = createSearchOperation(response.getConnection()); return search.execute(createSearchRequest(criteria, dn)).getResult(); }
ctl = new AuthorizationIdentityResponseControl(critical); ctl.decode(encoded); break;
@Override protected SearchResult performLdapSearch( final AuthenticationCriteria criteria, final AuthenticationHandlerResponse response) throws LdapException { final AuthorizationIdentityResponseControl ctrl = (AuthorizationIdentityResponseControl) response.getControl( AuthorizationIdentityResponseControl.OID); if (ctrl == null) { throw new IllegalStateException("Authorization Identity Response Control not found"); } logger.debug("found authorization identity response control {}", ctrl); final String authzId = ctrl.getAuthorizationId(); final String dn = authzId.split(":", 2)[1].trim(); final SearchOperation search = createSearchOperation(response.getConnection()); return search.execute(createSearchRequest(criteria, dn)).getResult(); }
@Override public int hashCode() { return LdapUtils.computeHashCode(HASH_CODE_SEED, getOID(), getCriticality(), authorizationId); }
@Override public String toString() { return String.format( "[%s@%d::criticality=%s, authorizationId=%s]", getClass().getName(), hashCode(), getCriticality(), authorizationId); }
ctl = new AuthorizationIdentityResponseControl(critical); ctl.decode(encoded); break;
/** * Creates a new authorization identity response control. * * @param id authorization id * @param critical whether this control is critical */ public AuthorizationIdentityResponseControl(final String id, final boolean critical) { super(OID, critical); setAuthorizationId(id); }
@Override protected SearchResult performLdapSearch( final AuthenticationCriteria criteria, final AuthenticationHandlerResponse response) throws LdapException { final AuthorizationIdentityResponseControl ctrl = (AuthorizationIdentityResponseControl) response.getControl( AuthorizationIdentityResponseControl.OID); if (ctrl == null) { throw new IllegalStateException("Authorization Identity Response Control not found"); } logger.debug("found authorization identity response control {}", ctrl); final String authzId = ctrl.getAuthorizationId(); final String dn = authzId.split(":", 2)[1].trim(); final SearchOperation search = createSearchOperation(response.getConnection()); return search.execute(createSearchRequest(criteria, dn)).getResult(); }
@Override public int hashCode() { return LdapUtils.computeHashCode(HASH_CODE_SEED, getOID(), getCriticality(), authorizationId); }
@Override public String toString() { return String.format( "[%s@%d::criticality=%s, authorizationId=%s]", getClass().getName(), hashCode(), getCriticality(), authorizationId); }
ctl = new AuthorizationIdentityResponseControl(critical); ctl.decode(encoded); break;
/** * Creates a new authorization identity response control. * * @param id authorization id * @param critical whether this control is critical */ public AuthorizationIdentityResponseControl(final String id, final boolean critical) { super(OID, critical); setAuthorizationId(id); }
@Override public void decode(final byte[] berValue) { logger.trace("decoding control: {}", LdapUtils.base64Encode(berValue)); setAuthorizationId(OctetStringType.decode(ByteBuffer.wrap(berValue))); } }
@Override public void decode(final byte[] berValue) { logger.trace("decoding control: {}", LdapUtils.base64Encode(berValue)); setAuthorizationId(OctetStringType.decode(ByteBuffer.wrap(berValue))); } }
@Override public void decode(final byte[] berValue) { logger.trace("decoding control: {}", LdapUtils.base64Encode(berValue)); setAuthorizationId(OctetStringType.decode(ByteBuffer.wrap(berValue))); } }