Code based Integrated Windows Authentication

Discussion in 'ASP .Net Web Services' started by RTJudson, Nov 8, 2005.

  1. RTJudson

    RTJudson Guest

    Hi All!

    Windows 2003
    IIS6

    Forgive a newbie. I am new to C#, mostly worked with perl (please, no gasps
    of horror or derision!).

    I have to applications that I need to integrate. One is a IIS6 based
    WebServices app, the other, well, not. I was going to build an interface
    between the two. I have the, call it App A -> App B part working fine. App B
    being the non-webservices app.

    App B -> App A requires Windows Integrated authentication. Not forms based
    or basic or digest. Almost all the examples discussed in books etc all
    discuss forms based.

    I'd like to do two things: 1) pass user/pwd info to the web services app
    and/or 2) pass currently logged in user info to the web services app using a
    ..net command line program.

    I've got some code that will return the token from the AD network:

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Security.Permissions;
    using System.Security.Principal;
    using System.Threading;

    namespace USPSD
    {
    class Program
    {
    static void Main(string[] args)
    {

    AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
    WindowsPrincipal principal =
    (WindowsPrincipal)Thread.CurrentPrincipal;
    WindowsIdentity identity = (WindowsIdentity)principal.Identity;
    Console.WriteLine("Authenticated: " + identity.IsAuthenticated);
    Console.WriteLine("Anonymous: " + identity.IsAnonymous);
    Console.WriteLine("Token: " + identity.Token);
    }
    }
    }

    Does anyone have a code snippet to share that discusses how to do
    authentication with a console app?

    I'm using C# 2005 Express Edition by the way.

    Thanks in Advance!
    --Richard
     
    RTJudson, Nov 8, 2005
    #1
    1. Advertising

  2. RTJudson

    RTJudson Guest

    Ok. After a little more research it appears I need to use some code out of
    the System.Web.Security namespace to pass my credientials over the network.
    Is my assumption correct?

    "RTJudson" wrote:

    > Hi All!
    >
    > Windows 2003
    > IIS6
    >
    > Forgive a newbie. I am new to C#, mostly worked with perl (please, no gasps
    > of horror or derision!).
    >
    > I have to applications that I need to integrate. One is a IIS6 based
    > WebServices app, the other, well, not. I was going to build an interface
    > between the two. I have the, call it App A -> App B part working fine. App B
    > being the non-webservices app.
    >
    > App B -> App A requires Windows Integrated authentication. Not forms based
    > or basic or digest. Almost all the examples discussed in books etc all
    > discuss forms based.
    >
    > I'd like to do two things: 1) pass user/pwd info to the web services app
    > and/or 2) pass currently logged in user info to the web services app using a
    > .net command line program.
    >
    > I've got some code that will return the token from the AD network:
    >
    > using System;
    > using System.Collections.Generic;
    > using System.Text;
    > using System.Security.Permissions;
    > using System.Security.Principal;
    > using System.Threading;
    >
    > namespace USPSD
    > {
    > class Program
    > {
    > static void Main(string[] args)
    > {
    >
    > AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
    > WindowsPrincipal principal =
    > (WindowsPrincipal)Thread.CurrentPrincipal;
    > WindowsIdentity identity = (WindowsIdentity)principal.Identity;
    > Console.WriteLine("Authenticated: " + identity.IsAuthenticated);
    > Console.WriteLine("Anonymous: " + identity.IsAnonymous);
    > Console.WriteLine("Token: " + identity.Token);
    > }
    > }
    > }
    >
    > Does anyone have a code snippet to share that discusses how to do
    > authentication with a console app?
    >
    > I'm using C# 2005 Express Edition by the way.
    >
    > Thanks in Advance!
    > --Richard
     
    RTJudson, Nov 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    0
    Views:
    705
  2. Andrew
    Replies:
    4
    Views:
    556
    Marty U.
    Jun 23, 2004
  3. ruca
    Replies:
    1
    Views:
    2,327
  4. Brett Smith
    Replies:
    2
    Views:
    471
    Brett Smith
    Oct 26, 2004
  5. Will
    Replies:
    5
    Views:
    2,683
Loading...

Share This Page