accesing AD from an ASP.NET app when user has been authenticated via AD cert. mapping

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default accesing AD from an ASP.NET app when user has been authenticated via AD cert. mapping


    hello forum!

    I am developing an ASP.NET web application which interacts with AD.
    Client/User authentication must be via AD certificate mapping, so I
    have configured IIS to do UPN mapping:
    -- In the IIS manager ...
    -- in the properties of the web site...
    -- under "directory security"..
    -- under "Secure Communications", select Edit.
    -- select "Require secure channel"; select "require client
    certificates" and also select "Enable client certificate mapping".

    I think the mapping is done ok, because when I get the current user by
    using Context.User.Identity.Name or WindowsIdentity.GetCurrent().Name
    the result is the user who is the owner of the certificate used to do
    the client authentication. So, I suppose the web application is running
    under the user account credentials.

    The problem is that i can not access AD via ADSI (using .NET
    DirectoryServices API). I get an operational error related with
    authentication.

    The source code of the DirectoryEntry creation is something like this:
    DirectoryEntry oDE = new
    DirectoryEntry("LDAP://"+[servername]+":"+[serverport]+"/",null,null,AuthenticationTypes.Secure);

    The description of the AuthenticationTypes.Secure flag says that "it
    requests secure authentication. When the user name and password are a
    null reference, ADSI binds to the object using the security context of
    the calling thread, which is either the security context of the user
    account under which the application is running or of the client user
    account that the calling thread is impersonating".

    The web application is running under an user account which has got the
    required permissions to do the operation, but AD server must not permit
    to do the operation.

    I am sure that user account has got the suitable permissions becasue if
    I enable anonymous access in IIS and I use the user account for the
    anonymous access, AD server permits to do the operations..

    Any idea? What could be the problem? could be the authentication type?
    problems related with impersonation? I am a bit lost...

    Thanks is advance! ...and sorry for my poor english ;)



    --
    ElSerji
    ------------------------------------------------------------------------
    Posted via [url]http://www.codecomments.com[/url]
    ------------------------------------------------------------------------

    ElSerji Guest

  2. Similar Questions and Discussions

    1. problem accesing Active Directory from an ASP.NET App when user has been authenticated via AD certificate mapping
      hello, I am developing an ASP.NET web application which interacts withAD. Client/User authentication must be done via AD certificatemapping, so I...
    2. How to allow authenticated user to impersonate
      If you are running under W2000, you must add the "Act as part of the operating system" privilege to the account that will try to impersonate. On XP...
    3. Can I force 401 error when user not authenticated?
      Currently I have succesfully implemented role-based folder security using roles and web.config in each folder. This works great - if a user is not...
    4. impersonating windows authenticated user?
      I have a asp.net web application that i wrote for internal use in my company. The problem i'm having is being able to test the application as other...
    5. Terminating a authenticated user
      Hi, 1. How can I "terminate" an authenticated user? (I would like the server to redirect the user to the login page again. I'm using "forms...
  3. #2

    Default Re: accesing AD from an ASP.NET app when user has been authenticated via AD cert. mapping

    I just tried to answer a similar question 2 or 3 days ago.

    In order for your credentials that were authenticated via SSL to "hop" to
    the Active Directory server, you will need to implement Kerberos delegation.
    However, given that you were authenticated by the Schannel SSP and not
    Kerberos initially, I think you will also need a Kerberos ticket to make
    this work. That probably means you need Kerberos Protocol Transition which
    implies the need for both Windows 2003 server and 2003 Native mode Active
    Directory.

    I'm not sure about the latter part, but I don't see how Kerberos delegation
    can work here without a Kerberos ticket. Perhaps someone from MS or someone
    more deeply versed in Schannel authentication can help.

    Your S.DS code is just fine though. That is how you should set it.

    Joe K.

    "ElSerji" <ElSerji.1n6adq@mail.codecomments.com> wrote in message
    news:ElSerji.1n6adq@mail.codecomments.com...
    >
    > hello forum!
    >
    > I am developing an ASP.NET web application which interacts with AD.
    > Client/User authentication must be via AD certificate mapping, so I
    > have configured IIS to do UPN mapping:
    > -- In the IIS manager ...
    > -- in the properties of the web site...
    > -- under "directory security"..
    > -- under "Secure Communications", select Edit.
    > -- select "Require secure channel"; select "require client
    > certificates" and also select "Enable client certificate mapping".
    >
    > I think the mapping is done ok, because when I get the current user by
    > using Context.User.Identity.Name or WindowsIdentity.GetCurrent().Name
    > the result is the user who is the owner of the certificate used to do
    > the client authentication. So, I suppose the web application is running
    > under the user account credentials.
    >
    > The problem is that i can not access AD via ADSI (using .NET
    > DirectoryServices API). I get an operational error related with
    > authentication.
    >
    > The source code of the DirectoryEntry creation is something like this:
    > DirectoryEntry oDE = new
    > DirectoryEntry("LDAP://"+[servername]+":"+[serverport]+"/",null,null,AuthenticationTypes.Secure);
    >
    > The description of the AuthenticationTypes.Secure flag says that "it
    > requests secure authentication. When the user name and password are a
    > null reference, ADSI binds to the object using the security context of
    > the calling thread, which is either the security context of the user
    > account under which the application is running or of the client user
    > account that the calling thread is impersonating".
    >
    > The web application is running under an user account which has got the
    > required permissions to do the operation, but AD server must not permit
    > to do the operation.
    >
    > I am sure that user account has got the suitable permissions becasue if
    > I enable anonymous access in IIS and I use the user account for the
    > anonymous access, AD server permits to do the operations..
    >
    > Any idea? What could be the problem? could be the authentication type?
    > problems related with impersonation? I am a bit lost...
    >
    > Thanks is advance! ...and sorry for my poor english ;)
    >
    >
    >
    > --
    > ElSerji
    > ------------------------------------------------------------------------
    > Posted via [url]http://www.codecomments.com[/url]
    > ------------------------------------------------------------------------
    >

    Joe Kaplan \(MVP - ADSI\) Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139