用于ldap身份验证的Shibboleth idp配置

时间:2015-11-24 08:02:18

标签: java ldap shibboleth

我是shibboleth的新手,我正在尝试将LDAP与Shibboleth一起使用。我尝试了很多,但我无法实现。任何人都可以告诉我什么应该是AttributeDefinition,DataConnector和login.config为以下java代码工作正常。请帮忙

   Hashtable env = new Hashtable();
        String ldapSearchBase = "dc=samplehro,dc=india";
        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put("com.sun.jndi.ldap.read.timeout", "4000");
        env.put(Context.PROVIDER_URL, "ldap://smplchn-adsvr.samplehro.india");
        env.put(Context.SECURITY_AUTHENTICATION, "simple");
        env.put(Context.SECURITY_PRINCIPAL, username + "@samplehro.india");
        env.put(Context.SECURITY_CREDENTIALS, password);

1 个答案:

答案 0 :(得分:1)

接受的答案是仅链接的答案,并且链接无效,因此,实际上,这是一个从official Shibboleth documentation.复制示例的示例:

# Put in attribute-resolver.xml
<DataConnector id="myLDAP" xsi:type="LDAPDirectory"
    ldapURL="%{idp.attribute.resolver.LDAP.ldapURL}"
    baseDN="%{idp.attribute.resolver.LDAP.baseDN}"
    principal="%{idp.attribute.resolver.LDAP.bindDN}"
    principalCredential="%{idp.attribute.resolver.LDAP.bindDNCredential}"
    trustFile="%{idp.attribute.resolver.LDAP.trustCertificates}"
    useStartTLS="%{idp.attribute.resolver.LDAP.useStartTLS:true}"
    noResultIsError="%{idp.attribute.resolver.LDAP.noResultsIsError:false}"
    multipleResultsIsError="%{idp.attribute.resolver.LDAP.multipleResultsIsError:true}">
    <FilterTemplate>
        <![CDATA[
            %{idp.attribute.resolver.LDAP.searchFilter}
        ]]>
    </FilterTemplate>
    <LDAPProperty name="name1" value="%{idp.attribute.resolver.LDAP.prop1}"/>
    <LDAPProperty name="name2" value="%{idp.attribute.resolver.LDAP.prop2}"/>
    <StartTLSAuthenticationCredential xsi:type="security:X509Filesystem" xmlns:security="urn:mace:shibboleth:2.0:security" id="IdPtoLDAPCredential">
        <security:PrivateKey>%{idp.attribute.resolver.LDAP.authenticationKey}</security:PrivateKey>
        <security:Certificate>%{idp.attribute.resolver.LDAP.authenticationCertificate}</security:Certificate>
    </StartTLSAuthenticationCredential>
</DataConnector>