LDAP Windows 2000 Login name

Hi !
I use the following code to authenticate users against a Windows 2000 Active Directory.
My problem is that I have to pass the user name "John Doe" instead of the login name "johndoe" as a parameter.
How can I achive this ? I know, I have to use a fully qualified name like "johndoe@intranet" but ... ???
Thankx in advance, Gurus !
package org.mp.intern;
import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class LDAPTest
     public void authenticate(String server,String domain,String name,String pwd) throws Exception
          Hashtable env = new Hashtable();
          env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
          env.put(Context.PROVIDER_URL, "ldap://" + server + ":389/dc=" + domain);
          env.put(Context.SECURITY_AUTHENTICATION, "simple");
          env.put(Context.SECURITY_PRINCIPAL, "cn=" + name + ",cn=users,dc=" + domain);
          env.put(Context.SECURITY_CREDENTIALS, pwd);
          DirContext ctx = new InitialDirContext(env);
          ctx.close();
     public static void main(String[] args)
          LDAPTest p = new LDAPTest();
          try
               // I have to do this ..
               p.authenticate("pdc","intranet","John Doe","mypassword");
               // ... but I want to do this
               p.authenticate("pdc","intranet","johndoe@intranet","mypassword");
          catch(Exception ex)
               ex.printStackTrace();
}

Ok,
have located the solution on my own.
simply pass the login name plus the domain name as the SECURITY_PRINCIPAL, for example :
env.put(Context.SECURITY_PRINCIPAL,userName + "@" + domain);
Not everything is complicated in a heterogeneus world :-))
cya

