Home > ldap > Java login through LDAP

Java login through LDAP

September 26Hits:1

I am starting to write an application for our office and the first step is authentication through LDAP where all users already exist. Everything I need is a code in Java to check if the pair <nick,password> is right. Google found me many links, but I think that I will find here the most sofisticate, short and up to date solution (I don't want to read all articles like 2 whole days to do something so simple).

I have written many dkBs of code in C++, but in Java I am total noob and I haven't coded anything with LDAP yet so try to be simple if speaking in Java and LDAP terms if possible.


Stack Overflow is the right site. In the meantime, using the UnboundID LDAP SDK:

try {
    LDAPConnection ldapConnection = new LDAPConnection(host,port,bindDN,bindPassword);
} catch (LDAPException ex) {
    handle exception ...


try {
    LDAPConnection ldapConnection = new LDAPConnection(host,port);
    SimpleBindRequest bindRequest = new SimpleBindRequest(bindDN,bindPassword);
    final BindResult bindResult = ldapConnection.bind(bindRequest);
} catch (LDAPException ex) {
    handle exception ...

for simple BIND requests. SASL binds are also handled by the LDAP SDK.

Tags:java, login, ldap

Related Articles

  • Java login through LDAP September 26

    I am starting to write an application for our office and the first step is authentication through LDAP where all users already exist. Everything I need is a code in Java to check if the pair <nick,password> is right. Google found me many links, but

  • how to allow a certain group of useres to only login via LDAP while others can use LDAP or local login?October 29

    I managed to set up my system to use either LDAP or the local password (by adding "password sufficient pam_ldap.so" to PAM and calling "pam_unix2.so" afterwards). However I would like to restrict a certain group of users to be able to

  • cisco ucs user login using ldap group authorizationJune 9

    I'm trying to configure a cisco ucs server login with ldap using group authorization. I can login to the cisco server using ldap username and password when I add the user to "admins" group, but when I use any other group the login fails. This is

  • SugarCRM - Can't login using LDAP after password changeSeptember 22

    We're using SugarCRM community edition 5.2.0f (Build 5688 running on OpenSuSE 11.1), and have the LDAP stuff set up so that users can log in with their AD credentials by contacting our DC (Server 2008). We're having an issue with a couple of users; t

  • Restricting account logins using LDAP and PAMFebruary 6

    I was hoping some PAM/LDAP gurus may be able to help me out here. I've recently set up an LDAP directory on Ubuntu Server to hold accounts for both my clients (for use with web-based systems) and staff (who will need to login via SSH.) The LDAP authe

  • How can I require a certain group of users to login via LDAP while letting others use either LDAP or local login?October 29

    I have set up my system to allow either LDAP or the local password for login. I did this by adding "password sufficient pam_ldap.so" to PAM and calling "pam_unix2.so" afterwards. However I would like to require a certain group of users

  • root login after ldap install?September 20

    I have set up ldap on my local network following the Ubuntu Manual. For some reason (after ldap setup, not before), it seems to have made a root entity in my ldap tree, which now allows for the availability of root logins. Why? I thought Ubuntu's who

  • Restrict ssh login from LDAP to users who have a /home directoryMarch 21

    I have an Apache server (RHEL 6) hosting multiple user web pages which currently is connected to my Active Directory environment to authenticate users. The server is used to automatically host content the users put in their /home/<user>/public_html

  • Redirect Fisrt time login with LDAPNovember 22

    The first time that the user login to the page, have to be redirected to the user edit profile to fill a field (Id) that is mandatory at the first login, I tryed using drupal_goto at hook_user_insert and hook_user_presave and don't worked. How can I

  • Restrict server login via LDAP hostObject objectClass and host AttributeNovember 25

    How do I configure my LDAP server to allow all hosts except one? All users by default have the host: * attribute, which allows any user to login to any server. I've tried the following regex, but it seems regular expressions are not supported here :

  • Save Email after login with ldapDecember 24

    I am using simple ldap login plugin to login into wordpress from active directory. But after successful login the username field is ok but email field is empty in wordpress users table. How can i make email saved in the database using this plugin. Th

  • Can't login to LDAP with current Windows userFebruary 20

    I'm trying to connect to AD server with various tools under Windows. If I provide my domain\username and password, I have no problems If I don't provide credentials, I do connect, but I have very limited access - don't see attributes and searching by

  • Nagios 3.2.3 Core web interface login via LDAP using full names for usernameDecember 19

    First off I've never done any Nagios or LDAP configuration in the past and I've been sort of dumped into this as is so often the case so forgive my inevitable ignorance regarding these things but I've been digging for a while all over the place in re

  • Automated login with LDAP always returns errorOctober 6

    I have successfully setup LDAP module to authenticate users (and create new users). This is done through manual login form. Now I'm trying to enable automated single sign-on, but with no luck. I have enabled LDAP SSO, and selected Turn on automated s

  • i've tried to create a Java login script but my code doesnt workJanuary 14

    i've been trying to make a login script in java, i've been looking around and i found an error that people said that my script doesnt work because i didn't use Scanners, i now added those but my script still does not work what can be the error? packa

  • Java login WebServicesJanuary 25

    I'm trying to do a login and password authentication but am unsuccessful wanted to help you , since I thank the web logo services to low is intended to be am but as I have little experience in java and web services much less. public class UsuarioDAO

  • Java login system using JSP and servletsFebruary 4

    The system is pretty simple. Here is how the database looks: table users: +----------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+------------

  • Restrict openSSH 6.1p1 logins via LDAP to an IP rangeMarch 15

    I have some servers in the DMZ that receive public traffic from an external (public) IPv4 address. This is translated at our gateway to a 172.x.x.x address. All external clients are using local accounts and are chrooted. They connect via this manner.

  • SSH login with LDAP users over NSLCD works after restarting serverSeptember 11

    I have a working nslcd setup running on many servers. I distributed this config to many servers almost all of which are working without problems. However I forgot to install libnss-ldapd and libpam-ldapd on like five of them. This resulted in the fol

  • how to map user login to another properties from Oracle OIM LDAPSeptember 12

    I have integrated SP 2010 with Oracle OIM LDAP. It works fine, but when the user is logged in the right upper corner there is number (number is a login in OID LDAP) instead of the user name. is there exists any way how to map this login from LDAP to

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.662 s.