Using Win NT User Name and Password for another App.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 2 12 LastLast
Results 1 to 15 of 23

Thread: Using Win NT User Name and Password for another App.

  1. #1
    santosh Guest

    Using Win NT User Name and Password for another App.


    Hi !,

    Is there any way that I can use Win NT User Name and Password for my VB
    Application to login. eg.. like Win NT authentication for SQL server connection.

    I want to use the NT User Name and password for my application, so that all
    users who have permission to use this NT machine will have access to the
    appliaction, by entering thier NT user name and password in the applicaiton's
    login screen.

    So that I don't have to create a User master in my application's database
    and create new users for the application from the application end.

    This machine is not connected to the network.


    Thanks

    Santosh

  2. #2
    Michael \(michka\) Kaplan Guest

    Re: Using Win NT User Name and Password for another App.

    You cannot get the password; this would obviously be a security issue.


    --
    MichKa

    Michael Kaplan
    (principal developer of the MSLU)
    Trigeminal Software, Inc. -- http://www.trigeminal.com/
    the book -- http://www.i18nWithVB.com/

    "santosh" <sant99@hotmail.com> wrote in message
    news:3c14f745$1@147.208.176.211...
    >
    > Hi !,
    >
    > Is there any way that I can use Win NT User Name and Password for my VB
    > Application to login. eg.. like Win NT authentication for SQL server

    connection.
    >
    > I want to use the NT User Name and password for my application, so that

    all
    > users who have permission to use this NT machine will have access to the
    > appliaction, by entering thier NT user name and password in the

    applicaiton's
    > login screen.
    >
    > So that I don't have to create a User master in my application's database
    > and create new users for the application from the application end.
    >
    > This machine is not connected to the network.
    >
    >
    > Thanks
    >
    > Santosh




  3. #3
    Michael \(michka\) Kaplan Guest

    Re: Using Win NT User Name and Password for another App.

    You cannot get the password; this would obviously be a security issue.


    --
    MichKa

    Michael Kaplan
    (principal developer of the MSLU)
    Trigeminal Software, Inc. -- http://www.trigeminal.com/
    the book -- http://www.i18nWithVB.com/

    "santosh" <sant99@hotmail.com> wrote in message
    news:3c14f745$1@147.208.176.211...
    >
    > Hi !,
    >
    > Is there any way that I can use Win NT User Name and Password for my VB
    > Application to login. eg.. like Win NT authentication for SQL server

    connection.
    >
    > I want to use the NT User Name and password for my application, so that

    all
    > users who have permission to use this NT machine will have access to the
    > appliaction, by entering thier NT user name and password in the

    applicaiton's
    > login screen.
    >
    > So that I don't have to create a User master in my application's database
    > and create new users for the application from the application end.
    >
    > This machine is not connected to the network.
    >
    >
    > Thanks
    >
    > Santosh




  4. #4
    Rob Teixeira Guest

    Re: Using Win NT User Name and Password for another App.



    You can't retrieve a user's password, but you can authenticate the user by
    using the LogonUser API function. This takes the user name and text password.
    If the function succeeds, the password was correct.

    This can also be done to impersonate the user's credentials in order to access
    resources and system objects. However, if this is your intent, i suggest
    you do a search on Impersonation in the MSDN to learn some of the more intricate
    details.

    -Rob

    "santosh" <sant99@hotmail.com> wrote:
    >
    >Hi !,
    >
    >Is there any way that I can use Win NT User Name and Password for my VB
    >Application to login. eg.. like Win NT authentication for SQL server connection.
    >
    >I want to use the NT User Name and password for my application, so that

    all
    >users who have permission to use this NT machine will have access to the
    >appliaction, by entering thier NT user name and password in the applicaiton's
    >login screen.
    >
    >So that I don't have to create a User master in my application's database
    >and create new users for the application from the application end.
    >
    >This machine is not connected to the network.
    >
    >
    >Thanks
    >
    >Santosh



  5. #5
    Rob Teixeira Guest

    Re: Using Win NT User Name and Password for another App.



    You can't retrieve a user's password, but you can authenticate the user by
    using the LogonUser API function. This takes the user name and text password.
    If the function succeeds, the password was correct.

    This can also be done to impersonate the user's credentials in order to access
    resources and system objects. However, if this is your intent, i suggest
    you do a search on Impersonation in the MSDN to learn some of the more intricate
    details.

    -Rob

    "santosh" <sant99@hotmail.com> wrote:
    >
    >Hi !,
    >
    >Is there any way that I can use Win NT User Name and Password for my VB
    >Application to login. eg.. like Win NT authentication for SQL server connection.
    >
    >I want to use the NT User Name and password for my application, so that

    all
    >users who have permission to use this NT machine will have access to the
    >appliaction, by entering thier NT user name and password in the applicaiton's
    >login screen.
    >
    >So that I don't have to create a User master in my application's database
    >and create new users for the application from the application end.
    >
    >This machine is not connected to the network.
    >
    >
    >Thanks
    >
    >Santosh



  6. #6
    Monte Hansen Guest

    Re: Using Win NT User Name and Password for another App.


    As Rob says, you can impersonate the subject user. This has some requirements,
    however, such as the caller holding the SeTcbPrivilege privilege, which is
    not automatically granted to administrators.

    Here is some code to perform impersonation:
    http://killervb.com/functionJunction...personator.cls

    Here is some code to enable privileges:
    http://killervb.com/functionJunction...privileges.bas

    Monte Hansen
    http://KillerVB.com


    "santosh" <sant99@hotmail.com> wrote:
    >
    >Hi !,
    >
    >Is there any way that I can use Win NT User Name and Password for my VB
    >Application to login. eg.. like Win NT authentication for SQL server connection.
    >
    >I want to use the NT User Name and password for my application, so that

    all
    >users who have permission to use this NT machine will have access to the
    >appliaction, by entering thier NT user name and password in the applicaiton's
    >login screen.
    >
    >So that I don't have to create a User master in my application's database
    >and create new users for the application from the application end.
    >
    >This machine is not connected to the network.
    >
    >
    >Thanks
    >
    >Santosh



  7. #7
    Monte Hansen Guest

    Re: Using Win NT User Name and Password for another App.


    As Rob says, you can impersonate the subject user. This has some requirements,
    however, such as the caller holding the SeTcbPrivilege privilege, which is
    not automatically granted to administrators.

    Here is some code to perform impersonation:
    http://killervb.com/functionJunction...personator.cls

    Here is some code to enable privileges:
    http://killervb.com/functionJunction...privileges.bas

    Monte Hansen
    http://KillerVB.com


    "santosh" <sant99@hotmail.com> wrote:
    >
    >Hi !,
    >
    >Is there any way that I can use Win NT User Name and Password for my VB
    >Application to login. eg.. like Win NT authentication for SQL server connection.
    >
    >I want to use the NT User Name and password for my application, so that

    all
    >users who have permission to use this NT machine will have access to the
    >appliaction, by entering thier NT user name and password in the applicaiton's
    >login screen.
    >
    >So that I don't have to create a User master in my application's database
    >and create new users for the application from the application end.
    >
    >This machine is not connected to the network.
    >
    >
    >Thanks
    >
    >Santosh



  8. #8
    Monte Hansen Guest

    Re: Using Win NT User Name and Password for another App.


    So you say, Michael, but that's not your call to make. The need for batch
    impersonation exists, as is the ability to perform it; and so I submit:

    U-R-W-R-O-N-G !

    Monte Hansen
    http://KillerVB.com


    "Michael \(michka\) Kaplan" <former_mvp@nospam.trigeminal.spamless.com> wrote:
    >Anyone with an app that does this should be taken out and shot.
    >
    >Why would anyone want to trust their password to any app OTHER than the

    OS
    >logon service?
    >
    >
    >--
    >MichKa
    >
    >Michael Kaplan
    >(principal developer of the MSLU)
    >Trigeminal Software, Inc. -- http://www.trigeminal.com/
    >the book -- http://www.i18nWithVB.com/
    >
    >
    >"Rob Teixeira" <RobTeixeira@@msn.com> wrote in message
    >news:3c1518c0$1@147.208.176.211...
    >>
    >>
    >> You can't retrieve a user's password, but you can authenticate the user

    by
    >> using the LogonUser API function. This takes the user name and text

    >password.
    >> If the function succeeds, the password was correct.
    >>
    >> This can also be done to impersonate the user's credentials in order to

    >access
    >> resources and system objects. However, if this is your intent, i suggest
    >> you do a search on Impersonation in the MSDN to learn some of the more

    >intricate
    >> details.
    >>
    >> -Rob
    >>
    >> "santosh" <sant99@hotmail.com> wrote:
    >> >
    >> >Hi !,
    >> >
    >> >Is there any way that I can use Win NT User Name and Password for my

    VB
    >> >Application to login. eg.. like Win NT authentication for SQL server

    >connection.
    >> >
    >> >I want to use the NT User Name and password for my application, so that

    >> all
    >> >users who have permission to use this NT machine will have access to

    the
    >> >appliaction, by entering thier NT user name and password in the

    >applicaiton's
    >> >login screen.
    >> >
    >> >So that I don't have to create a User master in my application's database
    >> >and create new users for the application from the application end.
    >> >
    >> >This machine is not connected to the network.
    >> >
    >> >
    >> >Thanks
    >> >
    >> >Santosh

    >>

    >
    >



  9. #9
    Monte Hansen Guest

    Re: Using Win NT User Name and Password for another App.


    So you say, Michael, but that's not your call to make. The need for batch
    impersonation exists, as is the ability to perform it; and so I submit:

    U-R-W-R-O-N-G !

    Monte Hansen
    http://KillerVB.com


    "Michael \(michka\) Kaplan" <former_mvp@nospam.trigeminal.spamless.com> wrote:
    >Anyone with an app that does this should be taken out and shot.
    >
    >Why would anyone want to trust their password to any app OTHER than the

    OS
    >logon service?
    >
    >
    >--
    >MichKa
    >
    >Michael Kaplan
    >(principal developer of the MSLU)
    >Trigeminal Software, Inc. -- http://www.trigeminal.com/
    >the book -- http://www.i18nWithVB.com/
    >
    >
    >"Rob Teixeira" <RobTeixeira@@msn.com> wrote in message
    >news:3c1518c0$1@147.208.176.211...
    >>
    >>
    >> You can't retrieve a user's password, but you can authenticate the user

    by
    >> using the LogonUser API function. This takes the user name and text

    >password.
    >> If the function succeeds, the password was correct.
    >>
    >> This can also be done to impersonate the user's credentials in order to

    >access
    >> resources and system objects. However, if this is your intent, i suggest
    >> you do a search on Impersonation in the MSDN to learn some of the more

    >intricate
    >> details.
    >>
    >> -Rob
    >>
    >> "santosh" <sant99@hotmail.com> wrote:
    >> >
    >> >Hi !,
    >> >
    >> >Is there any way that I can use Win NT User Name and Password for my

    VB
    >> >Application to login. eg.. like Win NT authentication for SQL server

    >connection.
    >> >
    >> >I want to use the NT User Name and password for my application, so that

    >> all
    >> >users who have permission to use this NT machine will have access to

    the
    >> >appliaction, by entering thier NT user name and password in the

    >applicaiton's
    >> >login screen.
    >> >
    >> >So that I don't have to create a User master in my application's database
    >> >and create new users for the application from the application end.
    >> >
    >> >This machine is not connected to the network.
    >> >
    >> >
    >> >Thanks
    >> >
    >> >Santosh

    >>

    >
    >



  10. #10
    Rob Teixeira Guest

    Re: Using Win NT User Name and Password for another App.


    "Michael \(michka\) Kaplan" <former_mvp@nospam.trigeminal.spamless.com> wrote:
    >Anyone with an app that does this should be taken out and shot.
    >


    I won't go that far, since I don't know the extent of his program's requirements.
    However...
    I find it highly suspect that one would need to logon to the OS, then logon
    *again* to the application (on the same computer, in the same session). In
    a typical corporate environment, this is definitely not the norm operating
    procedure, and I'd suggest rethinking the approach if that were the case.

    >Why would anyone want to trust their password to any app OTHER than the

    OS
    >logon service?


    People do it all the time. Web app in IE with NT authentication is a good
    example. Also, running certain admin apps within a non-admin session queries
    for logon information as well.
    Again, due to the nature of what he mentioned earlier, I'd be inclined to
    advise a review of the aproach, but if that's what he needs, then so be it.

    What may be more appropriate in this scenario (especially since this app
    is dealing only with local accounts), is for him to use ADSI (or advapi)
    and look at the currently logged on user. He can then enumerate the user's
    group membership to see if the user belongs to an "approved" group, rather
    than having the user logon again within the application.

    -Rob

  11. #11
    Rob Teixeira Guest

    Re: Using Win NT User Name and Password for another App.


    "Michael \(michka\) Kaplan" <former_mvp@nospam.trigeminal.spamless.com> wrote:
    >Anyone with an app that does this should be taken out and shot.
    >


    I won't go that far, since I don't know the extent of his program's requirements.
    However...
    I find it highly suspect that one would need to logon to the OS, then logon
    *again* to the application (on the same computer, in the same session). In
    a typical corporate environment, this is definitely not the norm operating
    procedure, and I'd suggest rethinking the approach if that were the case.

    >Why would anyone want to trust their password to any app OTHER than the

    OS
    >logon service?


    People do it all the time. Web app in IE with NT authentication is a good
    example. Also, running certain admin apps within a non-admin session queries
    for logon information as well.
    Again, due to the nature of what he mentioned earlier, I'd be inclined to
    advise a review of the aproach, but if that's what he needs, then so be it.

    What may be more appropriate in this scenario (especially since this app
    is dealing only with local accounts), is for him to use ADSI (or advapi)
    and look at the currently logged on user. He can then enumerate the user's
    group membership to see if the user belongs to an "approved" group, rather
    than having the user logon again within the application.

    -Rob

  12. #12
    Juergen Thuemmler Guest

    Re: Using Win NT User Name and Password for another App.

    > I want to use the NT User Name and password for my application, so that all
    > users who have permission to use this NT machine will have access to the
    > appliaction, by entering thier NT user name and password in the applicaiton's
    > login screen.


    Why do you want to check the permission once again when it is
    checked already by Windows?

    Juergen.



  13. #13
    Juergen Thuemmler Guest

    Re: Using Win NT User Name and Password for another App.

    > I want to use the NT User Name and password for my application, so that all
    > users who have permission to use this NT machine will have access to the
    > appliaction, by entering thier NT user name and password in the applicaiton's
    > login screen.


    Why do you want to check the permission once again when it is
    checked already by Windows?

    Juergen.



  14. #14
    Michael \(michka\) Kaplan Guest

    Re: Using Win NT User Name and Password for another App.

    Anyone with an app that does this should be taken out and shot.

    Why would anyone want to trust their password to any app OTHER than the OS
    logon service?


    --
    MichKa

    Michael Kaplan
    (principal developer of the MSLU)
    Trigeminal Software, Inc. -- http://www.trigeminal.com/
    the book -- http://www.i18nWithVB.com/


    "Rob Teixeira" <RobTeixeira@@msn.com> wrote in message
    news:3c1518c0$1@147.208.176.211...
    >
    >
    > You can't retrieve a user's password, but you can authenticate the user by
    > using the LogonUser API function. This takes the user name and text

    password.
    > If the function succeeds, the password was correct.
    >
    > This can also be done to impersonate the user's credentials in order to

    access
    > resources and system objects. However, if this is your intent, i suggest
    > you do a search on Impersonation in the MSDN to learn some of the more

    intricate
    > details.
    >
    > -Rob
    >
    > "santosh" <sant99@hotmail.com> wrote:
    > >
    > >Hi !,
    > >
    > >Is there any way that I can use Win NT User Name and Password for my VB
    > >Application to login. eg.. like Win NT authentication for SQL server

    connection.
    > >
    > >I want to use the NT User Name and password for my application, so that

    > all
    > >users who have permission to use this NT machine will have access to the
    > >appliaction, by entering thier NT user name and password in the

    applicaiton's
    > >login screen.
    > >
    > >So that I don't have to create a User master in my application's database
    > >and create new users for the application from the application end.
    > >
    > >This machine is not connected to the network.
    > >
    > >
    > >Thanks
    > >
    > >Santosh

    >




  15. #15
    Michael \(michka\) Kaplan Guest

    Re: Using Win NT User Name and Password for another App.

    Anyone with an app that does this should be taken out and shot.

    Why would anyone want to trust their password to any app OTHER than the OS
    logon service?


    --
    MichKa

    Michael Kaplan
    (principal developer of the MSLU)
    Trigeminal Software, Inc. -- http://www.trigeminal.com/
    the book -- http://www.i18nWithVB.com/


    "Rob Teixeira" <RobTeixeira@@msn.com> wrote in message
    news:3c1518c0$1@147.208.176.211...
    >
    >
    > You can't retrieve a user's password, but you can authenticate the user by
    > using the LogonUser API function. This takes the user name and text

    password.
    > If the function succeeds, the password was correct.
    >
    > This can also be done to impersonate the user's credentials in order to

    access
    > resources and system objects. However, if this is your intent, i suggest
    > you do a search on Impersonation in the MSDN to learn some of the more

    intricate
    > details.
    >
    > -Rob
    >
    > "santosh" <sant99@hotmail.com> wrote:
    > >
    > >Hi !,
    > >
    > >Is there any way that I can use Win NT User Name and Password for my VB
    > >Application to login. eg.. like Win NT authentication for SQL server

    connection.
    > >
    > >I want to use the NT User Name and password for my application, so that

    > all
    > >users who have permission to use this NT machine will have access to the
    > >appliaction, by entering thier NT user name and password in the

    applicaiton's
    > >login screen.
    > >
    > >So that I don't have to create a User master in my application's database
    > >and create new users for the application from the application end.
    > >
    > >This machine is not connected to the network.
    > >
    > >
    > >Thanks
    > >
    > >Santosh

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center