Configuring the K2 LDAP User Manager
This topic lists and describes LDAP settings, which are used to configure the K2 LDAP user manager. A sample script at the end of the topic can be edited for your environment and used to configure your K2 LDAP user manager.
There are many available settings mainly due to the nature of LDAP and its various implementations. Each user directory implements different methodologies, and, for example, very few AD-based LDAP queries work on Novell. Once you understand these settings, you should be able to make K2 work with your user directory.
LDAP Setting | Description |
---|---|
LdapConnection |
|
LdapUserSearchFormatString | This is the LDAP query used to search for users. It should include a placeholder “{0}” for where the user's ID should be inserted. Don’t include any wildcards, as these are handled automatically. As this is in XML, any reserved XML characters (e.g. &) should be escaped. For example:
(&(objectClass=Person)(objectCategory=User)(samAccountName={0}) |
LdapUserGroupSearchFormatString | This is the LDAP query used to search for users that belong to a specific group. It should include a placeholder “{0}” for where the group’s ID should be inserted. Don’t include any wildcards, as these are handled automatically. As this is in XML, any reserved XML characters (e.g. &) should be escaped. For example, to return users from this specific group and all nested groups:
(memberOf :1.2.840.113556.1.4.1941:={0}) For more information see Search Filter Syntax (MSDN). |
LdapGroupSearchFormatString | This is the LDAP query used to search for groups. It should include a placeholder “{0}” for where the user’s ID should be inserted. Don’t include any wildcards, as these are handled automatically. As this is in XML, any reserved XML characters (e.g. &) should be escaped. For example:
(&(objectCategory=Group)(samAccountName={0})) |
LdapGroupMemberSearchFormatString | This is the LDAP query used to search for groups of which the user is a member. It should include a placeholder “{0}” for where the user’s ID should be inserted. Don’t include any wildcards, as these are handled automatically. As this is in XML, any reserved XML characters (e.g. &) should be escaped. For example, to return groups and all nested groups of which the user is a member: (member:1.2.840.113556.1.4.1941:={0}) For more information see Search Filter Syntax (MSDN). |
LdapUserBaseObject | This is the LDAP base object from which all user searches are made. Make sure that this correlates correctly to your LdapScope setting above. This setting is similar to the userContainer setting in the SharePoint configuration. For example:
dc=denallix,dc=com |
LdapGroupBaseObject | This is the LDAP base object from which all group searches are made. Make sure that this correlates correctly to your LdapScope setting above. This setting is like the groupContainer setting in the SharePoint configuration. For example:
dc=denallix,dc=com |
LdapUserAttributes | The following is the set of attributes that are used in your directory. The available settings for each attribute are:
|
LdapGroupAttributes | As above, except these attributes would be the ones returned for groups. |
The K2LDAP label will be visible in K2 where labels normally appear such as Management Console in K2 Workspace.
The following example is for the fictitious Denallix.com domain and is inserted into the SecurityLabels table of the K2 database. You must change some of the values below to match your environment. This is the same XML that is included in the downloadable script file.
<LdapConnection
LdapServer="dlx.denallix.com"
LdapServerPort="389"
LdapSsl="false"
LdapAuthTypeConnect="Negotiate"
LdapAuthTypeAuthenticateUser="Negotiate"
LdapResolveAuthenticationUserToDistinguishedName="false"
LdapAutoBind="false"
LdapScope="Subtree"
LdapConnectIntegrated="true"
LdapConnectUserName=""
LdapConnectUserPassword=""
LdapTimeout="0"
LdapProtocolVersion="3"
LdapServerCertificatePath="" />
<LdapUserBaseObject>dc=denallix,dc=com</LdapUserBaseObject>
<LdapUserSearchFormatString>(&(objectClass=Person)(objectCategory=User)(samAccountName={0}))</LdapUserSearchFormatString>
<LdapUserGroupSearchFormatString>(memberOf:1.2.840.113556.1.4.1941:={0})</LdapUserGroupSearchFormatString>
<LdapUserAttributes>
<K2LdapMapping K2Name="ID" LdapName="samAccountName" ObjectType="System.String" />
<K2LdapMapping K2Name="Name" LdapName="samAccountName" ObjectType="System.String" />
<K2LdapMapping K2Name="Description" Multiline="true" LdapName="description" ObjectType="System.String" />
<K2LdapMapping K2Name="Email" LdapName="mail" ObjectType="System.String" />
<K2LdapMapping K2Name="DistinguishedName" LdapName="distinguishedName" ObjectType="System.String" />
<K2LdapMapping K2Name="ObjectSID" FullOnly="true" LdapName="objectSID" ObjectType="System.String" />
<K2LdapMapping K2Name="CommonName" LdapName="cn" ObjectType="System.String" />
<K2LdapMapping K2Name="UserPrincipalName" LdapName="userPrincipalName" ObjectType="System.String" />
<K2LdapMapping K2Name="Manager" FullOnly="true" LdapName="manager" ObjectType="System.String" SearchQuery="(&(objectClass=Person)(objectCategory=User))" SearchResultProperty="samAccountName" />
<K2LdapMapping K2Name="SipAccount" LdapName="msRTCSIP-PrimaryUserAddress" ObjectType="System.String" />
<K2LdapMapping K2Name="DisplayName" LdapName="displayName" ObjectType="System.String" />
<K2LdapMapping K2Name="TelephoneNumber" LdapName="telephoneNumber" ObjectType="System.String" />
<K2LdapMapping K2Name="Mobile" LdapName="mobile" ObjectType="System.String" />
<K2LdapMapping K2Name="HomePage" LdapName="wWWHomePage" ObjectType="System.String" />
<K2LdapMapping K2Name="FaxNumber" LdapName="facsimileTelephoneNumber" ObjectType="System.String" />
<K2LdapMapping K2Name="HomePhone" LdapName="homePhone" ObjectType="System.String" />
<K2LdapMapping K2Name="IPPhone" LdapName="ipPhone" ObjectType="System.String" />
<K2LdapMapping K2Name="StreetAddress" LdapName="streetAddress" ObjectType="System.String" />
<K2LdapMapping K2Name="City" LdapName="l" ObjectType="System.String" />
<K2LdapMapping K2Name="Country" LdapName="c" ObjectType="System.String" />
<K2LdapMapping K2Name="State" LdapName="st" ObjectType="System.String" />
<K2LdapMapping K2Name="Title" LdapName="title" ObjectType="System.String" />
<K2LdapMapping K2Name="Department" LdapName="department" ObjectType="System.String" />
<K2LdapMapping K2Name="Company" LdapName="company" ObjectType="System.String" />
<K2LdapMapping K2Name="Office" LdapName="physicalDeliveryOfficeName" ObjectType="System.String" />
<K2LdapMapping K2Name="ManagedUsers" FullOnly="true" LdapName="managedUsers" SearchQuery="(&(objectClass=Person)(objectCategory=User))" SearchResultProperty="samAccountName" ObjectType="System.Collections.ArrayList" />
<K2LdapMapping K2Name="Groups" FullOnly="true" LdapName="memberOf" SearchQuery="(objectCategory=Group)" SearchResultProperty="samAccountName" ObjectType="System.Collections.ArrayList" />
</LdapUserAttributes>
<LdapGroupBaseObject>dc=denallix,dc=com</LdapGroupBaseObject>
<LdapGroupSearchFormatString>(&(objectCategory=Group)(samAccountName={0}))</LdapGroupSearchFormatString>
<LdapGroupMemberSearchFormatString>(member:1.2.840.113556.1.4.1941:={0})</LdapGroupMemberSearchFormatString>
<LdapGroupAttributes>
<K2LdapMapping K2Name="ID" LdapName="samAccountName" ObjectType="System.String" />
<K2LdapMapping K2Name="Name" LdapName="cn" ObjectType="System.String" />
<K2LdapMapping K2Name="Description" Multiline="true" LdapName="description" ObjectType="System.String" />
<K2LdapMapping K2Name="Email" LdapName="mail" ObjectType="System.String" />
<K2LdapMapping K2Name="DistinguishedName" LdapName="distinguishedName" FullOnly="true" ObjectType="System.String" />
<K2LdapMapping K2Name="ObjectSID" LdapName="objectSID" FullOnly="true" ObjectType="System.String" />
<K2LdapMapping K2Name="Member" LdapName="member" FullOnly="true" SearchQuery="(&(objectClass=Person)(objectCategory=User))" SearchResultProperty="samAccountName" ObjectType="System.Collections.ArrayList" />
</LdapGroupAttributes>
</AuthInit>
DECLARE @SecurityLabelID UNIQUEIDENTIFIER = NEWID(); --Assigning new GUID
DECLARE @AuthSecurityProviderID UNIQUEIDENTIFIER = NEWID(); --Assigning new GUID
DECLARE @AuthInit XML = @XmlConfig;
DECLARE @RoleSecurityProviderID UNIQUEIDENTIFIER = @AuthSecurityProviderID;
DECLARE @RoleInit XML = @XmlConfig;
DECLARE @DefaultLabel BIT = NULL; --1 = true, NULL and 0 = false
DECLARE @ProviderClassName NVARCHAR(200) = 'SourceCode.Security.Providers.LdapProvider.Trusted.Ldap';
DECLARE @SPProviderID UNIQUEIDENTIFIER;
-- UPDATE TABLES
DELETE FROM [HostServer].[SecurityProvider] WHERE ProviderClassName = @ProviderClassName;
DELETE FROM [HostServer].[SecurityLabel] WHERE SecurityLabelName = @SecurityLabelName;
INSERT INTO [HostServer].[SecurityProvider] VALUES (@AuthSecurityProviderID, @ProviderClassName);
INSERT INTO [HostServer].[SecurityLabel] VALUES (@SecurityLabelID, @SecurityLabelName, @AuthSecurityProviderID, @AuthInit, @RoleSecurityProviderID, @RoleInit, @DefaultLabel);
SELECT @SPProviderID = [SecurityProviderId] FROM [HostServer].[SecurityProvider] WHERE [ProviderClassName] = N'SourceCode.Security.Providers.SharePoint.SharePointProvider';
IF NOT EXISTS (SELECT 1 FROM [HostServer].[GroupProvider] WHERE [SecurityLabelID] = @SecurityLabelID)
BEGIN
INSERT INTO [HostServer].[GroupProvider]
(
[GroupProviderID]
,[SecurityLabelID]
,[SecurityProviderID]
,[Name]
,[Init]
)
VALUES
(
NEWID()
,@SecurityLabelID
,@SPProviderID
,'*'
,'<init><label name="SP" /></init>'
)
END
To register the LDAP User Manager, the SecurityLabels table in the database must be modified. This table stores the security label, security provider and authorization / role initialization data for the user manager. The K2 User Manager sample scripts available for download allow you to add or remove a LDAP User Manager. Be sure to edit the scripts to fit your configuration before executing them. Follow the steps below to add the LDAP User Manager.
- Download and extract the K2 User Manager sample scripts.
- Open the K2 LDAP User Manager (Forms - Setup).sql script and edit it for your environment.
- Execute the K2 LDAP User Manager (Forms - Setup).sql script from Microsoft SQL Server Management Studio against the K2 database.
- Refresh the User Manager Cache.
- Restart the K2 blackpearl Server service.
The example scripts contain references to the DLX SQL instance, the K2HostServer database and the Denallix.com domain. Please edit the .sql files to replace these values before executing.