Re: Authenticating Web user and domain User with ADAM
- From: CrisRC600 <crigon@xxxxxxxxx>
- Date: Tue, 8 Jul 2008 02:13:07 -0700 (PDT)
Hi Joe,
I think read your book will be anyway useful to upgrade my skill to
use ADAM.
I've some other question.
Whit this System.Web configuration of my web.config file I'm able to
connect to My adam partition.
<connectionStrings>
<add
connectionString="LDAP://wwsv.sisteminet.it:389/
OU=Users,O=SistemiWeb"
name="ActiveDirectory"/>
</connectionStrings>
[...]
<membership defaultProvider="ActiveDirectory">
<providers>
<add name="ActiveDirectory"
type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ActiveDirectory"
connectionUsername="CN=ADAMAdmin,OU=Users,O=SistemiWeb"
connectionPassword="myPassword"
connectionProtection="None"/>
</providers>
</membership>
I had to set the connection protection to "None" to avoid error
"Unable to establish secure connection with the server".
Now I can have my MembershipProvider simply whit this code:
MembershipProvider myMP = Membership.Provider;
because it is set to be the default provider.
Now the problem: the most of my users come from a SQL server, and I
had inserted them in my ADAM instance whit this code:
assume :
cod as the name of the object to be created.
par as a parent object (container)
classOBJ the name of the class to be used to create the entry
static DirectoryEntry createDE(string cod, DirectoryEntry par,
string classObj, string pwd)
{
DirectoryEntry DE;
string deNamPref = "";
string deName;
switch (classObj)
{
case "organization":
deNamPref = "O";
break;
case "organizationalUnit":
deNamPref = "OU";
break;
case "user":
deNamPref = "CN";
break;
}
deName = deNamPref + "=" + cod;
try
{
DE = (DirectoryEntry)par.Children.Find(deName,
classObj);
}
catch
{
DE = (DirectoryEntry)par.Children.Add(deName,
classObj);
DE.CommitChanges();
}
if (classObj == "user")
{
String strPwd = SQLCrypt.decrypt(pwd);
if (strPwd == "")
{
DE.Properties["msDS-UserAccountDisabled"].Value =
true;
}
else
{
DE.Properties["msDS-UserAccountDisabled"].Value =
false;
DE.Options.PasswordPort = 389;
DE.Options.PasswordEncoding =
PasswordEncodingMethod.PasswordEncodingClear;
DE.Invoke("setPassword", new object[] { strPwd });
}
}
DE.CommitChanges();
return DE;
}
}
I know this cannot be considered the best code to create Directory
Entry, but I need to save time. :-(
How can I authenticate the user just created in my adam partition ?
what userName format I hve to use?
consider that every entry is inside a OrganizationalUnit.
so, for instance, How can I authenticate the user who has DN "
CN=tania, OU=41847, OU=Users, O=SistemiWeb"
thanks for all your help!!
bye
Cris
.
- References:
- Authenticating Web user and domain User with ADAM
- From: CrisRC600
- Re: Authenticating Web user and domain User with ADAM
- From: Joe Kaplan
- Re: Authenticating Web user and domain User with ADAM
- From: CrisRC600
- Re: Authenticating Web user and domain User with ADAM
- From: Joe Kaplan
- Authenticating Web user and domain User with ADAM
- Prev by Date: Failure login to domain or losing domain membership
- Next by Date: Re: Authenticating Web user and domain User with ADAM
- Previous by thread: Re: Authenticating Web user and domain User with ADAM
- Next by thread: Re: Authenticating Web user and domain User with ADAM
- Index(es):
Relevant Pages
|