Code example for LoginException

0
 
            Log.debug("Found user?: " + results.hasMoreElements());
 
            if (!results.hasMoreElements())
            { 
                throw new LoginException("User not found.");
            } 
 
            SearchResult result = findUser(username);
 
            Attributes attributes = result.getAttributes();
 
            Attribute attribute = attributes.get(_userPasswordAttribute);
            if (attribute != null)
            { 
                try 
                { 
                    byte[] value = (byte[]) attribute.get();
 
                    ldapCredential = new String(value);
                }