如何将shibboleth idp连接到mysql而不是LDAP服务器?

时间:2018-11-13 06:30:44

标签: shibboleth

我正在尝试在Windows计算机中安装shibboleth IDP和SP。我的目标是使用mysql而不是LDAP。找不到任何相关来源。请帮忙!

1 个答案:

答案 0 :(得分:1)

如果您询问如何配置Shibboleth IdP以提供从MySQL来源派生的属性,则可以使用<DataConnector>元素。以下示例在shibboleth连接到数据库mysqldb.example.com,并定义属性sn

# In the file attribute-resolver.xml (version 3.3 of Shibboleth Idp)
<AttributeDefinition 
   xmlns="urn:mace:shibboleth:2.0:resolver:ad"
   xsi:type="Simple" id="sn" sourceAttributeID="sn">
  <Dependency ref="mysqlconnector" />
  <AttributeEncoder xsi:type="SAML2String" 
     xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
     name="urn:oid:2.5.4.4" friendlyName="sn" />
</AttributeDefinition>

<DataConnector id="mysqlconnector" xsi:type="RelationalDatabase">
  <ApplicationManagedConnection
     jdbcDriver="com.mysql.jdbc.Driver"
     jdbcURL="jdbc:mysql://mysqldb.example.com/shibboleth"
     jdbcUserName="username"
     jdbcPassword="password" />
  <QueryTemplate>
    <![CDATA[
      SELECT sn
      FROM users
      WHERE userid='$resolutionContext.principal'
     ]]>
  </QueryTemplate>
</DataConnector>

请注意,以上内容适用于Shibboleth Idp版本3.3;有关更多信息,请参见the Shibboleth RelationalDatabaseConnector documentation