हम अपने आवेदन में एलडीएपी से उपयोगकर्ताओं को प्रमाणीकृत करने के लिए वसंत सुरक्षा का उपयोग कर रहे हैं। प्रमाणीकरण भाग ठीक से काम कर रहा है लेकिन प्राधिकरण भाग काम नहीं कर रहा है।वसंत सुरक्षा का उपयोग कर सक्रिय निर्देशिका एलडीएपी से एलडीएपी अधिकारियों को कैसे पॉप्युलेट करना है?
हम एलडीएपी से उपयोगकर्ता की भूमिकाओं को पुनः प्राप्त करने में सक्षम नहीं हैं।
पुस्तक "स्प्रिंग सुरक्षा 3"पीटर Mularien
द्वारा प्रदर्शित होने वाली "इसका कारण यह है पर गुण प्रयोक्ताओं की एलडीएपी प्रविष्टियों खुद को। के रूप में सक्रिय निर्देशिका भंडार समूह सदस्यता बॉक्स से बाहर (के रूप में प्रकाशन का समय), वसंत सुरक्षा एक LdapAuthoritiesPopulator प्रदान नहीं करती है जो हो सकती है जो एक सामान्य सक्रिय निर्देशिका एलडीएपी पेड़ की संरचना का समर्थन करने के लिए कॉन्फ़िगर किया गया है। "
नीचे मेरी वसंत-सुरक्षा कॉन्फ़िगरेशन फ़ाइल है।
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<http use-expressions="true" >
<intercept-url pattern="/resources/**" filters="none" />
<intercept-url pattern="/login" access="permitAll"/>
<intercept-url pattern="/**" access="isAuthenticated()" />
<form-login login-page="/login"
default-target-url="/home"
always-use-default-target="true"
authentication-failure-url="/login?login_error=1" />
<logout invalidate-session="true"
logout-success-url="/"
logout-url="/logout"/>
</http>
<authentication-manager alias="ldapAuthenticationManager">
<authentication-provider ref="ldapAuthenticationProvider"/>
</authentication-manager>
<beans:bean id="ldapAuthenticationProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
<beans:constructor-arg ref="ldapBindAuthenticator"/>
<beans:constructor-arg ref="ldapAuthoritiesPopulator"/>
<beans:property name="userDetailsContextMapper" ref="ldapUserDetailsContextMapper"/>
</beans:bean>
<beans:bean id="ldapServer" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
<!-- MS Active Directory -->
<beans:constructor-arg value="ldap://localhost:389/dc=myOrg,dc=net"/>
<beans:property name="userDn" value="admin"/>
<beans:property name="password" value="admin"/>
<beans:property name="baseEnvironmentProperties">
<beans:map>
<beans:entry key="java.naming.referral" value="follow" />
</beans:map>
</beans:property>
</beans:bean>
<beans:bean id="ldapBindAuthenticator" class="org.springframework.security.ldap.authentication.BindAuthenticator">
<beans:constructor-arg ref="ldapServer"/>
<beans:property name="userSearch" ref="ldapSearchBean"/>
</beans:bean>
<beans:bean id="ldapSearchBean" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
<!-- MS Active Directory -->
<!-- user-search-base; relative to base of configured context source -->
<beans:constructor-arg value="ou=Software OU"/>
<!-- user-search-filter -->
<beans:constructor-arg value="(sAMAccountName={0})"/>
<beans:constructor-arg ref="ldapServer"/>
</beans:bean>
<beans:bean id="ldapAuthoritiesPopulator" class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
<beans:constructor-arg ref="ldapServer" />
<beans:constructor-arg value="" />
<beans:property name="groupSearchFilter" value="(sAMAccountName={0})"/>
<beans:property name="groupRoleAttribute" value="memberOf" />
<beans:property name="rolePrefix" value=""/>
<beans:property name="searchSubtree" value="true"/>
<beans:property name="convertToUpperCase" value="false"/>
<beans:property name="ignorePartialResultException" value="true"/>
</beans:bean>
<beans:bean class="org.springframework.security.ldap.userdetails.InetOrgPersonContextMapper" id="ldapUserDetailsContextMapper"/>
</beans:beans>
कृपया मदद करें।
आपके कोड में क्या गुम था? प्रदत्त समाधान/हाइपरलिंक को स्वीकार करना एक बात है, लेकिन लापता भाग को इंगित करना दूसरों की तरह (मेरे जैसे) को एक ही समस्या रखने में मदद करने के लिए बहुत अच्छा होगा। अपना विस्तृत समाधान साझा करने के लिए धन्यवाद। –
@ चार्ल्समोरीन मुझे एहसास हुआ कि मेरा जवाब उप-पैरा था, क्षमा करें। एडी के लिए हमारी स्प्रिंग कॉन्फ़िगरेशन जोड़ा गया। –
@ मार्सेलस्टोर धन्यवाद। आप किस एप्लिकेशन सर्वर का उपयोग कर रहे हैं? मैं बिना किसी सफलता के जेबॉस एएस 7.2 पर काम करने की कोशिश कर रहा हूं। आपकी कॉन्फ़िगरेशन पर एक नज़र डालेंगे। –