• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BindResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



BindResponse类属于org.apache.directory.api.ldap.model.message包,在下文中一共展示了BindResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testResponseWithRequestId

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a Response with the (optional) requestID attribute
 */
@Test
public void testResponseWithRequestId()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput(
            AuthResponseTest.class.getResource( "response_with_requestID_attribute.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    assertEquals( 456, bindResponse.getMessageId() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:AuthResponseTest.java


示例2: testResponseWithResultCode

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with Result Code
 */
@Test
public void testResponseWithResultCode()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AuthResponseTest.class.getResource( "response_with_result_code.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = bindResponse.getLdapResult();

    assertEquals( ResultCodeEnum.PROTOCOL_ERROR, ldapResult.getResultCode() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:AuthResponseTest.java


示例3: testResponseWithErrorMessage

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with Error Message
 */
@Test
public void testResponseWithErrorMessage()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AuthResponseTest.class.getResource( "response_with_error_message.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = bindResponse.getLdapResult();

    assertEquals( "Unrecognized extended operation EXTENSION_OID: 1.2.6.1.4.1.18060.1.1.1.100.2", ldapResult
        .getDiagnosticMessage() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:29,代码来源:AuthResponseTest.java


示例4: testResponseWithEmptyErrorMessage

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with Empty Error Message
 */
@Test
public void testResponseWithEmptyErrorMessage()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput(
            AuthResponseTest.class.getResource( "response_with_empty_error_message.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = bindResponse.getLdapResult();

    assertNull( ldapResult.getDiagnosticMessage() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:AuthResponseTest.java


示例5: testResponseWithMatchedDNAttribute

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with MatchedDN attribute
 */
@Test
public void testResponseWithMatchedDNAttribute()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput(
            AuthResponseTest.class.getResource( "response_with_matchedDN_attribute.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = bindResponse.getLdapResult();

    assertTrue( ldapResult.getMatchedDn().equals( "cn=Bob Rush,ou=Dev,dc=Example,dc=COM" ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:28,代码来源:AuthResponseTest.java


示例6: computeLength

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Compute the BindResponse length 
 * <br>
 * BindResponse : 
 * <pre>
 * 0x61 L1 
 *   | 
 *   +--&gt; LdapResult
 *   +--&gt; [serverSaslCreds] 
 *   
 * L1 = Length(LdapResult) [ + Length(serverSaslCreds) ] 
 * Length(BindResponse) = Length(0x61) + Length(L1) + L1
 * </pre>
 */
@Override
public int computeLength()
{
    BindResponse bindResponse = getDecorated();
    int ldapResultLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength();

    bindResponseLength = ldapResultLength;

    byte[] serverSaslCreds = bindResponse.getServerSaslCreds();

    if ( serverSaslCreds != null )
    {
        bindResponseLength += 1 + TLV.getNbBytes( serverSaslCreds.length ) + serverSaslCreds.length;
    }

    return 1 + TLV.getNbBytes( bindResponseLength ) + bindResponseLength;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:32,代码来源:BindResponseDecorator.java


示例7: testResponseWith1Control

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with a (optional) Control element
 */
@Test
public void testResponseWith1Control()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AuthResponseTest.class.getResource( "response_with_1_control.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
    Map<String, Control> controls = bindResponse.getControls();

    assertEquals( 1, bindResponse.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.643" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
    assertEquals( "Some text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:33,代码来源:AuthResponseTest.java


示例8: testResponseWith1ControlEmptyValue

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with a (optional) Control element with empty value
 */
@Test
public void testResponseWith1ControlEmptyValue()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AuthResponseTest.class.getResource( "response_with_1_control_empty_value.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
    Map<String, Control> controls = bindResponse.getControls();

    assertEquals( 1, bindResponse.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.643" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.643", control.getOid() );
    assertFalse( ( ( DsmlControl<?> ) control ).hasValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:AuthResponseTest.java


示例9: testResponseWith2Controls

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with 2 (optional) Control elements
 */
@Test
public void testResponseWith2Controls()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser
            .setInput( AuthResponseTest.class.getResource( "response_with_2_controls.xml" ).openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
    Map<String, Control> controls = bindResponse.getControls();

    assertEquals( 2, bindResponse.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.789" );

    assertNotNull( control );
    assertFalse( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.789", control.getOid() );
    assertEquals( "Some other text", Strings.utf8ToString( ( ( DsmlControl<?> ) control ).getValue() ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:AuthResponseTest.java


示例10: testResponseWith3ControlsWithoutValue

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with 3 (optional) Control elements without value
 */
@Test
public void testResponseWith3ControlsWithoutValue()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AuthResponseTest.class.getResource( "response_with_3_controls_without_value.xml" )
            .openStream(), "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();
    Map<String, Control> controls = bindResponse.getControls();

    assertEquals( 3, bindResponse.getControls().size() );

    Control control = controls.get( "1.2.840.113556.1.4.456" );

    assertNotNull( control );
    assertTrue( control.isCritical() );
    assertEquals( "1.2.840.113556.1.4.456", control.getOid() );
    assertFalse( ( ( DsmlControl<?> ) control ).hasValue() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:AuthResponseTest.java


示例11: testResponseWith1EmptyReferral

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a response with an empty Referral
 */
@Test
public void testResponseWith1EmptyReferral()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( AuthResponseTest.class.getResource( "response_with_1_empty_referral.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BindResponse bindResponse = ( BindResponse ) parser.getBatchResponse().getCurrentResponse();

    LdapResult ldapResult = bindResponse.getLdapResult();

    Collection<String> referrals = ldapResult.getReferral().getLdapUrls();

    assertEquals( 0, referrals.size() );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:30,代码来源:AuthResponseTest.java


示例12: testResponseWith1AuthResponse

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a Response with the 1 AuthResponse
 */
@Test
public void testResponseWith1AuthResponse()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( BatchResponseTest.class.getResource( "response_with_1_AuthResponse.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BatchResponseDsml batchResponse = parser.getBatchResponse();

    assertEquals( 1, batchResponse.getResponses().size() );

    DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse();

    if ( response instanceof BindResponse )
    {
        assertTrue( true );
    }
    else
    {
        fail();
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:37,代码来源:BatchResponseTest.java


示例13: testResponseWith2AuthResponse

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Test parsing of a Response with the 2 AuthResponse
 */
@Test
public void testResponseWith2AuthResponse()
{
    Dsmlv2ResponseParser parser = null;
    try
    {
        parser = new Dsmlv2ResponseParser( getCodec() );

        parser.setInput( BatchResponseTest.class.getResource( "response_with_2_AuthResponse.xml" ).openStream(),
            "UTF-8" );

        parser.parse();
    }
    catch ( Exception e )
    {
        fail( e.getMessage() );
    }

    BatchResponseDsml batchResponse = parser.getBatchResponse();

    assertEquals( 2, batchResponse.getResponses().size() );

    DsmlDecorator<? extends Response> response = batchResponse.getCurrentResponse();

    if ( response instanceof BindResponse )
    {
        assertTrue( true );
    }
    else
    {
        fail();
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:37,代码来源:BatchResponseTest.java


示例14: bind

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Binds to the ldap server
 * 
 * @param messageId the message Id
 * @throws LdapException If we had an issue while binding
 * @throws EncoderException If we had an issue while encoding the request
 * @throws DecoderException If we had an issue while decoding the request
 * @throws IOException If we had an issue while transmitting the request or re ceiving the response
 */
protected void bind( int messageId ) throws LdapException, EncoderException, DecoderException, IOException
{
    if ( ( connection != null ) && connection.isAuthenticated() )
    {
        return;
    }

    if ( connection == null )
    {
        throw new IOException( I18n.err( I18n.ERR_03101_MISSING_CONNECTION_TO ) );
    }

    BindRequest bindRequest = new BindRequestImpl();
    bindRequest.setSimple( true );
    bindRequest.setCredentials( Strings.getBytesUtf8( password ) );
    bindRequest.setName( user );
    bindRequest.setVersion3( true );
    bindRequest.setMessageId( messageId );

    BindResponse bindResponse = connection.bind( bindRequest );

    if ( bindResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
    {
        LOG.warn( "Error : {}", bindResponse.getLdapResult().getDiagnosticMessage() );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:Dsmlv2Engine.java


示例15: bind

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public BindResponse bind( BindRequest bindRequest ) throws LdapException
{
    BindResponse response = connection.bind( bindRequest );
    bindCalled = true;
    return response;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:MonitoringLdapConnection.java


示例16: bind

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的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


示例17: bind

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void bind() throws LdapException
{
    LOG.debug( "Bind request" );

    // Create the BindRequest
    BindRequest bindRequest = createBindRequest( config.getName(), Strings.getBytesUtf8( config.getCredentials() ) );

    BindResponse bindResponse = bind( bindRequest );

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


示例18: anonymousBind

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void anonymousBind() throws LdapException
{
    LOG.debug( "Anonymous Bind request" );

    // Create the BindRequest
    BindRequest bindRequest = createBindRequest( StringConstants.EMPTY, Strings.EMPTY_BYTES );

    BindResponse bindResponse = bind( bindRequest );

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


示例19: bindSaslCramMd5

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Bind to the server using the SASL CRAM-MD5 mechanism.
 *
 * @param userName The user name
 * @param credentials The user credentials
 * @return  A LdapResponse containing the result
 * @throws LdapException if some error occurred
 */
public BindResponse bindSaslCramMd5( String userName, String credentials ) throws LdapException
{
    SaslCramMd5Request request = new SaslCramMd5Request();
    request.setUsername( userName );
    request.setCredentials( "secret" );

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


示例20: bindSaslDigestMd5

import org.apache.directory.api.ldap.model.message.BindResponse; //导入依赖的package包/类
/**
 * Bind to the server using the SASL DIGEST-MD5 mechanism.
 *
 * @param userName The user name
 * @param credentials The user credentials
 * @return  A LdapResponse containing the result
 * @throws LdapException if some error occurred
 */
public BindResponse bindSaslDigestMd5( String userName, String credentials ) throws LdapException
{
    SaslDigestMd5Request request = new SaslDigestMd5Request();
    request.setUsername( userName );
    request.setCredentials( "secret" );

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CsvDataSet类代码示例发布时间:2022-05-23
下一篇:
Java JobUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap