Examples of BindRequest


Examples of org.apache.directory.api.ldap.model.message.BindRequest

        Dn userDn = new Dn( "cn=userMaxAgeAndGraceAuth,ou=system" );
        String password = "12345";

        addUser( adminConnection, "userMaxAgeAndGraceAuth", password );

        BindRequest bindReq = new BindRequestImpl();
        bindReq.setDn( userDn );
        bindReq.setCredentials( password.getBytes() );
        bindReq.addControl( PP_REQ_CTRL );

        LdapConnection userCon = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
        userCon.setTimeOut( 0 );

        Thread.sleep( 1000 ); // sleep for one second so that the password expire warning will be sent
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.BindRequest

        Dn userDn = new Dn( "cn=userGrace,ou=system" );

        addUser( adminConnection, "userGrace", "12345" );

        BindRequest bindReq = new BindRequestImpl();
        bindReq.setDn( userDn );
        bindReq.setCredentials( "12345" ); // grace login
        bindReq.addControl( PP_REQ_CTRL );

        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );

        Thread.sleep( 2000 ); // let the password expire
        BindResponse bindResp = userConnection.bind( bindReq );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.BindRequest

        Dn userDn = new Dn( "cn=userLockoutWithDuration,ou=system" );

        addUser( adminConnection, "userLockoutWithDuration", "12345" );

        BindRequest bindReq = new BindRequestImpl();
        bindReq.setDn( userDn );
        bindReq.setCredentials( "1234" ); // wrong password
        bindReq.addControl( PP_REQ_CTRL );

        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );

        for ( int i = 0; i < 4; i++ )
        {
            userConnection.bind( bindReq );
            assertFalse( userConnection.isAuthenticated() );
        }

        Entry userEntry = adminConnection.lookup( userDn, "+" );
        Attribute pwdAccountLockedTime = userEntry.get( PasswordPolicySchemaConstants.PWD_ACCOUNT_LOCKED_TIME_AT );
        assertNotNull( pwdAccountLockedTime );

        Thread.sleep( 10000 );
        bindReq = new BindRequestImpl();
        bindReq.setDn( userDn );
        bindReq.setCredentials( "12345" ); // correct password
        bindReq.addControl( PP_REQ_CTRL );
        userConnection.setTimeOut( Long.MAX_VALUE );
        userConnection.bind( bindReq );
        assertTrue( userConnection.isAuthenticated() );

        userConnection.close();
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.BindRequest

        addUser( adminConnection, "userExpireWarning", "12345" );

        LdapConnection userConnection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
        userConnection.setTimeOut( 0L );

        BindRequest bindReq = new BindRequestImpl();
        bindReq.setDn( userDn );
        bindReq.setCredentials( "12345" );
        bindReq.addControl( PP_REQ_CTRL );

        for ( int i = 0; i < 5; i++ )
        {
            BindResponse bindResponse = userConnection.bind( bindReq );
            assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.BindRequest

            userConnection2 = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
            userConnection2.setTimeOut( 0L );

            addUser( adminConnection, userCn, password );

            BindRequest bindReq = new BindRequestImpl();
            bindReq.setDn( userDn );
            bindReq.setCredentials( "12345" );
            bindReq.addControl( PP_REQ_CTRL );
            BindResponse bindResponse = userConnection2.bind( bindReq );
            PasswordPolicy respCtrl = getPwdRespCtrl( bindResponse );
            assertNotNull( respCtrl );
            assertNull( respCtrl.getResponse() );

            // now modify change time
            ModifyRequest modifyRequest = new ModifyRequestImpl();
            modifyRequest.setName( userDn );
            modifyRequest.replace( "pwdChangedTime", DateUtils.getGeneralizedTime( new Date().getTime() - 3100000 ) );
            adminConnection.modify( modifyRequest );

            BindRequest bindReq2 = new BindRequestImpl();
            bindReq2.setDn( userDn );
            bindReq2.setCredentials( "12345" );
            bindReq2.addControl( new PasswordPolicyImpl() );
            bindResponse = userConnection.bind( bindReq2 );
            respCtrl = getPwdRespCtrl( bindResponse );
            assertNotNull( respCtrl );
            assertNotNull( respCtrl.getResponse() );
            assertTrue( respCtrl.getResponse().getTimeBeforeExpiration() > 0 );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.BindRequest

           "sn: userMinAgeMustChange_sn",
           "userPassword: 12345" );
       adminConnection.add( userEntry );

       LdapConnection userConnection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
       BindRequest bindRequest = new BindRequestImpl();
       bindRequest.setDn( userDn );
       bindRequest.setCredentials( "12345" );
       bindRequest.addControl( PP_REQ_CTRL );
       // successful bind but must require pwd reset as was set by admin
       BindResponse bindResponse = userConnection.bind( bindRequest );
       assertEquals( ResultCodeEnum.SUCCESS, bindResponse.getLdapResult().getResultCode() );
       assertEquals( PasswordPolicyErrorEnum.CHANGE_AFTER_RESET,
           getPwdRespCtrl( bindResponse ).getResponse().getPasswordPolicyError() );
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.BindRequest

    public void bind() throws LdapException, IOException
    {
        LOG.debug( "Bind request" );

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

        BindResponse bindResponse = bind( bindRequest );

        processResponse( bindResponse );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.BindRequest

    public void anonymousBind() throws LdapException, IOException
    {
        LOG.debug( "Anonymous Bind request" );

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

        BindResponse bindResponse = bind( bindRequest );

        processResponse( bindResponse );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.BindRequest

    public BindFuture bindAsync() throws LdapException, IOException
    {
        LOG.debug( "Asynchronous Bind request" );

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

        return bindAsync( bindRequest );
    }
View Full Code Here

Examples of org.apache.directory.api.ldap.model.message.BindRequest

    public BindFuture anonymousBindAsync() throws LdapException, IOException
    {
        LOG.debug( "Anonymous asynchronous Bind request" );

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

        return bindAsync( bindRequest );
    }
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.