将WSO2 Identity Server默认架构导入OpenLDAP

时间:2016-05-09 08:13:11

标签: wso2 openldap apacheds

我正在尝试将OpenLDAP设置为主用户存储的WSO2标识服务器。我想将Idp嵌入式ApacheDS架构':wso2Person,identityPerson和scimPerson添加到OpenLDAP,但我既不能导入架构也不能导入wso2Person,identityPerson和scimPerson ldif文件。

您能举例说明如何实现这一目标吗?

我正在尝试使用ApacheDS Studio或其他LDAP客户端将文件导入Ubuntu Server 16 LTS上的新OpenLDAP,但每次尝试导入文件时都会引发错误。

I.E。:启动

sudo ldapadd -Q -Y EXTERNAL -H ldapi:/// -f ou\=schema.ldif

服务器响应:

  

服务器不愿意执行(53)没有全球优越的知识

或者,尝试导入wso2Person.ldif

ldapadd -D ldap:/// -D "cn=admin,dc=example,dc=org" -x -W -f wso2Person.ldif

抛出以下错误:

  

语法无效(21)其他信息:attributeTypes:每个语法的值#0无效

2 个答案:

答案 0 :(得分:0)

没有必要使用wso2Person架构。您可以使用外部ldap支持的任何模式(例如:inetOrgPerson)。您只需要在openldap架构中为具有现有属性的属性执行声明映射。您可以在“http://wso2.org/claims”下的configure->声明管理标签中找到此声明。您可以使用ldap服务器中的现有属性编辑每个属性的声明映射[1]。例如:第一个名称映射到主用户存储中的属性“givenName”。 Openldap还支持“givenName”属性类型。所以你不必改变那些属性。但是,如果没有将正确的对象类添加到用户组,则在主用户存储中映射到“sn”的“Last Name”等少数属性不在默认的openldap中。例如,我使用“displayName”作为辅助用户存储的映射属性。您可以在附加图像claims.png(其中NEWTEST是第二个用户商店名称)中查看如何编辑声明,以便添加声明映射。因此,您必须将这些属性映射到openldap架构中的现有属性。

[1] - https://docs.wso2.com/display/IS500/Editing+Claim+Dialects

答案 1 :(得分:0)

首先:如果您在Ubuntu 16.04上使用默认的OpenLdap配置,则必须使用来自服务器root帐户的本地工具。例如:

root@OpenLdap1:ldapadd -Y EXTERNAL -H ldapi:/// -f identityPerson.ldif

您可以看到cn = config的访问列表是:

# {0}config, config
dn: olcDatabase={0}config,cn=config
objectClass: olcDatabaseConfig
olcDatabase: {0}config
olcAccess: {0}to * by dn.exact=gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth manage by * break

第二:你必须修改由wso2给出的ldif文件。在OpenLdap模式中,表示为单独的LDAP对象,因此您必须创建新条目而不是对象修改。语法也有一个区别 - 你应该用olcAttributeTypes替换attributeTypes,用olcobjectClasses替换objectClasses。你的wso2Person.ldif看起来像:

dn: cn=wso2Person,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: wso2Person
olcAttributeTypes: ( 1.3.6.1.4.1.37505.1.2
    NAME 'gender'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )
....
olcAttributeTypes: ( 1.3.6.1.4.1.37505.1.13
    NAME 'prefferedLanguage'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024} )
olcobjectClasses: ( 1.3.6.1.4.1.37505.1.1
    NAME 'wso2Person'
    DESC 'wso2Person'
    SUP inetOrgPerson
    STRUCTURAL
    MAY  ( gender $ country $ nickName $ timeZone $ dateOfBirth $ role $ im $ url $ otherPhone $ privatePersonalIdentifier $ profileconfiguration $ prefferedLanguage) 
)

此外,wso2类具有结构依赖性,因此它们的添加顺序很重要:

ldapadd -Y EXTERNAL -H ldapi:/// -f wso2Person.ldif 
ldapadd -Y EXTERNAL -H ldapi:/// -f scimPerson.ldif 
ldapadd -Y EXTERNAL -H ldapi:/// -f identityPerson.ldif