मुझे कई समान प्रश्न मिले लेकिन किसी ने भी मेरी समस्या हल नहीं की है। मेरी समस्या ROLE_USER
ROLE_ADMIN
@ प्रेरणा प्राधिकृत वसंत सुरक्षा
मेरे वसंत-सुरक्षा.एक्सएमएल कोड का पालन कर रहा है।
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:s="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<s:http auto-config="true" use-expressions="true">
<s:intercept-url pattern="/index.jsp" access="permitAll" />
<s:intercept-url pattern="/welcome*" access="hasRole('ROLE_USER')" />
<s:intercept-url pattern="/helloadmin*" access="hasRole('ROLE_ADMIN')" />
<s:form-login login-page="/login" default-target-url="/welcome"
authentication-failure-url="/loginfailed" />
<s:logout logout-success-url="/logout" />
</s:http>
<s:authentication-manager>
<s:authentication-provider>
<s:user-service>
<s:user name="asif" password="123456" authorities="ROLE_USER,ROLE_ADMIN" />
<s:user name="raheel" password="123456" authorities="ROLE_USER" />
</s:user-service>
</s:authentication-provider>
</s:authentication-manager>
जब मैं <s:global-method-security pre-post-annotations="enabled"/>
मेरी कोड जोड़ने के संसाधन नहीं मिला त्रुटि दिखाता है और जब मैं अपने कोड को दूर सफलतापूर्वक निष्पादित लेकिन ROLE_USER
ROLE_ADMIN
कार्यों
मेरे नियंत्रक समारोह है पहुँच सकते हैं।
@PreAuthorize("hasRole('ROLE_ADMIN')")
@RequestMapping(value="/delete", method = RequestMethod.GET)
public String DeleteAll(ModelMap model, Principal principal) {
org.springframework.security.core.userdetails.User activeUser = (org.springframework.security.core.userdetails.User)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
System.out.println("Active user is "+activeUser.getUsername()+"Authorities are "+activeUser.getAuthorities());
return "deleteUsers";
}
हाँ मैं जानता हूँ, लेकिन जब मैं जोड़ने मेरी कोड संसाधन, त्रुटि नहीं मिला पता चलता है क्या तुम जानते हो कि यह कैसे तय करने के लिए? –
Raheel
क्लास org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanDefinitionStoreException: श्रोता कॉन्टेक्स्ट संसाधन से XML दस्तावेज़ को अनपेक्षित अपवाद पार्सिंग [/WEB-INF/spring-security.xml ]; नेस्टेड अपवाद java.lang.No.NoassassDefFoundError: org/aopalliance/intercept/methodInterceptor – Raheel
और मैं वसंत सुरक्षा 3.07 – Raheel