Re: Authenticating Web user and domain User with ADAM



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
.



Relevant Pages

  • Re: Authenticating Web user and domain User with ADAM
    ... Whit this System.Web configuration of my web.config file I'm able to ... connect to My adam partition. ... classOBJ the name of the class to be used to create the entry ... string classObj, string pwd) ...
    (microsoft.public.windows.server.active_directory)
  • Re: ADAM and AuthorizationStoreRoleProvider
    ... ADAM roles to ADAM users only. ... // Global connection string, generic exception message, event ... foreach (string rolename in rolenames) ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Dynamic QueryString!
    ... > Hi Adam, ... > The function would be of type string and receive the dataitem as a string ... > Ken Dopierala Jr. ... >> I am wanting to url the HyperLink server control in a datagrid. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: AD/ADAM Create User (VB.Net)
    ... There are also a few ADAM specific things to do here. ... the application partition NC Name in your binding string in order for LDAP ... strUserPrincipalName) ... Dim firstname As String = "user" ...
    (microsoft.public.windows.server.active_directory)
  • Re: AD/ADAM Create User (VB.Net)
    ... I'm confused about Active Directory and ADAM - they appear to be ... the application partition NC Name in your binding string in order for LDAP ... strUserPrincipalName) ... Dim firstname As String = "user" ...
    (microsoft.public.windows.server.active_directory)