How to get windows username & password

Hi friends,
Requirement is to get windows username & password,
My server is Tomcat4.0,
My code in login.jsp page is
<%
String auth = request.getHeader("Authorization");
if (auth == null) {
response.setStatus(response.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate", "NTLM");
return;
if (auth.startsWith("NTLM ")) {
byte[] msg = new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));
int off = 0, length, offset;
String s;
if (msg[8] == 1) {
off = 18;
byte z = 0;
byte[] msg1 = {(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S',
(byte)'S', (byte)'P', z,
(byte)2, z, z, z, z, z, z, z,
(byte)40, z, z, z, (byte)1, (byte)130, z, z,
z, (byte)2, (byte)2, (byte)2, z, z, z, z, //
z, z, z, z, z, z, z, z};
response.setStatus(response.SC_UNAUTHORIZED);
response.setHeader("WWW-Authenticate", "NTLM "
+ new sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());
return;
else if (msg[8] == 3) {
off = 30;
length = msg[off+17]*256 + msg[off+16];
offset = msg[off+19]*256 + msg[off+18];
s = new String(msg, offset, length);
//out.println(s + " ");--------------------------> here getting system_name
else
return;
length = msg[off+1]*256 + msg[off];
offset = msg[off+3]*256 + msg[off+2];
s = new String(msg, offset, length);
//out.println(s + " ");
length = msg[off+9]*256 + msg[off+8];
offset = msg[off+11]*256 + msg[off+10];
s = new String(msg, offset, length);
out.println("Hello <span style='position:relative; width:190;"
+ " height:10;filter:glow(Color=#009966,Strength=1)'>");
out.println(s + "</SPAN>");----------------------------------->here getting loginname.
%>
from this i was able to get systemname & username,How do i get password.
Is it possible to get password?
Thanks,
Satya.

There's no way to get the password. NTLM uses a two-round challenge-response scheme which never send the password (neither clear nor encrypted) on the wire.
Why do you need the user's password? Is your service going to access a backend service using the user's credential? If so, you may need to use Kerberos delegation.

Similar Messages

  • How to get windows username printed on each page irrespective of application? we have cm6030f.

    How to get windows username printed on each page irrespective of application? we have HP CM6030F.

    Hi,
    Normally, you will receive a Windows Azure Pass from your local Windows Azure team. Please try to contact your local Windows Azure contact (http://support.microsoft.com/gp/customer-service-phone-numbers?wa=wsignin1.0
    Also, you could see this page
    http://www.windowsazurepass.com/AzureU/AcademicFAQ and apply the free trial azure via (http://www.windowsazurepass.com/AzureU/).
    Q: I am a student. Can I apply for a pass?                     
    A: Windows Azure Educator Grants are only for valid faculty. If your faculty has been awarded a Windows Azure Educator Grant, you will be able to get a pass through him/her for you coursework. If you are interested in learning more about Windows Azure,
    we encourage you to share these Educator Grants with your faculty or sign up for the FREE 3-month trial offer. 
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to get the username/password of the current owner of the running code

    Dear friends,
    Our product is running on the App Server(weblogic/websphere...) and we also use security provider(OpenLDAP) and kerberos to support SSO. Before, when a user tyies to login in the first time, the way we use to authenticate the user is:
    1) Accept the username/password
    2) Query the security provider(OpenLDAP) to get the principles.
    3) verity if the username/password is corrent or not.
    As we know, to query the principles, we need to provide a search user(both username and password) if we configured the access control of the ldap server:
    I have configured my envirioment as follows
    1) In the LDAP server, configured the Middle Tire user(The Operating System user running the App Server) to have the permission to query principles.
    2) The server is configured to runing on SSO envirioment.
    My question is could I get the username/password of the OS user running the App Server at runtime so that I can query the ldap server without explicitly providing the search user?
    Thanks,
    RR
    Edited by: Ricky Ru on Oct 9, 2011 1:50 AM

    Thanks EJP.
    I have made some progress on this. But I have met another issue.
    *1) Using JAAS to login.*
    loginContext.login();
                   Subject subject = loginContext.getSubject();
                   ldapContext = (LdapContext) Subject.doAs(subject, this);
    *2) Init the ldapContext to use the GSSAPI authentication*
    // this is called automatically by login()
         public Object run() {
              Hashtable ldapEnv = new Hashtable();
              ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
              ldapEnv.put(Context.PROVIDER_URL, "ldap://9.30.215.197");
              ldapEnv.put(Context.SECURITY_AUTHENTICATION,"GSSAPI");
              ldapEnv.put(Context.SECURITY_PRINCIPAL,"");
              ldapEnv.put(Context.SECURITY_CREDENTIALS,"");
              //System.setProperty("sun.security.krb5.debug", "false");
              // This tells the GSS-API to use the cached ticket as
              // credentials, if it is available
              System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");     
              try {
                   InitialLdapContext ctx = new InitialLdapContext(ldapEnv,null);
    But I got the following exception when excuting new InitialLdapContext(ldapEnv,null);
    Debug is true storeKey false useTicketCache true useKeyTab false doNotPrompt false ticketCache is null isInitiator true KeyTab is null refreshKrb5Config is false principal is null tryFirstPass is false useFirstPass is false storePass is false clearPass is false
    Acquire TGT from Cache
    Principal is [email protected]
    Commit Succeeded
    javax.naming.AuthenticationException: GSSAPI [Root exception is javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Integrity check on decrypted field failed (31))]]
         at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:150)
         at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:214)
         at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2694)
         at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:293)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
         at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
         at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
         at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
         at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
         at javax.naming.InitialContext.init(InitialContext.java:223)
         at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:134)
         at LDAPKerbService.run(LDAPKerbService.java:66)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAs(Subject.java:337)
         at LDAPKerbService.login(LDAPKerbService.java:40)
         at LDAPKerbService.main(LDAPKerbService.java:82)
    Caused by: javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Integrity check on decrypted field failed (31))]
         at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:194)
         at com.sun.jndi.ldap.sasl.LdapSasl.saslBind(LdapSasl.java:105)
         ... 16 more
    Caused by: GSSException: No valid credentials provided (Mechanism level: Integrity check on decrypted field failed (31))
         at sun.security.jgss.krb5.Krb5Context.initSecContext(Krb5Context.java:663)
         at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:230)
         at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:162)
         at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(GssKrb5Client.java:175)
         ... 17 more
    Caused by: KrbException: Integrity check on decrypted field failed (31)
         at sun.security.krb5.KrbTgsRep.<init>(KrbTgsRep.java:61)
         at sun.security.krb5.KrbTgsReq.getReply(KrbTgsReq.java:185)
         at sun.security.krb5.internal.CredentialsUtil.serviceCreds(CredentialsUtil.java:294)
         at sun.security.krb5.internal.CredentialsUtil.acquireServiceCreds(CredentialsUtil.java:106)
         at sun.security.krb5.Credentials.acquireServiceCreds(Credentials.java:562)
         at sun.security.jgss.krb5.Krb5Context.initSecContext(Krb5Context.java:594)
         ... 20 more
    Caused by: KrbException: Identifier doesn't match expected value (906)
         at sun.security.krb5.internal.KDCRep.init(KDCRep.java:133)
         at sun.security.krb5.internal.TGSRep.init(TGSRep.java:58)
         at sun.security.krb5.internal.TGSRep.<init>(TGSRep.java:53)
         at sun.security.krb5.KrbTgsRep.<init>(KrbTgsRep.java:46)
         ... 25 more
    Do you have any clue on this? Thanks.

  • How To Get WINDOWS WEP PASSWORDS To Work

    Having problems getting simple simple simple WEP to work with your Airport despite knowing exactly what you are doing with WEP, everything looking fine, and with a network that otherwise has always worked fine before? Might be the case of password used on your clients.
    Having set up a few Airports with mixed Windows/Mac clients over the last few years and finally discovering the "0x" prefix double-secret answer, I was trying that at first. But the new Admin client WON'T LET YOU USE THAT or "$" ANYMORE (take note helpful posters who keep giving that as the answer - it DOESN'T WORK ANYMORE). The new Admin client helpfully allows your password to be selected as "hex" now, but restricts it to 10 chars for 40-bit WEP so you get an error with either of those prefixes.
    But that's OK because the WEP entry system does work and if you select "Equivalent Network Password" in the Admin client, it will show you the password as you entered it so you can confirm.
    HERE however is the trick. The Airport, unlike any other router I've config'd, seems to be fussy about case. Go figure - for hexadecimal, case should not matter, the characters are really 'numbers' so A=10 and B=11 and it should be that a=10 and b=11 as well.
    But not for the Airport which is happy getting "0AEB66A88D" but won't authenticate clients which are config'd for "0aeb66a88d". Seems very bizarre as I would have bet my Honore Balzac that the WEP would have been sent in binary at some lower protocol level, but apparently it's sent as a character string. Certainly I have entered WEP keys both ways before into other devices with no problems. Naturally good coders would always convert the case either before sending it and/or upon receipt, but in this case we apparently have lazy coders on both sides - Microslug doesn't 'toupper()' as it sends the string and Apple doesn't 'toupper()' as it receives it...
    First a recommendation: get the Airport hardwired to your network temporarily so that as you config you are doing it over an Ethernet cable. This way you can test settings, then still config the Airport without resetting the unit back to "Factory Fresh" every time.
    Second the ridiculous WEP answer: Configure the Airport as you think it should be. Then adjust the WEP passwords on client PC's and other devices so that all Hex codes are entered with caps. Voila everything works fine. A bit tedious to have to re-enter the password on every PC or device if you have a few, but better than it not working at all...
    Third: It seems to work better on the Windows side if your network is configured as "OPEN" rather than "SHARED" WEP security. This means the router won't request the password, but I'm not sure how much difference that really makes to the client as it should send the WEP key either way...

    Welcome platevoltage,
    this could help you...
    http://docs.info.apple.com/article.html?artnum=166611
    http://docs.info.apple.com/article.html?artnum=108058

  • How 2 get WINDOWS USERNAME in a JSP

    <%@ page import="sun.misc.BASE64Encoder" %>
    <%
    String auth = request.getHeader("Authorization");
    if (auth == null) {
    response.setStatus(response.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "NTLM");
    return;
    if (auth.startsWith("NTLM ")) {
    byte[] msg = new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));
    int off = 0, length, offset;
    String s;
    if (msg[8] == 1) {
    off = 18;
    byte z = 0;
    byte[] msg1 = {(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S',
    (byte)'S', (byte)'P', z,
    (byte)2, z, z, z, z, z, z, z,
    (byte)40, z, z, z, (byte)1, (byte)130, z, z,
    z, (byte)2, (byte)2, (byte)2, z, z, z, z, //
    z, z, z, z, z, z, z, z};
    response.setStatus(response.SC_UNAUTHORIZED);
    response.setHeader("WWW-Authenticate", "NTLM "
    + new sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());
    return;
         else if (msg[8] == 3) {
    off = 30;
    length = msg[off+9]*256 + msg[off+8];
    offset = msg[off+11]*256 + msg[off+10];
    s = new String(msg, offset, length);
    out.println(s + " ");
    else
    return;
    %></BODY>

    Please use Code tags
    Any of theses answer your question?
    Ohh, wait that code is a direct copy of the first two posts.
    What is wrong with it?

  • *** How to get the username in a custom password change routine....

    How to get the username in a custom password change routine / procedure / form when a user's password has expired and is redirected automatically to this custom program?
    We use the 2nd parameter in LOGIN_URL column in WWSSO_LS_CONFIGURATION_INFO$ table to get to this custom change-password proc.

    OK !
    Use that maybe good :
    select USERID into v_user from sys.aud$
      where ntimestamp#=(
      select max(ntimestamp#)
      from sys.aud$ );

  • How get windows username

    Hi,
    In my java application I have following code to get windows username-
    *<%*
    String s1 = System.getProperty("user.name");
    out.println("The Username : "+s1+" ");
    String s2 = System.getenv("USERNAME");
    out.println("The Username : "+s2);
    *%>*
    If I log in to my PC and execute it I get correct output for both the statements, But when I execute it on server machine(when I logged in) I get the output as-
    The Username : SYSTEM The Username : null
    I use Apache Tomcat 5.5 to run the jsp on both (PC & server) machines. One small difference is I use eclipse on my PC and I don't use eclipse on server (I think it doesn't matter).
    But when I use the same code inside a java class I get correct output on both (PC & server) machines.
    Can any one solve my problem.
    Thanks in advance,
    Tiijnar

    tiijnar wrote:
    Hi BalusC,
    Thanks for the reply.
    Could you please be more elaborted on this. What I mean is- can you provide me the code for the applet.Just the same code. Use System#getProperty() in an applet. The only difference is that the applet runs at the client machine and the Java web application runs at the server machine. If your problem is rather that you don't know how to use applets, just check the applet tutorial here at sun.com. Google can find it.
    Moreover when I execute jsp on my PC, I execute it on localhost (a server inside my PC). I face the problem when I host my application on my server machine.D'oh. On "localhost" the client and the server are physically on the same machine.

  • DOES ANYONE KNOW HOW TO GET PASSED MY PASSWORD LOGIN on a mac pro? I FORGOT IT. (yosemite 10.10.1)

    DOES ANYONE KNOW HOW TO GET PASSED MY PASSWORD LOGIN on a mac pro? I FORGOT IT. (yosemite 10.10.1)

    User Tip:  Reset the user password in OS X Lion, Mountain Lion, Mavericks and Yosemite
    Posting in CAPS LOCK Is often seen as screaming and is not appreciated.  It's also very hard to read.

  • How to get Windows Server 2012 trial license key?

    How to get Windows Server 2012 trial license key? I'm trying to install WinServer 2012 Trial on a VMWare Workstation 9. I'm asked for the product key during set up. If I ignore putting in the key (since I don't have one) The install fails stating no valid
    key. I tried this with Oracle's Virtual Box and the same thing happens. I tried using Majic JellyBean to find the key, but that only works on pre-installed OS. A Technet article said to use aaaa-bbbbb-ccccc-ddddd etc. in the spaces. That doesn't work either.
    Articles all over the web seem to have other people in the same boat. Please help :)

    Download the trial version from here -
    http://www.microsoft.com/en-us/server-cloud/evaluate/trial-software.aspx  It does not require a key.  If the software is asking for a key, it is not the trial copy.  Where did you get your copy?
    .:|:.:|:. tim

  • My daughter forgot her password, any suggestions of how to get around the password without deleting everything she has on it?

    She has never synced her ipod touch to iTunes, any suggestions of how to get around the password without deleting everything she has on the device?  Apple support recommended recovery mode, but doesn't that erase everything on the ipod?

    You are out of luck but a Date Recovery company may be able to help if the iPod does not have iOS 8.
    If there is an iCloud backup you can restore from that.
    You can redownload most iTunes purchases by:        
      Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • How to get window system user?

    Hi,
    How to get window system user use PL/SQL(form develope6i)?

    If you don't use Oracle database then you will have to do one of two things:
    (1) Now I'm back in the office I can check D2KWUTIL. The version I have comes with Forms6.0, so it is somewhat out of date, but it has a method called WIN_API_ENVIRONMENT.Get_Windows_Username - which works for NT/95 only, although I'm sure a later version will support more recent OS.
    (2) If that's no good then you'll have to use whatever facilities your database offers: I only know Oracle.
    I also repeat my suggestion that you try the Forms forum for additional help. This is the Database forum and so is focused on serverside Oracle PL/SQL. For your needs the Developer Suite forums are better.
    Cheers, APC

  • How to get CLIENT Username

    Hi Experts,
    I have a problem in retrieving my client's computer name and its username using windows api..
    Coz my program is using JNI so for the windowsAPI i used GetUserName and Get ComputerName --> It gives me the username and the computer name of the server..
    Any idea how to get another (computer username and its computer name PASSWORD IF POSSIBLE) that logon to my server.
    Any suggestion will be highly appreciated..
    Thank you
    Suwandy

    Any idea how to get another (computer username and its
    computer name PASSWORD IF POSSIBLE) that logon to my
    server.
    High hopes
    What are your clients?
    Java,jsp,html or are they servlets
    -Regards
    Manikantan

  • Getting invalid username/password error while trying to create_queue_table

    Here is how I get it.
    connect / as sysdba
    create user aq identified by aq
    default tablespace users
    temporary tablespace temp
    quota unlimited on users;
    grant connect,
    create type,
    create procedure,
    aq_administrator_role
    to aq;
    grant execute on dbms_aq to aq;
    grant execute on dbms_aqadm to aq;
    begin
    dbms_aqadm.grant_system_privilege('ENQUEUE_ANY','AQ',FALSE);
    dbms_aqadm.grant_system_privilege('DEQUEUE_ANY','AQ',FALSE);
    end;
    connect aq/aq
    create Type aq.message_typ as object (
    subject Varchar2(30), text Varchar2(80)
    begin
    dbms_aqadm.create_queue_table(
    queue_table => 'aq.objmsgs80_qtab',
    queue_payload_type => 'aq.Message_typ',
    multiple_consumers => true);
    end;
    Error at line 1:
    ORA-01017: invalid username/password; logon denied
    ORA-06512: at "SYS.DBMS_AQADM_SYS", line 2934
    ORA-06512: at "SYS.DBMS_AQADM", line 58
    ORA-06512: at line 2

    In what version of Oracle?
    I see a couple of problems assuming you are working with a currently supported version:
    1. Never grant CONNECT to anyone: Ever. Grant CREATE SESSION.
    2. GRANT CREATE TABLE to AQ;
    Go to Morgan's Library at www.psoug.org and look at AQ Demo 1. You should have no problem cutting and pasting your way to where you are trying to go.

  • How to get the Sysman password in a fetchlet?

    Folks,
    Need advise.
    I have a fetchlet and I need to get the username and password of the oracle management repository (using some Perl and SQL Scripts) to fetch some details.
    How I can get the password of Sysman user in a fetchlet?
    Is there some thing similar to <Property NAME="emdRoot" SCOPE="SYSTEMGLOBAL">emdRoot</Property>
    thanks
    Mathew

    Those are parameters you would have to take in as instance properties, which would force the user to enter them every time they create an instance of your target type.
    What's the reason you need to connect to the repository? That's an extremely odd case unless your target type is monitoring the repository.

  • How can i specify username/password while creating a virtual directory

    Hi,
    i m trying to create a virtual directory in 9iAS on a mapped drive. How can i specify which username password to use to enable to connect to the network mapped drive. Is there any way where we can specify username / password ???
    thanks
    Unmesh

    9iAS R1
    Run the report service as a local account with administrator rights.
    On the target server, create a local account with the same user name and password.
    Now you can use the hidden shares ($) for example:
    &destype=file&desname=\\servername\d$\report_output\report.pdf
    9iAS R2 and 10g
    Pretty much the same thing except by default, the report server runs inline. I have not been able to get the entire service to run as a particular user. To get around this, I created a report server service and do not run the reports in process. It uses the separate service.
    rwserver -install rep90_name
    edit <ORACLE_HOME>\reports\conf\rwservlet.properties file.
    SERVER_IN_PROCESS=NO
    SERVER=rep90_name
    Edit service for rep90_name and change it to run as local administrator user you created on both servers and then start the service.

Maybe you are looking for

  • Issue in Extending VO

    Hi Iam trying to extend a VO when Iam editing the SQL Statement by just adding a column to it at the Attribute mapping level it is showing as transient and later it is not allowing to update the column in base table At some situation some Query Colum

  • WM/IM modules for SAP

    Being a newby to the WM/IM modules for SAP, does anyone know where I can get documentation and/or refer me to documentation on low level features of these modules.  I'm basically looking for answers to the features listed below. Thanks Feature RECEIV

  • External Procedure call from Trigger

    I'd like to call an external C Procedure from an Oracle Trigger. In trying to get an example to work, after setting up the listener and tnsnames.ora for external procedures, the following SQL*Plus command behaves strangely: CREATE LIBRARY TTest as "c

  • Transfer file in Single User Mode (Command S)

    Can I mount my iPod as external drive and transfer my documents in Single User Mode? or any other mode? I just cannot login as normal. I want to backup my docs before refresing the OS.

  • Acrobat X Pro 2.3Gb?

    Adobe, what's with the 2.3  Gig install for Acrobat X Pro? Not even Photoshop x64 is that big (not even close!) What are you stuffing in there? And why can I not customize the install? I'd like more information on what makes the Acrobat X Pro footpri