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.

Similar Messages

  • 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.

  • Set up username & password "admin" are not accepted by the Set Up page

    I hope someone can help.
    When I finished setting up the router via the cd-set up wizard, I tried getting into the Set Up page via the Internet Explorer.
    It does not accept the username & password "admin" that is mentionned in the set-up manual.
    Please help.
    Thank you

    Not too hard to know. It's documented. But what's really interesting is that it's not always true. With some Linksys products, even though the manual and tech support say leave user name blank, you actually have to type in 'admin'!

  • If I want to share a photo ( email) I get the answer: server doesn't recognize the username/password combination ? What's up ???

    If I want to share a photo ( email) I get the answer: server doesn't recognize the username/password combination ? What's up ???

    iPhoto Menu ->
    Preferences ->
    Accounts ->
    Delete and recreate your email settings.
    Alternatively, use Apple's Mail for the job. It has Templates too - and more of them.
    Regards
    TD

  • HT1267 HAVE SET UP AN INCORRECT EMAIL ADDRESS. The call centre set up a new email address as the Username. I am unable to access the new account because the default on my phone is the email that is incorrect. How do I get the correct email as default

    I HAVE SET UP AN INCORRECT EMAIL ADDRESS. The call centre set up a new email address as the Username. I am unable to access the new account because the default on my phone is the email that is incorrect. How do I get the correct email as default??

    Thank you for your help, much appreciated
    Regards
    Geoff

  • Hi-I am trying to email photos from iPhoto and I keep getting a flag that says "the server does not recognize the username/password combination.  Can you help me to reset it?

    Hi…I am trying to email photos from iPhoto and I keep getting a flag that says "the server does not recognize the username/password combination.  Can you help me to reset it?

    Thank you very much for the quick reply and it was so easy.  Make my life much easier now
    Thanks so much

  • How do I find my password if I can't remember the answers to the security questions and the email it is sending the password to no longer exists?

    How do I find my password if I can't remember the answers to the security questions and the email address it is sending the password to no longer exists?

    If you have a rescue email address set up on your account then you can try going to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you might see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address set up then go to Express Lane  and select 'iTunes' from the list of 'products' in the middle of the screen.
    Then select 'iTunes Store', and on the next screen select 'Account Management'
    Next choose 'iTunes Store Account Security' and fill in that you'd like your security questions/answers reset.
    You should get an email reply within, I think, about 24 to 48 hours (and check your Spam folder as well as your Inbox)

  • I am wanting to publish a website created in iweb via a third party web host. How do I put a password for anyone wishing to visit the mysite?

    I am wanting to publish a website created in iweb via a third party web host. How do I put a password for anyone wishing to visit the mysite?

    You create the usernames and passwords where you host your website. Made with or without iWeb.
    Usually it's done in the controlpanel where you manage your account.
    If you cannot do it there, you'll have to do it yourself. See this post :
    https://discussions.apple.com/message/16014940#16014940
    And what is the purpose of password protection for ANYONE who vistis your site?

  • Form-based authentication stores the username/password pair in the session

    Hello,
    I am following the SR Demo and the authentication method followed is
    Form-based authentication stores the username/password pair in the session
    In the URl, the username and password is in clear text format.
    What is the best way of doing the authentication. How can I eliminate the username and password being shown in the URL?
    Any help is highly appreciable.
    Thanks

    Hi,
    this is how form based authentication works according the specs. You can use SSL to protect the communication, use BASIC authentication (though not much better), certificate based auhentication or SSO
    Frank

  • My mini died. bought one used from a friend... all of my songs and books are on my iPhone, and I cant figure out how to get them onto this new computer. this is frustrating. the things i really want are purchases I've made from itunes store... help

    My mini died. bought one used from a friend... all of my songs and books are on my iPhone, and I cant figure out how to get them onto this new computer. this is frustrating. the things i really want are purchases I've made from itunes store... help
    !!!!!

    Hey kevyg3,
    I was able to find an article that I believe will help you move your iTunes purchases from your iPhone over to your new computer:
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    http://support.apple.com/kb/HT1848
    Hope this helps,
    David

  • I recently purchased songs from itunes via my pc and I dont know how to get them onto my iphone? When I click the sync button it says I will lose all the music currently on my iphone.. Help :(

    I recently purchased songs from itunes via my pc and I dont know how to get them onto my iphone? When I click the sync button it says I will lose all the music currently on my iphone.. Help

    If you're syncing with a different iTunes library than the one you previously synced with, then there is no way around it. You're gonna loose the old data. The only way round it would be to make sure that all the music files on your iPhone is also in your iTunes library. If you still have access to the computer with the old library, you could copy the files on to an external harddrive, and then import them into your new iTunes library.
    If it is in fact the same library, then the music currently on your iphone, is also in your itunes library. Just make sure that the artists/albums/playlists, or whatever you sync contains these tracks, that you allready have on your phone and don't want deleted. What i do is, i create a playlist specifically for my iPhone, and i set it up to only sync with this playlist. Whenever i hear a track from my iTunes library or buy a new track that i want on my phone, i just drag it to this playlist and next time i synchronize, it's there without deleting anything else.

  • Photoshop elements 10 will not migrate to my new macbook pro/retina display.  There is no CD/DVD player on this machine.  Any suggestions on how to get Elements onto my machine?  Yes, I have the disk(s).

    Photoshop elements 10 will not migrate to my new macbook pro/retina display.  There is no CD/DVD player on this machine.  Any suggestions on how to get Elements onto my machine?  Yes, I have the disk(s).  Am I going to have to buy an external CD/DVD player to load this one program:(

    I have ordered a USB3 BluRay/DVD/CD player/burner and will use that both with my iMac ( in which the Superdrive seems to be failing ) and the MBPro Retina I just bought .

  • I got a Macbook Air. My system language is russian but the login password is english. I pu the laptop into sleep mode, then wanted to log in again, but the language seems to have switched to russian, there's no language change button! How do I log in now?

    I got a Macbook Air. My system language is russian but the login password is english. I put the laptop into sleep mode, then wanted to log in again, but the language seems to have switched to russian, there's no language change button! How do I log in now?

    Severia,
    I tried your solution, but it did not work with my laptop. After I restart the laptop, the language does not change and I cannot type the password in English language. Do you have any other suggestion?
    Thank you.

  • TS2755 How do get my mail on my ipad 3 to set the same email rules as is on my imac ???

    How do get my mail on my ipad 3 to set the same email rules as is on my imac ???

    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    iPad Mail
    http://www.apple.com/support/ipad/mail/
     Cheers, Tom

  • My ipod touch 4 gen is in recovery mode and i dont know how to get out of it,i tried everything like hold the home and top button at the same time. All it did what g to the apple logo and went back to recovery mode any help?

    My ipod touch 4 gen is in recovery mode and i dont know how to get out of it,i tried everything like hold the home and top button at the same time. All it did what g to the apple logo and went back to recovery mode any help?

    Once the Device is asking to be Restored with iTunes... it is too late to save anything... and you must continue with the Recovery...
    kevinpowell1 wrote:
    how can i get it out of recovery mode?
    Make sure you have the Current Version of iTunes Installed on your computer
    iTunes free download from www.itunes.com/download
    Then See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps...
    Take your time... Pay particular attention to Steps 3 and 4.
    Some users have reported as many as 8 or 9 attempts were necessary before success.
    After you have Recovered your Device...
    Re-Sync your Content or Restore from the most recent Backup...
    Restore from Backup  >  http://support.apple.com/kb/ht1766
    If the issue persists...
    Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
    Be sure to make an appointment first...

Maybe you are looking for

  • How to catch error message inside a variable?

    Hi, I'm trying to catch the error message inside a variable using this this command below:- <%=odiRef.getPrevStepLog("MESSAGE")%> Could you please tell me what is the right approach to capture the error message inside a variable. Thanks Anindya

  • Forms 6i and 10R2 database

    Hi gurus, i have an application with lot of forms and reports in 6i version. I need now to upgrade my database in 10GR2 (10.2.0.4). Then, can i continue to use my old 6i forms and reports application without problem. Even it is not supported (by orac

  • Create an excel template for a report and open it always in that template

    Hi, I've a question. I have a report in BI Answers. I would export it in BI Publisher and create for it an excel template which contains any text and a macro. Then I would associate report to the template so that when i open report in BI Publisher, i

  • Supervisor Desktop - Real time status shows the deleted agents

    Hi All, Recently we modified only the agent IDs for few agents.In ICM we just edited the previous entry. We have not deleted and re created it. Now the problem is the in "Supervisor Desktop - Real time status" the old entries are also reflecting in l

  • Help with multiple user login script

    Hi, just a little background first to what i want to do... I have about 300 Macs in an education environment, they are bound to the AD network for authentication and OSX Server LDAP for forced prefs, the network Home accounts are stored via Apple and