Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[4693] Using the Credential Management API

Last post 06-24-2008 9:42 PM by dcomer. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [4693] Using the Credential Management API

    This thread is for discussions of Using the Credential Management API.

    • Post Points: 0
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 07-20-2005 4:54 PM In reply to

    Credentials not being saved

    Hi, I've noticed the first time I run this it seems to return without error on the Confirm Credentials part, but Credentials are not appearing in the User Credential Manager and I can't actually access the resource that I should (I'm trying to access the running services on a w2k machine in a workgroup from my win xp machine in a domain. If I add the credentials manually via control panel-->users I can access the services without problem. Also if I try the dialog process again I get the ERROR_INVALID_PARAMETER error on the Confirm Part. Just wondering if you have encountered this yourself and if you have a work around.

    Cheers
    Jim
    • Post Points: 10
  • 01-09-2006 5:11 AM In reply to

    • billyana
    • Not Ranked
    • Joined on 01-09-2006
    • New Member
    • Points 5

    Save Credentials in Stored User Names and Password

    Alan:

    First of all thank you for posting this code.

    The credetials get stored in Stored User Names and Passwords if flag CREDUI_FLAGS_GENERIC_CREDENTIALS (or CREDUI.FLAGS.GENERIC_CREDENTIALS) is not set.  It seems that flags CREDUI_FLAGS_GENERIC_CREDENTIALS and CREDUI_FLAGS_PERSIST are mutually exclusive.

    I modified the implementation of the GetFlags method as below (it is not fully tested).  Now if you set the Persist property to true the credentials are saved against "Secure Application" server (which is somewhat odd).

    private CREDUI.FLAGS GetFlags()
    {
       CREDUI.FLAGS flags = 0;
       if( !this.Persist ) flags = flags | CREDUI.FLAGS.GENERIC_CREDENTIALS;
               
       if (this.AlwaysDisplay && !this.Persist)
           flags = flags | CREDUI.FLAGS.ALWAYS_SHOW_UI | CREDUI.FLAGS.GENERIC_CREDENTIALS;
               
       if (this.ExcludeCertificates) flags = flags | CREDUI.FLAGS.EXCLUDE_CERTIFICATES;
               
       if (this.Persist)
       {
           flags = flags | CREDUI.FLAGS.EXPECT_CONFIRMATION | CREDUI.FLAGS.PERSIST;
       }
       else
       {
           flags = flags | CREDUI.FLAGS.DO_NOT_PERSIST;
       }
       if (this.SaveDisplayed && !this.Persist)
           flags = flags | CREDUI.FLAGS.SHOW_SAVE_CHECK_BOX | CREDUI.FLAGS.DO_NOT_PERSIST;

       if (this.KeepName) flags = flags | CREDUI.FLAGS.KEEP_USERNAME;
               
                   return flags;
    }

    The 2 other changes:
    1. Flag CREDUI_FLAGS_ALWAYS_SHOW_UI can be set only if CREDUI_FLAGS_GENERIC_CREDENTIALS is also specified.
    2. Flag CREDUI.FLAGS.SHOW_SAVE_CHECK_BOX can be set only if CREDUI.FLAGS.DO_NOT_PERSIST is also set.
    • Post Points: 0
  • 06-24-2008 9:42 PM In reply to

    • dcomer
    • Not Ranked
    • Joined on 06-23-2008
    • United States
    • New Member
    • Points 5

    Re: Credentials not being saved

    Not sure if Jim will see this due to the time lapse, but I have also see the same issue. I believe I've narrowed it down to a race condition that occurs between the time the tcpListener.EndAcceptTcpClient completed (the first time, and probably due to instantiation of the associated objects, and when the method LogonUser exits. That is, the first time, apparently the LogonUser exits before EndAcceptTcpClient has time to assigne the WindowsIdentity to Id. A quick solution is to put a boolean set a boolean flag to false at the beginning of the LogonUser that is set after the Id is set and loop at the end of the method until the flag is set trur. However, this not a good solution. I think the correct solution is to use a WaitEvent, but I havn't quick got that to work.

    • Post Points: 5
Page 1 of 1 (4 items)