Knowledge is power. We love to share it.

News related to Mono products, services and latest developments in our community.

denis

MonoX Active Directory integration

02/21/2011Categories: MonoX

MonoX can be easily integrated with Active Directory for authorization and authentication tasks. In this scenario no user or role management takes place within the portal itself. Authentication is performed via Windows authentication and authorization is based on user membership in Active Directory groups. 

MonoX web.config comes with a predefined connection strings and configuration settings for ActiveDirectory role and membership providers. Note that by default Microsoft provides only ActiveDirectoryMembershipProvider which can provide authentication against AD stores. MonoX introduces custom ActiveDirectoryRoleProvider that is used to acquire all AD roles. AD roles have to be present in the portal database to assure that referential integrity constraints are satisfied. All role synchronization tasks are performed by the provider, without user’s intervention.

To turn the AD provider ON:

1. Put the AD server, username and password info in this tag:

<ActiveDirectoryConfiguration server="myserver.domain.name" username="MyUsername" password="MyPassword" />

2. Fill in the connection string information:

<add name="ADConnectionString" connectionString="LDAP://myserver.domain.name" />

The connection string to the Active Directory user store is in the following format:

LDAP:// server/userdn

Where:
server is the name (or IP address) of the server that is hosting the directory.
userdn is the distinguished name (DN) of the Active Directory user store. This consists of /CN=Users which is the user store container name, followed by the partition, which is derived from the fully qualified domain name.

For example, if your domain is called domain.testing.com, the connection string is LDAP://domain.testing.com/CN=Users,DC=domain,DC=testing,DC=com. Note that we have success with the strings that does not include the CS and DN parts: LDAP://domain.testing.com
More info: http://msdn.microsoft.com/en-us/library/ff648345.aspx

3. Uncomment the following section

<add name="ActiveDirectoryMembershipProvider" type="MonoSoftware.MonoX.ActiveDirectoryMembershipProvider" connectionStringName="ADConnectionString" attributeMapUsername="sAMAccountName" applicationName="MonoX" connectionUsername="MyUsername@mydomain" connectionPassword="MyPassword" />

and change the default membership provider:

<membership defaultProvider="ActiveDirectoryMembershipProvider" hashAlgorithmType="SHA1">

4. Uncomment the following section

<add applicationName="MonoX" name="ActiveDirectoryRoleProvider" type="MonoSoftware.MonoX.ActiveDirectoryRoleProvider" connectionStringName="ADConnectionString" groupMode="Additive" groupsToUse="" groupsToIgnore="" usersToIgnore=""  sqlConnectionStringName="" cacheTime="1800" domainName="domain.name" userName="MyUsername@mydomain" password="MyPassword" />

and change the default role provider:

<roleManager enabled="true" defaultProvider="ActiveDirectoryRoleProvider">

Note that you don’t have to change the authentication type – it still has the default value, “Forms”. Now when you go to the login screen, MonoX should contact the AD server and authenticate users against its store. All users roles will be visible in the admin panels for administration purposes, but they are NOT managed inside MonoX – everything is dynamically synchronized with the AD store.

Rated 4.00, 3 vote(s). 
By Richard
Could you possibly generate a dummy config file to compare e.g. using a domain of monoxexample.lan adn user auth account monoxservice@monoxexample.lan? I keep getting various errors when I try to enable AD auth and suspect it's because I am not putting in the necessary credentials from my AD where needed?
Current erros I'm seeing is this:

NullReferenceException: Object reference not set to an instance of an object.]
MonoSoftware.MonoX.ActiveDirectoryRoleProvider.GetRolesForUser(String username) +328

[ProviderException: Unable to query Active Directory.]
MonoSoftware.MonoX.ActiveDirectoryRoleProvider.GetRolesForUser(String username) +1003
System.Web.Security.RolePrincipal.IsInRole(String role) +242
System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal) +229
System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb) +354
System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb) +245
System.Web.UI.WebControls.WebParts.PersonalizationProvider.DetermineUserCapabilities(WebPartManager webPartManager) +566
System.Web.UI.WebControls.WebParts.WebPartPersonalization.Load() +111
System.Web.UI.WebControls.WebParts.WebPartPersonalization.LoadInternal() +36
System.Web.UI.Control.InitRecursive(Control namingContainer) +143
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1477
denis
Richard,
Please open a new topic in our support section, it will be easier to solve it there.
Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Unable to query Active Directory.

Source Error:


Line 464: password="pwd"
Line 465: /> -->
Line 466: <add applicationName="MonoX" name="ActiveDirectoryRoleProvider" type="MonoSoftware.MonoX.ActiveDirectoryRoleProvider" connectionStringName="ADConnectionString"
Line 467: groupMode="Additive" groupsToUse="" groupsToIgnore="" usersToIgnore="" sqlConnectionStringName="" cacheTime="1800"
Line 468: domainName="leightonint" userName="intranet" password="intranet" />

Source File: C:\inetpub\wwwroot\MonoX\web.config Line: 466
khorvat
Hi Neeraj,

can you please post the error with more details to our support forum so we can better track the issue there.

Thanks
neeraj
By neeraj
Hi khorvat

when I am doing the changes in web,config for MonoX Active Directory integration.

I follow allthe step that is guided by denis comments.

but in the place of rolemember provider I am getting this error
khorvat
As I mentioned in my previous post, please post the error with details to our support forum (http://www.mono-software.com/support/mono/).