Package org.apache.directory.ldap.client.api

Examples of org.apache.directory.ldap.client.api.SaslGssApiRequest


    public void testSaslGssApiBindBadPassword() throws Exception
    {
        Dn userDn = new Dn( "uid=hnelson,ou=users,dc=example,dc=com" );
        LdapNetworkConnection connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );

        SaslGssApiRequest request = new SaslGssApiRequest();
        request.setUsername( userDn.getRdn().getValue().getString() );
        request.setCredentials( "badsecret" );
        request.setRealmName( ldapServer.getSaslRealms().get( 0 ).toUpperCase() );
        request.setKdcHost( "localhost" );
        request.setKdcPort( 6088 );
        try
        {
            connection.bind( request );
        }
        catch ( Exception e )
View Full Code Here


            assertEquals( "hnelson", entry.get( "uid" ).getString() );
            connection.close();

            // GSSAPI
            connection = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
            SaslGssApiRequest gssApiRequest = new SaslGssApiRequest();
            gssApiRequest.setUsername( userDn.getRdn().getValue().getString() );
            gssApiRequest.setCredentials( "secret" );
            gssApiRequest.setRealmName( ldapServer.getSaslRealms().get( 0 ) );
            gssApiRequest.setKdcHost( "localhost" );
            gssApiRequest.setKdcPort( 6088 );
            resp = connection.bind( gssApiRequest );
            assertEquals( ResultCodeEnum.SUCCESS, resp.getLdapResult().getResultCode() );
            entry = connection.lookup( userDn );
            assertEquals( "hnelson", entry.get( "uid" ).getString() );
            connection.close();
View Full Code Here

                                bindResponse = ldapConnection.bind( digestMd5Request );
                            }
                            // GSSAPI Authentication
                            else if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_GSSAPI )
                            {
                                SaslGssApiRequest gssApiRequest = new SaslGssApiRequest();

                                Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences();
                                boolean useKrb5SystemProperties = preferences
                                    .getBoolean( ConnectionCoreConstants.PREFERENCE_USE_KRB5_SYSTEM_PROPERTIES );
                                String krb5LoginModule = preferences
                                    .getString( ConnectionCoreConstants.PREFERENCE_KRB5_LOGIN_MODULE );

                                if ( !useKrb5SystemProperties )
                                {
                                    gssApiRequest.setUsername( bindPrincipal );
                                    gssApiRequest.setCredentials( bindPassword );
                                    gssApiRequest.setQualityOfProtection( connection
                                        .getConnectionParameter().getSaslQop() );
                                    gssApiRequest.setSecurityStrength( connection
                                        .getConnectionParameter()
                                        .getSaslSecurityStrength() );
                                    gssApiRequest.setMutualAuthentication( connection
                                        .getConnectionParameter()
                                        .isSaslMutualAuthentication() );
                                    gssApiRequest
                                        .setLoginModuleConfiguration( new InnerConfiguration(
                                            krb5LoginModule ) );

                                    switch ( connection.getConnectionParameter().getKrb5Configuration() )
                                    {
                                        case FILE:
                                            gssApiRequest.setKrb5ConfFilePath( connection.getConnectionParameter()
                                                .getKrb5ConfigurationFile() );
                                            break;
                                        case MANUAL:
                                            gssApiRequest.setRealmName( connection.getConnectionParameter()
                                                .getKrb5Realm() );
                                            gssApiRequest.setKdcHost( connection.getConnectionParameter()
                                                .getKrb5KdcHost() );
                                            gssApiRequest.setKdcPort( connection.getConnectionParameter()
                                                .getKrb5KdcPort() );
                                            break;
                                    }
                                }
View Full Code Here

                                bindResponse = ldapConnection.bind( digestMd5Request );
                            }
                            // GSSAPI Authentication
                            else if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_GSSAPI )
                            {
                                SaslGssApiRequest gssApiRequest = new SaslGssApiRequest();

                                Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences();
                                boolean useKrb5SystemProperties = preferences
                                    .getBoolean( ConnectionCoreConstants.PREFERENCE_USE_KRB5_SYSTEM_PROPERTIES );
                                String krb5LoginModule = preferences
                                    .getString( ConnectionCoreConstants.PREFERENCE_KRB5_LOGIN_MODULE );

                                if ( !useKrb5SystemProperties )
                                {
                                    gssApiRequest.setUsername( bindPrincipal );
                                    gssApiRequest.setCredentials( bindPassword );
                                    gssApiRequest.setQualityOfProtection( connection
                                        .getConnectionParameter().getSaslQop() );
                                    gssApiRequest.setSecurityStrength( connection
                                        .getConnectionParameter()
                                        .getSaslSecurityStrength() );
                                    gssApiRequest.setMutualAuthentication( connection
                                        .getConnectionParameter()
                                        .isSaslMutualAuthentication() );
                                    gssApiRequest
                                        .setLoginModuleConfiguration( new InnerConfiguration(
                                            krb5LoginModule ) );

                                    switch ( connection.getConnectionParameter().getKrb5Configuration() )
                                    {
                                        case FILE:
                                            gssApiRequest.setKrb5ConfFilePath( connection.getConnectionParameter()
                                                .getKrb5ConfigurationFile() );
                                            break;
                                        case MANUAL:
                                            gssApiRequest.setRealmName( connection.getConnectionParameter()
                                                .getKrb5Realm() );
                                            gssApiRequest.setKdcHost( connection.getConnectionParameter()
                                                .getKrb5KdcHost() );
                                            gssApiRequest.setKdcPort( connection.getConnectionParameter()
                                                .getKrb5KdcPort() );
                                            break;
                                        default:
                                            break;
                                    }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldap.client.api.SaslGssApiRequest

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.