Re: ADAM authentication and set a user's login/password

From: Dmitri Gavrilov [MSFT] (dmitrig_at_online.microsoft.com)
Date: 09/03/04


Date: Thu, 2 Sep 2004 18:49:46 -0600

Method [1] is the correct approach. There's no samAccountName in ADAM, so
you have to use the full user DN.

Method [2] does not change the pwd, but it changes the credentials that are
used to talk to ADAM (Joe or Joe, correct me if I am wrong).

Method [3] will only work if you connect to AD.

-- 
Dmitri Gavrilov
SDE, Active Directory Core
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Yann" <kalykador@hotmail.com> wrote in message
news:a711af85.0409020854.5af3d728@posting.google.com...
> Hello,
>
> I work on ADAM for two months, so my knowledge on it is limited. I
> have built my schema and everything is working at this point.
>
> Now I want to set a password on one of my user account (toto for
> example).
> I tried several methods in C#, 3 in fact:
>
> [1]
> DirectoryEntry objUser = new DirectoryEntry("...."); //BIND ON MY USER
> OBJECT
> objUser.Invoke("SetOption", new
> object[]{ADS_OPTION_PASSWORD_PORTNUMBER, intPort});
> objUser.Invoke("SetOption", new
> object[]{ADS_OPTION_PASSWORD_METHOD,ADS_PASSWORD_ENCODE_CLEAR});
> objUser.Invoke("SetPassword", new object[]{"1234"});
>
> [2]
> objUser.Username = "toto";
> objUser.Password = "1234";
>
> [3]
> ActiveDs.IADsUser user1 = (ActiveDs.IADsUser)objUser.NativeObject;
> user1.SetPassword("YEEEEEEEELLLLLAAAAAA");
> objUser.CommitChanges();
>
> The last one doesn't works.
>
> The [2]  works (well I don't have any error when executing it), but
> where doesn't store it ? is ot the same password as in the [1] method.
> I really don't understand how it works.
>
> The [1] method also works (I don't have any error when executing it),
> but this time the username is not store with a SAMAccoutName like AD
> does, but we have to use the DN as a user name (e.g.
> CN=toto,OU=User,O=Annuaire)
>
> My question is, what should I use as method (1 or 2), which is the
> best and why.
>
>
===========================================================================
>
> Another thing
>
> I read the ADAM RevGuide_adam.DOC &#61672; Managing Authentication
> section
>
>
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=9688f8b9-1034-4ef6-a3e5-2a2a57b5c8e4
>
> It says in it how to change or set a password of a user using ADSI
> EDIT or ldp.
>
> I follow the steps; I created a password for my user using ldp, it
> worked properly. I try then to then test my user account for
> authentication. So I bind using this way:
>
> Login : DN (CN=toto,OU=User,O=Annuaire)
> Password : (the one I have just set using ldp)
>
>
> Method: simple
>
> It Works ! My ldp status display : "Authenticated as
> dn:'CN=toto,OU=User,O=Annuaire'."
>
> So Now I want to authenticate with C# functions, here is briefly my
> code:
>
> userDN =" CN=toto,OU=User,O=Annuaire "
> DirectoryEntry oAuthTest = new
> DirectoryEntry("LDAP://localhost:50000/" + userDN,
> userDN,"secret",AuthenticationTypes.None);
>
> So this is my bind, but it doesn't work. it says "Logon failure:
> unknown user name or bad password"
>
> I put my user in the readers group, and retry, here is my new error
> message
>
> Object reference not set to an instance of an object.
>
> The AuthenticationTypes are not very familiar with me, I need help on
> it. Anyone can help me and tell me what AuthenticationTypes I should
> use to bind to my user in my ADAM?
>
> It would help me a lot.
>
> By the way, I hope to be not so annoying with my text. I'd like to
> know who are ok to discuss about this and ADAM stuff on a mailing list
> or on a chat. Let me know
>
> TKS for reading this


Relevant Pages

  • Re: Query AD from DMZ via LDAP?
    ... You could use ADAM with passthrough authentication or bind proxy objects, ... Determining group memberships would be a bonus. ...
    (microsoft.public.windows.server.active_directory)
  • Re: adam bind-redirect
    ... You won't be able to do a proxy bind if you don't have the ... This will work only if ADAM ... >>> being authenticated (as in windows authentication or ... >> of the bind proxy object in the ADAM naming context and the Windows ...
    (microsoft.public.windows.server.active_directory)
  • Re: Random logon failure with ADAM Bind Proxy
    ... to the Readers role for an ADAM NC and it worked fine for binding ADAM ... In this thread the original poster is using bind proxies so it might be ... Readers role, he could add the Users role to the Readers role which would ... > Could he also just bind to RootDSE in order to force an authentication? ...
    (microsoft.public.windows.server.active_directory)
  • Re: adam bind-redirect
    ... could benefit from bind redirect/User Proxy Object ... The store for Azman will also be an ADAM. ... > They have there own SSO solution thats similar to forms authentication. ...
    (microsoft.public.windows.server.active_directory)
  • Re: adam bind-redirect
    ... a third party doing authentication) then the proxy-redirect isnt an option. ... could benefit from bind redirect/User Proxy Object ... >> Our Adam will have a user store where we put custom user attributes. ... > Integrated authentication gives you a Windows security context ...
    (microsoft.public.windows.server.active_directory)