当前位置: 首页>>代码示例>>Java>>正文


Java BindRequest.setDn方法代码示例

本文整理汇总了Java中org.apache.directory.api.ldap.model.message.BindRequest.setDn方法的典型用法代码示例。如果您正苦于以下问题:Java BindRequest.setDn方法的具体用法?Java BindRequest.setDn怎么用?Java BindRequest.setDn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.directory.api.ldap.model.message.BindRequest的用法示例。


在下文中一共展示了BindRequest.setDn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bind

import org.apache.directory.api.ldap.model.message.BindRequest; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void bind( Dn name ) throws LdapException
{
    byte[] credBytes = Strings.EMPTY_BYTES;

    BindRequest bindRequest = new BindRequestImpl();
    bindRequest.setDn( name );
    bindRequest.setCredentials( credBytes );

    BindResponse bindResponse = bind( bindRequest );

    processResponse( bindResponse );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:17,代码来源:AbstractLdapConnection.java

示例2: testEncodeBindRequestPerf

import org.apache.directory.api.ldap.model.message.BindRequest; //导入方法依赖的package包/类
/**
 * Test the decoding of a BindRequest with Simple authentication and no
 * controls
 */
@Test
@Ignore
public void testEncodeBindRequestPerf() throws Exception
{
    Dn dn = new Dn( "uid=akarasulu,dc=example,dc=com" );
    int nbLoops = 1000000;
    long t0 = System.currentTimeMillis();

    for ( int i = 0; i < nbLoops; i++ )
    {
        // Check the decoded BindRequest
        BindRequest bindRequest = new BindRequestImpl();
        bindRequest.setMessageId( 1 );

        bindRequest.setSimple( true );
        bindRequest.setDn( dn );
        bindRequest.setCredentials( Strings.getBytesUtf8( "password" ) );
        Control control = new OpaqueControl( "2.16.840.1.113730.3.4.2" );

        bindRequest.addControl( control );

        // Check the encoding
        try
        {
            encoder.encodeMessage( bindRequest );
        }
        catch ( EncoderException ee )
        {
            ee.printStackTrace();
            fail( ee.getMessage() );
        }
    }

    long t1 = System.currentTimeMillis();
    System.out.println( "BindRequest testEncodeBindRequestPerf, " + nbLoops + " loops, Delta = " + ( t1 - t0 ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:41,代码来源:BindRequestPerfTest.java

示例3: bind

import org.apache.directory.api.ldap.model.message.BindRequest; //导入方法依赖的package包/类
/**
 * Calls the PoolMgr to perform an LDAP bind for a user/password combination.  This function is valid
 * if and only if the user entity is a member of the USERS data set.
 *
 * @param connection connection to ldap server.
 * @param szUserDn   contains the LDAP dn to the user entry in String format.
 * @param password   contains the password in clear text.
 * @return bindResponse contains the result of the operation.
 * @throws LdapException in the event of LDAP error.
 */
protected BindResponse bind( LdapConnection connection, String szUserDn, String password ) throws LdapException
{
    COUNTERS.incrementBind();
    Dn userDn = new Dn( szUserDn );
    BindRequest bindReq = new BindRequestImpl();
    bindReq.setDn( userDn );
    bindReq.setCredentials( password );
    bindReq.addControl( PP_REQ_CTRL );
    return connection.bind( bindReq );
}
 
开发者ID:apache,项目名称:directory-fortress-core,代码行数:21,代码来源:LdapDataProvider.java


注:本文中的org.apache.directory.api.ldap.model.message.BindRequest.setDn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。