Similar Messages

  • Capture a user's window 2000 login name

    How can I capture a Windows 2000 login name from within a JSP or an applet or, better still, from some other code running on the application server from which they're downloaded?

    http://java.sun.com/docs/books/tutorial/essential/system/properties.html

  • Capture a user's Windows 2000 login name

    How can I capture a Windows 2000 login name from within a JSP or an applet or, better still, from some other code running on the application server from which they're downloaded?

    mgulesian, you might want to query the system properties.
    System.getProperty("user.name")Please note that this property is subject of security constraints (and there're good reasons for this, read the Java Tutorial, Trail: Essential Java Classes, Lesson: Accessing System Resources for details). For example, web applications running inside Tomcat are not allowed to query this property by default. Think twice before doing this, you have been warned!
    HTH, Markus

  • How to get windows XP login name in SAP.

    I want get windows XP login name in SAP,  which funcion module can  and How method can, thanks.

    hi,
    GUI_GET_DESKTOP_INFO – Returns information about the end-users desktop
    TH_USER_INFO – Returns information about user
    Try this FM, not sure if it return windown user name....give it a try.
    Hope this helps, Do reward.
    Edited by: Runal Singh on Mar 27, 2008 4:16 PM

  • NImax & Resman errors at Windows 2000 login

    We have a system with a NI VXIpc 872B controller installed in a Tektronix Intelliframe VXI chassis. The controller is running Windows 2000. Via NIMax, we have set things up such that Resman is executed one time at system boot. When booting after a power-up, if the user logs in too quickly when presented with the Windows login prompt we get Resman, MXS, or nimax errors. When this occurs, the only way to recover is to reboot the controller. If the user waits 10 to 20 seconds before logging in (I assume that Resman/NIMax is executing during this time), no errors occur. Does anyone have any ideas about what may be causing this problem and what we can do to resolve it? We would like to make it such that the user can log in immediately without any problems.

    This is the error that we usually see:
    In a pop-up window:
    "VXI Resource Manager failed due to the following"
    "MXS: ERROR"
    and resman.exe hangs - does not complete execution and terminate as it normally does.
    After this error, any application calls (LabWindows/CVI 6.0 application) to the nivxi library function "InitVXIlibrary()" fail with an error return of 0xffffffff (-1). The only cure is to reboot the system.
    Additionally, the two red LEDs at the top of the VXIpc-872B controller ("Failed" and "SYSF") are illuminated.
    The version of the NI-VXI driver software that we are currently running with is 3.2.1.
    The "Resource Manager Delay" field under the "Settings" tab of the "VXI System 0 Properties" window of the MAX Explorer app was originally set to "5". We changed the value to "0" and this seemed to help quite a bit, however we still see occasional failures.

  • Getting windows domain login name into java application

    Hi,
    I am looking how can i get user name of windows logged in user. I want to display the user name in the welcome message of the application. The user will be logging into the domain. Please note that I need windows logged in client user name.
    Please give suggestions or any direction on this.
    Thanks

    Thanks a lot for your prompt response.
    I tried the example. It works really great from the command prompt.
    How do I integrate with application.
    My application runs on OC4J server. I hope I need to change the java security.policy file or something to point to my application sepecific policy file (i.e. in the example, the file that we give thru command line).
    Not sure.
    If possible can you give me some idea on how to change these policy files.
    I know I am asking too much, but please help me in this.
    Thanks

  • Different Pre-Windows 2000 domain and FQDC.

    I have a SBS 2003 box that was originally migrated from SBS2000. i just finished install new 2012 standard server and installed AD service on it, but when i trying promote to DC, it won't do it until functional level raise to least 2003 level.
    My question is following:
    when user login, user uses pre-windows 2000 login name.  
    For example, DC11\user but FQDC is DC1.local.  we have no DC11 exist. 
    When user trying login as DC1\user, it won't able to login. even Administrator has to login as DC11\administrator not DC1\administrator. 
     When i look user properties account login name user @dc1.local and pre-Windows 2000 name DC11\ user are listed. 
    if i raised to Windows 2003 function level, did user can't login? or any effect? 
    Thanks

    DC11 is the NetBIOS name of your domain and it can be changed using Active Directory Domain rename tools -
    http://technet.microsoft.com/en-us/windowsserver/bb405948.aspx - if you don't want to use DC11 in your environment. However, this could have impact other applications like Exchange,
    as Exchange doesn't support domain rename.
    Another option for you would be to deploy a new Forest or domain with the names that you desire and migrate stuff - Users/Workstations/Servers/Application and get rid of old domain.
    UPNs ([email protected]) is easy to change but changing NetBIOS is a complex process and needs to be done with extreme care.
    - Sarvesh Goel - Enterprise Messaging Administrator

  • ACS External Windows Authentication: Pre-Windows 2000 name only works

    Hello. I have attempted to map ACS to Windows AD 2003 as an External Database. That works, but only if I authenticate using the Pre-Windows 2000 name (sometimes called the "down-level" name).
    If I use the Windows 2003 login name, I get a 529 error in the event viewer, stating the username/password is incorrect. This error appears on the Windows 2003 SP1 server running ACS.
    Curiously, if I authenticate using the down-level name, the successful event shows the same authentication package (MICROSOFT_AUTHENTICATION_PACKAGE_V1_0) and "Workstation" and "Login Process" name (CISCO).
    I cannot determine if this is an ACS or Windows problem. Any one have a clue?

    Win2003 logon name: [email protected]
    A Pre-Windows2000 name: [email protected]
    Interestingly, the down-level name will authenticate, but the "up-level" name will not.
    Here are excerpts from AUTH.log:
    Failed up-level name:
    AUTH 01/19/2006 07:52:04 I 4817 3604 Attempting authentication for Unknown User '[email protected]'
    AUTH 01/19/2006 07:52:04 I 0365 3604 External DB [NTAuthenDLL.dll]: Starting authentication for user [[email protected]]
    AUTH 01/19/2006 07:52:04 I 0365 3604 External DB [NTAuthenDLL.dll]: Attempting Windows authentication for user bob.smith
    AUTH 01/19/2006 07:52:04 E 0365 3604 External DB [NTAuthenDLL.dll]: Windows authentication FAILED (error 1326L)
    AUTH 01/19/2006 07:52:04 I 0365 3604 External DB [NTAuthenDLL.dll]: Reattempting authentication at domain COMPANY
    AUTH 01/19/2006 07:52:04 I 0365 3604 External DB [NTAuthenDLL.dll]: Attempting Windows authentication for user bob.smith
    AUTH 01/19/2006 07:52:04 E 0365 3604 External DB [NTAuthenDLL.dll]: Windows authentication FAILED (error 1326L)
    AUTH 01/19/2006 07:52:04 I 2124 3604 Unknown User '[email protected]' was not authenticated
    Passed down-level name:
    AUTH 01/19/2006 07:52:23 I 0365 3604 External DB [NTAuthenDLL.dll]: Starting authentication for user [[email protected]]
    AUTH 01/19/2006 07:52:23 I 0365 3604 External DB [NTAuthenDLL.dll]: Attempting Windows authentication for user bsmith
    AUTH 01/19/2006 07:52:23 I 0365 3604 External DB [NTAuthenDLL.dll]: Windows authentication SUCCESSFUL (by WINDC02)
    AUTH 01/19/2006 07:52:23 I 0365 3604 External DB [NTAuthenDLL.dll]: Obtaining RAS information for user bsmith from WINDC02

  • "Google translate" somehow personalised a translation with my windows login name

    I am at a loss as to how this occurred and see it as a security threat. I pasted "cogito ergo" into the google translate website. It didn't translate it into English until I selected Latin as the language, at which point it translated it as "Xxxxxx, thinks therefore", where Xxxxxx is my windows 7 login name. Worried, I created a new login and tried to replicate it. It didn't happen again and so far I have been unable to replicate it again.
    I am not aware of a way for a website to ascertain the users login id but now I have to assume that it can be done. How I don't know, which is why I'm bringing it up here.
    Is this possible and how can I stop it happening again.
    I run Firefox 15 with adblock, better privacy, Ghostery and Noscript, I am also running Comdo firewall, not sure what else I can add.
    Regards
    Confused31

    Ideato thank you for your reply.
    Whilst it doesn't address the issue directly and I still find it difficult to put it down to coincidence, I will give DNT+ a whirl.
    I remain convinced that google are far more intrusive than they let on and if I could find a search engine that came even close, I'd dump google in a heartbeat.
    Regards
    Confused31

  • ISE with per-windows 2000 domain

    Hi
    I am experiencing a problem with AD authentication.
    I have joined the ISE appliance to the windows AD and I can browse the groups and attributes.
    But the problem I am experincing is that the users logon to the domain using the pre-windows 2000 domain name.
    FQDN format : ab.cdef.com       - ISE is joined to this
    pre-windows 2000 name : abcd  - Users logon with this
    So wen the users authenticate I get the following error : 22056 Subject not found in the applicable identity store.
    Also tried to logon with [email protected] with no luck.
    Does someone have any suggestions?
    Thanks

    The 802.11 Mac Layer is a bit longer than the ethernet mac layer. This sometimes cause problem with domain login because they are done using UDP by default. The frame are sometime drop. To test if this is your problem, I recomand changing the MTU on the 2000server(DC) and the host to something lesser than the actuel MTU on the interface. (configure the DC and host @1300 leaving the network @1500)
    A Windows 2003 server as a default mtu of 13?? something to get around this problem. I usaully tell my users to install the cisco vpn client if they want to use domain in wireless because the installation of this client lower the MTU of every interface to 1300.
    Another path you can look into is forcing kerberos to use TCP insted of UDP. (look on MS TechNet for method)

  • Information about logon name pre-windows 2000

    Hi,
    In active directory while creating users we have two fields like logon name and logon name (pre-windows 2000). In windows2008R2 server I created new user (Test user) and 1 new group. I mapped new user to the group. While creating user I have given 123456789
    for logon name field and user.test for logon name pre-windows 2000.
    But with this user while doing LDAP search user is not listing from the server and also getting error as No groups found for the new user. So can you please let me know whether we need to give same name for logon name and logon name pre-windows 2000 fields?
    If possible brief me about those fields.
    Appreciate your earlier response.
    Thanks & Regards,
    Sitaramaiah

    Hi,
    Please go through the link which will clear your doubts.
    http://technet.microsoft.com/en-in/library/cc739093%28v=ws.10%29.aspx
    Biswajeet

  • Logged in windows username cant be searched in LDAP tree on Windows 2000 AD

    That is my active directory of my TEST Windows 2000 server:
    http://img248.imageshack.us/img248/918/adwn6.gif
    On the image yu will find 4 schools with shortcut names called:
    OU=ASR
    OU=EDS
    OU=EKS (EK school for example)
    OU=THS (TH school for example)
    Under every OU="shortcut of schoolname" you will find also the
    OU=Klassen (Klassen = classes in english)
    OU=Lehrer (Lehrer = teacher in english)
    again under every OU="class" and OU="teacher" you will find also the
    pupils and teachers.
    the teacher "verena bit" is located in:
    "CN=verena bit,OU=Lehrer,OU=ASR,DC=Bodensee,DC=DE"
    On the REAL Windows 2000 server used in production i have about 17 schools like OU=ASR or OU=EDS and so on...
    My part aim for the first...:
    With Java code: String Lehrer = System.getProperty("user.name");
    I can retrieve the name of the teacher (Lehrer = teacher) who has logged into the Windows client. The problem is i get for example a String like
    "verenabit" but in the ldap hierarchy all common names are for example like this: cn="verena bit" they have always a " " gap between the forename and the lastname so I can not use the String "verenabit" to search for it in the ldap tree as she would not exist right?
    What i finally want is to find out the OU="shortcut of schoolname" (see above) by searching for the logged in teacher. So when i have OU="shortcut of schoolname" of the teacher i am able to read ONLY the usernames(teachers+pupils) of that specific school and not all teacher+pupils of all 17 schools what would be about 8000 users :-D
    Can someone help me please how can i use the username of the logged in windows user and search him effectively in the ldap tree on my test windows 2000 server.
    Steven you want all my points? ROFL ;-)

    Here's a hint.
    Use a generic ldap tool (for example ldp.exe which is
    included in Windows Server, or whatever your
    favourite ldap browser is, and find the object in the
    Active Directory that corresponds to the user named
    Verna Bit.
    Believe it or not, you will find an attribute which
    has matching value to that returned from
    System.getProperty("user.name");Then you just need to construct the relevant LDAP
    Query Filter.
    It ain't rocket science !
    Good luck.Yes i already use ldp.exe i installed it from the win2k server CD its a great tool :)
    hm your hint is odd or how can i say dont know wether you really understood me, because what you suggested to me is actually what i doubted that it could work. Seems you have more faith??
    The problem is (not sure wether you really understood me...) that when i search the whole Directory having 8000 user, I could search for teachers only which are in OU=Lehrer (Lehrer = teacher) and just go one childnode down but "verena bit" IS NOT "verenabit". I cannot search for the username verenatbit as i wont get any result as it does not exist.

  • User Logon Name (pre-Windows 2000) and Domain Name Don't have the same Value

    Hi
    is it possible to have User Logon Name (pre-Windows 2000) and Domain Name with different value?
    Exemple:
    domain name domain1.com
    and User Logon Name (pre-Windows 2000) Domain2\user

    If you have trust in place, then also you can use trusted domain name to login from trustee domain. Also, UPN suffix can be added.
    http://technet.microsoft.com/en-us/library/cc773178%28v=ws.10%29.aspx
    Awinish Vishwakarma - MVP
    My Blog: awinish.wordpress.com
    Disclaimer This posting is provided AS-IS with no warranties/guarantees and confers no rights.

  • My MacBook Pro Retina's Bluetooth chipset unknown/odd login message on the login screen states Login Window Authentication Login window Name edit text has keyboard focus. In addition, the login screen is not remembering me

    I have been experiencing several issues with my MacBook Pro Retina mid 2012. My MBPR is scheduled to go into the depot. However, I am wondering if anyone may be able to shed light on a few issues as this is the third "official" time my MBPR is going back for service ("one depot" trip; "one authorized" dealer; several in-store visits).
    My Bluetooth is stating that the Bluetooth Chipset is Unknown (0). I also have had Bluetooth Preferences mysteriously change on me. In addition, while Bluetooth is off there are two serial modems turning on. I have turned them off, but they continue to pop up.
    In addition, when I log in, my MBPR is not remembering me and my login name is not appearing on the slate-gray screen. The name and password are blank and the following message appears in the lower left hand corner. "login window authentication login window Name edit text has keyboard focus."  As a side note, I am the only user. The login issue is a recent occurrence as we just totally wiped it again via a Command + R, and I don't believe I have an accessibility setting set to anything that would cause this, but wanted to check.
    Should I be concerned here? Has anyone else had issues like this? I don't want to worry if I don't have to. I have had so many issues over the course of nine months. 5-6 wipes. Airport card replaced and I am about to pull my hair out if my MBPR doesn't come back worldly like clock work this time. I just can't send my days trying to get a $2300 product to work for me any longer. No idea what is wrong with it, but it is driving me insane. Cross your fingers for me and any guidance you have or thoughts would be welcomed. Thank you. EMM

    A few more issues...
    In Console, the following is greyed out:
    User and Diagnostic reports
    Com.apple.launchd.peruser.0
    Com.apple.launchd.peruser.88
    Com.apple.launchd.peruser.89
    Com.apple.launchd.peruser.92
    Com.apple.launchd.peruser.97
    Com.apple.launchd.peruser.200
    Com.apple.launchd.peruser.201
    Com.apple.launchd.peruser.202
    Com.apple.launchd.peruser.212
    *[user logs are accessible]
    Krb5kdc
    Radius
    My guest files are locked, but again I am the administrator of MBPR.
    I am worried about a keystroke logged or at least, trying to rule it out.
    Also:
    Mdworker32(225) [and other mdworker numbers] are sandboxing; stating deny Mach-lookup
    Com.apple.Powermanagement.control, etc. long attachment with those files with version: ??? (???).
    Postinstall: removing applications/Microsoft Office 2011/Microsoft Outlook.app
    WARNINGS in Console include:
    [NSImage compositeToPoint:fromRect:operation:fraction:] is deprecated in MacOSX 19.8 and later. Please use -[NSImage drawAtPoint:fromRect:operation:fraction] instead.
    There are a ton of other warnings. Before I go through this again, can someone tell me if this is normal (all of it -- above too); or if these are symptoms is a keystroke logger or hardware issues? 
    I ask because originally, when my computer went in for diagnostics (more than once), Apple stated the hardware was fine (other than Airport Card -- finally). However, if I've done 5-6 total wipes; created new users; do not have sharing set-up; have not played around in Terminal; and am up-to-date with versions -- and various issues KEEP COMING BACK -- I am left wondering if a keystroke logger would be possible here?!? I thought maybe a faulty logic board, but why would diagnostics be okay, then? Not trying to be hyperbole, just desperate.
    Please help me rule keystroke logger out or at least, tell me so I know, so I can take appropriate action. If you think it could be the logic board with symptoms above, that would be a great too.
    All I want to do is use the computer as intended, but I can't seem to get a real answer, so after nine months -- I am turning to the communities to see if anyone -- anyone at all -- can help. The last thing I can do is have the MBPR come back from the depot and the same thing occur. Any guidance or advice would be so gratefully appreciated.

  • Windows Login Name and Password

    Hi,
    I am developing an application, which requires the windows login name for greeting and password for validating and granting privileges.
    Could someone please give me the pseudo code for getting the windows login name and password.
    Thanks,
    Mitra.

    I'll try to validate some other parameter instead of
    password. The password will be stored but it will be
    encrypted.Bad Thing (TM). Never store passwords.
    When we are able to get the UserName using
    JavaScript, why can't we get it using Java.I told you how to get it. And what does Javascript have to do with anything? Just because you can drive through a very narrow alley with your bicycle, you should be able to do the same with a truck? Javascript and Java are not related in any way.

Maybe you are looking for

  • RoboHelp 9 Master Pages

    My project is upgraded from RoboHelp 7 to RoboHelp 9 I found that when i preview topic, my header / footer images cannot be display, it is empty space, text is fine, whichever text inside a master pages can be display, only the header / footer images

  • Tax code creation

    Dear all Please help. i am creating Input and Output VAt tax codes. I cannot find the customizing for table V_T007AC (tax codes selection for transactions). The codes do not appear in the transactions FB60 and FB70. Can you give me the transaction co

  • Pricing Procedure for RFQ and Contract

    Hi All, I have  configired new pricing procedure for external purchaseing documents import and export business. This pricing procedure is working fine for  PO but while manitan quatation and create contract Iam not able see configured pricing procedu

  • "Infinite Loop" Download Problem

    So I was downloading an album from iTunes, and one of the songs wouldn't download. When it reached the end of the bar, it would just reset, in an infinite loop. And the song is Album Only, so I can't just cancel the download and buy the song again. H

  • Adobe Reader could not open InDesign PDF...

    Just installed InDesign. I can "EXPORT" a PDF, but cannot "PRINT" a PDF. Error message says: "Adobe Reader could not open your PDF because it is either not a supported file type or because the file has been damaged. (For example, it was sent as an em