Package org.apache.directory.server.core.authn

Examples of org.apache.directory.server.core.authn.StrongAuthenticator


        AuthenticationInterceptor authInterceptor = ( AuthenticationInterceptor ) ldapServer.getDirectoryService()
            .getInterceptor( InterceptorEnum.AUTHENTICATION_INTERCEPTOR.getName() );
        authInterceptor.destroy();
        authInterceptor.setAuthenticators( new Authenticator[]
            { new StrongAuthenticator() } );

        try
        {
            connection.bind( "uid=hacker", "badsecret" );
            fail();
        }
        catch ( LdapAuthenticationException lae )
        {
            //Expected
        }

        // Try with an existing user
        try
        {
            connection.bind( "uid=admin,ou=system", "secret" );
            fail();
        }
        catch ( LdapAuthenticationException lae )
        {
            //Expected
        }

        assertFalse( connection.isAuthenticated() );
        connection.close();

        // Reset the authenticators
        authInterceptor.destroy();
        authInterceptor.setAuthenticators( new Authenticator[]
            { new StrongAuthenticator(), new SimpleAuthenticator(), new AnonymousAuthenticator() } );
    }
View Full Code Here


        AuthenticationInterceptor authInterceptor = ( AuthenticationInterceptor ) ldapServer.getDirectoryService()
            .getInterceptor( InterceptorEnum.AUTHENTICATION_INTERCEPTOR.getName() );
        authInterceptor.destroy();
        authInterceptor.setAuthenticators( new Authenticator[]
            { new StrongAuthenticator() } );

        try
        {
            connection.bind( "uid=hacker", "badsecret" );
            fail();
        }
        catch ( LdapAuthenticationException lae )
        {
            //Expected
        }

        // Try with an existing user
        try
        {
            connection.bind( "uid=admin,ou=system", "secret" );
            fail();
        }
        catch ( LdapAuthenticationException lae )
        {
            //Expected
        }

        assertFalse( connection.isAuthenticated() );
        connection.close();

        // Reset the authenticators
        authInterceptor.destroy();
        authInterceptor.setAuthenticators( new Authenticator[]
            { new StrongAuthenticator(), new SimpleAuthenticator(), new AnonymousAuthenticator() } );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.authn.StrongAuthenticator

Copyright © 2018 www.massapicom. 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.