Results 1 to 14 of 14

Thread: Login using Windows Authentication

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    7

    Login using Windows Authentication

    Anyone have any great ideas on how to incorporate a login from using the network or Windows login information to authenticate against? ie if my login info was username: p and passsword: q, I want to be able to enter that same information into the login screen of my vb6 program and have it authenticated the same way the network/windows login is authenticated. I know I can get the user and the computer but that really ins't what I need, I also know about checking a table or file, but again, not what I am looking for. Any suggestions, code showing how to implement is appreciated.

  2. #2
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Login using Windows Authentication

    Welcome to th fourms

    I do think if you look at the VB Applicaiton Wizard, it will allow you to incorparate a login screen, which im sure uses the users username and password, for the device they are working on, take a look at that, and if needed, steal the code

    ILMV

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Login using Windows Authentication

    You would have to use some APIs if your not running Active Directory to at least verify the user and possibly authenticate but I'm not 100% sure you can as most of the security resources of Windows are C++ dlls and arent able to be used in VB.

    The other option is if you are running AD then you can verify a user and pwd.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043

    Re: Login using Windows Authentication

    If someone is allready signed in, why you ask he sign again?
    If Windows / AD passwords are picked up from somewhere, they are not any security matters.
    oh1mie/Vic


  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    7

    Re: Login using Windows Authentication

    Hello, thank you all for your replies. I actually found a away to do it. Basically, authenticates that they are a user by seeing if they exist in the domain. I still am going to have to control feature access per user id, that is what I thought was only needed in the first place but others thought they needed to authenticate...I guess in case someone else tries to run the app...??? But even then, I will do my own authenticating based soley on the user id so...wait stop. I am having this same discussion here that I have already had with others...anyway, here is the code that I used...:
    Dim oIADS
    sNTDomain = ""
    sUsername =frmLogin.txtewid.Text
    spassword =frmLogin.txtewpwd.Text
    Set oIADS = GetObject("WinNT:").OpenDSObject("WinNT://" & _
    sNTDomain, _
    sUsername, _
    spassword, _
    ADS_SECURE_AUTHENTICATION)
    Set oIADS = Nothing
    Then if it fails, it will go to error handler, and you know that one of the items you passed is incorrect. If it goes through, then you know the user has is truly the user who entered the ID and that is trying to access the application.

  6. #6
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043

    Re: Login using Windows Authentication

    The program must be very known, before giving AD password for it.
    Ho says than is not phishing going on.
    oh1mie/Vic


  7. #7

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    7

    Re: Login using Windows Authentication

    Say again? I am not sure I understand what you are meaning....

  8. #8
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043

    Re: Login using Windows Authentication

    I dont think than is good idea ask typing AD passwords if program is not fully trusted and known.

    By my self, I'm allways distrustful
    oh1mie/Vic


  9. #9

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    7

    Re: Login using Windows Authentication

    OK, I understand now, yes, I see what you are saying. This is a fully trusted program, it is an internal developed application and really, only people who normally work with it have access to it. So...I think it will be OK. However like you I tend to be distrustful also.

  10. #10
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Login using Windows Authentication

    Asking for a Windows USERNAME/PASSWORD is not a good idea in my opinion.

    Workstation security should be handled through things like "time-outs" to screen savers that require the person unlock the PC to continue.

    Once a person is logged on to the system you should not be asking for username or password again - that's not a standard technique and I also consider it to be a very bad idea.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  11. #11

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    7

    Re: Login using Windows Authentication

    I agree, I don't really like asking for it again, hence the original question might should have said, I understand how to get the logged on users username, how do I get password to pass to other applications that are opened and in turn will use the same credentials to say...log on to another server and do an ftp or something.

  12. #12
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Login using Windows Authentication

    Quote Originally Posted by actionjack2006
    I agree, I don't really like asking for it again, hence the original question might should have said, I understand how to get the logged on users username, how do I get password to pass to other applications that are opened and in turn will use the same credentials to say...log on to another server and do an ftp or something.
    If you are all in the domain why do you need a un/pw to talk to an ftp box? Wouldn't the proper method be to make shares and allow access through the domain controls?

    If they are using WINDOWS XP PROFESSIONAL then look at the link in my signature about non-domain authentication. It works for domain authenticaton as well...

    Basically under MANAGE PASSWORDS you can load additional server's with un/pw credentials for login without a "pop-up" login window.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  13. #13
    New Member
    Join Date
    Sep 2007
    Posts
    2

    Re: Login using Windows Authentication

    thansk man action jack..........for the code infact i was also searching for the same..and one more thing...i feel that everyone else who replied for ur question wa just beating around the bush....(may be they dotn know actually what to do.....)...plz friends...if u know a way around a problem plz do make it clear for the one who ptus the question......atleast plz dont confuse even if the question is not answered....!!!!!

    cheeersssssss

  14. #14
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Login using Windows Authentication

    Quote Originally Posted by madhavanjayaram
    thansk man action jack..........for the code infact i was also searching for the same..and one more thing...i feel that everyone else who replied for ur question wa just beating around the bush....(may be they dotn know actually what to do.....)...plz friends...if u know a way around a problem plz do make it clear for the one who ptus the question......atleast plz dont confuse even if the question is not answered....!!!!!

    cheeersssssss
    Actually there is code in the CODE BANK on the forum here to authenticate to the ACTIVE DOMAIN.

    But as was said in most of the posts in this thread asking for a un/pw after a machine is logged on is not a good idea.

    Windows allows for credentials to be stored - the link is in my signature - so that re-asking for a domain password is not needed during run time.

    Windows also passes existing logon credentials along to many network type calls.

    Did you find your solution in this thread? I could barely understand what your post meant.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width