Examples of LDAPEntry


Examples of netscape.ldap.LDAPEntry

        final String entryDn, final LDAPAttribute[] attributes)
        throws LDAPException
    {
        this.getLog().info("Add Entry: " + entryDn);
        final LDAPAttributeSet attributeSet = new LDAPAttributeSet(attributes);
        final LDAPEntry entry = new LDAPEntry(entryDn, attributeSet);
        connection.add(entry);
    }
View Full Code Here

Examples of netscape.ldap.LDAPEntry

        constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
        conn.setConstraints( constraints );
       
        // ModifyDN success
        conn.rename( "uid=akarasuluref,ou=users,ou=system", "uid=ref", true, constraints );
        LDAPEntry entry = conn.read( "uid=ref,ou=users,ou=system", ( LDAPSearchConstraints ) constraints );
        assertNotNull( entry );
        assertEquals( "uid=ref,ou=users,ou=system", entry.getDN() );
       
        conn.disconnect();
    }
View Full Code Here

Examples of netscape.ldap.LDAPEntry

            LDAPUrl url = new LDAPUrl( "localhost", ldapServer.getPort(), "", new String[]{"vendorName"}, 0, "(ObjectClass=*)" );
            LDAPSearchResults results = LDAPConnection.search( url );

            if ( results.hasMoreElements() )
            {
                LDAPEntry entry = results.next();

                LDAPAttribute vendorName = entry.getAttribute( "vendorName" );

                if ( vendorName != null )
                {
                    assertEquals( "Apache Software Foundation", vendorName.getStringValueArray()[0] );
                }
View Full Code Here

Examples of netscape.ldap.LDAPEntry

            LDAPUrl url = new LDAPUrl( "localhost", ldapServer.getPort(), "", new String[]{"vendorName"}, 0, "(ObjectClass=*)" );
            LDAPSearchResults results = LDAPConnection.search( url );

            if ( results.hasMoreElements() )
            {
                LDAPEntry entry = results.next();

                LDAPAttribute vendorName = entry.getAttribute( "vendorName" );

                if ( vendorName != null )
                {
                    assertEquals( "Apache Software Foundation", vendorName.getStringValueArray()[0] );
                }
View Full Code Here

Examples of netscape.ldap.LDAPEntry

       
        // add success
        LDAPAttributeSet attrSet = new LDAPAttributeSet();
        attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
        attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
        LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );
       
        try
        {
            conn.add( entry, constraints );
            fail();
View Full Code Here

Examples of netscape.ldap.LDAPEntry

        // referrals failure
        LDAPAttributeSet attrSet = new LDAPAttributeSet();
        attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
        attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
        LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,ou=Computers,uid=akarasuluref,ou=users,ou=system", attrSet );
       
        LDAPResponseListener listener = conn.add( entry, null, constraints );
        LDAPResponse response = listener.getResponse();
        assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
View Full Code Here

Examples of netscape.ldap.LDAPEntry

        // referrals failure

        LDAPAttributeSet attrSet = new LDAPAttributeSet();
        attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
        attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
        LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );
       
        LDAPResponseListener listener = null;
        LDAPResponse response = null;
        listener = conn.add( entry, null, constraints );
        response = listener.getResponse();
View Full Code Here

Examples of netscape.ldap.LDAPEntry

        // add success
        LDAPAttributeSet attrSet = new LDAPAttributeSet();
        attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
        attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
        LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );

        try
        {
            conn.add( entry, constraints );
            fail();
View Full Code Here

Examples of netscape.ldap.LDAPEntry

        // referrals failure
        LDAPAttributeSet attrSet = new LDAPAttributeSet();
        attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
        attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
        LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,ou=Computers,uid=akarasuluref,ou=users,ou=system", attrSet );

        LDAPResponseListener listener = conn.add( entry, null, constraints );
        LDAPResponse response = listener.getResponse();
        assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
View Full Code Here

Examples of org.graylog2.security.ldap.LdapEntry

                return null;
            }

            final String password = String.valueOf(token.getPassword());

            final LdapEntry userEntry = ldapConnector.search(connection,
                                                             ldapSettings.getSearchBase(),
                                                             ldapSettings.getSearchPattern(),
                                                             principal,
                                                             ldapSettings.isActiveDirectory());
            if (userEntry == null) {
                LOG.debug("User {} not found in LDAP", principal);
                return null;
            }

            // needs to use the DN of the entry, not the parameter for the lookup filter we used to find the entry!
            final boolean authenticated = ldapConnector.authenticate(connection,
                                                                     userEntry.getDn(),
                                                                     password);
            if (!authenticated) {
                LOG.info("Invalid credentials for user {} (DN {})", principal, userEntry.getDn());
                return null;
            }
            // user found and authenticated, sync the user entry with mongodb
            final User user = userService.syncFromLdapEntry(userEntry, ldapSettings, principal);
            if (user == null) {
                // in case there was an error reading, creating or modifying the user in mongodb, we do not authenticate the user.
                LOG.error("Unable to sync LDAP user {}", userEntry.getDn());
                return null;
            }
        } catch (LdapException e) {
            LOG.error("LDAP error", e);
            return null;
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.