Package org.apache.directory.shared.ldap.model.message

Examples of org.apache.directory.shared.ldap.model.message.ModifyRequestImpl.replace()


        String servicePrincipal = "ldap/" + hostName + "@EXAMPLE.COM";
        getLdapServer().setSaslPrincipal( servicePrincipal );

        ModifyRequest modifyRequest = new ModifyRequestImpl();
        modifyRequest.setName( new Dn( "uid=ldap,ou=users,dc=example,dc=com" ) );
        modifyRequest.replace( "userPassword", "randall" );
        modifyRequest.replace( "krb5PrincipalName", servicePrincipal );
        getService().getAdminSession().modify( modifyRequest );
    }

View Full Code Here


        getLdapServer().setSaslPrincipal( servicePrincipal );

        ModifyRequest modifyRequest = new ModifyRequestImpl();
        modifyRequest.setName( new Dn( "uid=ldap,ou=users,dc=example,dc=com" ) );
        modifyRequest.replace( "userPassword", "randall" );
        modifyRequest.replace( "krb5PrincipalName", servicePrincipal );
        getService().getAdminSession().modify( modifyRequest );
    }


    /**
 
View Full Code Here

    Dn dn = new Dn( "uid=admin,ou=system" );

    String expected = String.valueOf( System.currentTimeMillis() );
    ModifyRequest modifyRequest = new ModifyRequestImpl();
    modifyRequest.setName( dn );
    modifyRequest.replace( SchemaConstants.SN_AT, expected );

    assertTrue( session.exists( dn ) );

    ModifyFuture modifyFuture = connection.modifyAsync( modifyRequest );
View Full Code Here

{
    Dn dn = new Dn( "uid=admin,ou=system" );

    ModifyRequest modifyRequest = new ModifyRequestImpl();
    modifyRequest.setName( dn );
    modifyRequest.replace( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );

    ModifyResponse modResp = connection.modify( modifyRequest );
    assertEquals( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, modResp.getLdapResult().getResultCode() );

    modifyRequest = new ModifyRequestImpl();
View Full Code Here

    ModifyResponse modResp = connection.modify( modifyRequest );
    assertEquals( ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS, modResp.getLdapResult().getResultCode() );

    modifyRequest = new ModifyRequestImpl();
    modifyRequest.setName( dn );
    modifyRequest.replace( SchemaConstants.ENTRY_CSN_AT, new CsnFactory( 0 ).newInstance().toString() );

    // admin can modify the entryCsn
    modResp = connection.modify( modifyRequest );
    assertEquals( ResultCodeEnum.SUCCESS, modResp.getLdapResult().getResultCode() );
View Full Code Here

    String modifierName = "uid=x,ou=system";
    String modifiedTime = DateUtils.getGeneralizedTime();

    ModifyRequest modifyRequest = new ModifyRequestImpl();
    modifyRequest.setName( dn );
    modifyRequest.replace( SchemaConstants.MODIFIERS_NAME_AT, modifierName );
    modifyRequest.replace( SchemaConstants.MODIFY_TIMESTAMP_AT, modifiedTime );

    ModifyResponse modResp = connection.modify( modifyRequest );
    assertEquals( ResultCodeEnum.SUCCESS, modResp.getLdapResult().getResultCode() );
View Full Code Here

    String modifiedTime = DateUtils.getGeneralizedTime();

    ModifyRequest modifyRequest = new ModifyRequestImpl();
    modifyRequest.setName( dn );
    modifyRequest.replace( SchemaConstants.MODIFIERS_NAME_AT, modifierName );
    modifyRequest.replace( SchemaConstants.MODIFY_TIMESTAMP_AT, modifiedTime );

    ModifyResponse modResp = connection.modify( modifyRequest );
    assertEquals( ResultCodeEnum.SUCCESS, modResp.getLdapResult().getResultCode() );

    Entry loadedEntry = connection.lookup( dn.getName(), "+" );
View Full Code Here

    Dn dn = new Dn( "uid=admin,ou=system" );

    String expected = String.valueOf( System.currentTimeMillis() );
    ModifyRequest modRequest = new ModifyRequestImpl();
    modRequest.setName( dn );
    modRequest.replace( SchemaConstants.SN_AT, expected );

    connection.modify( modRequest );

    Entry entry = session.lookup( dn );
View Full Code Here

    assertEquals( "test", gn );

    // Now, replace the givenName
    ModifyRequest modifyRequest = new ModifyRequestImpl();
    modifyRequest.setName( dn );
    modifyRequest.replace( "givenName" );
    connection.modify( modifyRequest );

    lookupEntry = session.lookup( dn );
    Attribute giveName = lookupEntry.get( "givenName" );
    assertNull( giveName );
View Full Code Here

        assertTrue( entry.get( "roomnumber" ).contains( "4612" ) );

        // now modify the password for akarasulu
        ModifyRequest modReq = new ModifyRequestImpl();
        modReq.setName( new Dn( userDn ) );
        modReq.replace( "userPassword", "newpwd" );
        connection.modify( modReq );

        // close and try with old password (should fail)
        connection.close();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.