में चल रहे वसंत-सुरक्षा एकीकरण वाडिन और वसंत सुरक्षा पर नया, मैं जानना चाहता हूं कि किसी के पास vamin 7.1 + वसंत-सुरक्षा एकीकरण का एक पूर्ण प्रोजेक्ट उदाहरण है जो टॉमकैट सर्वर में चल रहा है (में नहीं घाट)।वाडिन 7.1 + टॉमकैट सर्वर
उत्तर
आपको इस GitHub project पर एक नज़र रखना चाहिए। यह वाडिन 7.1 + वसंत 3.1.2.RELEASE + स्प्रिंग-वाडिन एकीकरण 2.0.1 प्रोजेक्ट। अंदर जेटी प्लगइन भी है, लेकिन आप समस्याओं के बिना टोमकैट में भी इसे चला सकते हैं/तैनात कर सकते हैं।
Here एक छोटी परियोजना है जो वाडिन और वसंत सुरक्षा को एकीकृत करती है। यह स्कैला में किया गया है, लेकिन स्पष्ट रूप से जावा में भी काम करता है। कोड here है।
आपके उत्तर के लिए थनक्स नहीं, मैं कोड देखता हूं और मैं इसे जावा में अनुवाद करने का प्रयास करता हूं, लेकिन मुझे स्कैला नहीं पता इसलिए मुझे थोड़ी सी समस्याएं थीं। मैं लगभग सभी का अनुवाद करता हूं, केवल एक ही वर्ग में मुझे संदेह है कि उनका अनुवाद कैसे करें NavigationErrorHandlingStrategy और NavigatorFactory, क्या आप इन दो वर्गों को जावा में अनुवाद करने में मेरी सहायता कर सकते हैं? – rgaaray
lol ... यह निस्संदेह जटिल – specializt
वाडिन 7 वसंत सुरक्षा के साथ आसान एकीकृत है। आपको केवल 2 फाइलों को कॉन्फ़िगर करना चाहिए। पहला - web.xml और दूसरा एक spring-security.xml (उपयोगकर्ता प्रमाण-पत्र और सुरक्षा सेटिंग्स)। प्रमाणीकरण के लिए मूल रूप का उपयोग करने के लिए यह छोटा उदाहरण है।
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>Vaadin7SpringSecurity</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/spring-security.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- filter declaration for Spring Security -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
वसंत-security.xml
<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<http auto-config='true'>
<intercept-url pattern="/*" access="ROLE_USER" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user" password="password" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
अधिक जानकारी के लिए कैसे वसंत-security.xml विन्यास आप Spring resources उपयोग कर सकते हैं विस्तार करने के लिए।
यह अच्छा है लेकिन अगर मैं कस्टम लॉगिन फॉर्म का उपयोग करना चाहता हूं तो क्या होगा? – Bourkadi
वास्तव में यह "आसान" होने से बहुत दूर है - जो आप दिखा रहे हैं वह वैडिन समर्थन के साथ एक स्प्रिंग एप्लिकेशन है - लेकिन वास्तव में स्प्रिंग सुरक्षा समर्थन के साथ एक वैडिन एप्लिकेशन बनाना ... कुछ हद तक कठिन है: https://vaadin.com/wiki? p_p_id = 36 और p_p_lifecycle = 0 और p_p_state = pop_up और p_p_mode = view और _36_struts_action =% 2 फ़्वीकी% 2 फ़्यूव्यू और p_r_p_185834411_nodeName = vaadin.com + विकी और p_r_p_185834411_title = IV + - + कॉन्फ़िगर करना + और + का उपयोग + वाडिन + वसंत + बिना + वसंत + बूट - क्षमा करें लेकिन आपका उत्तर केवल कुछ के लिए मान्य है बहुत सीमित मामलों ... जो लोग वाडिन सीडीआई का उपयोग करना चाहते हैं, उनके लिए यह एक वास्तविक दर्द है – specializt
नवीनतम वसंत-सुरक्षा का उपयोग करके ऊपर के उदाहरण की बात कर के लिए, मैं निम्नलिखित त्रुटियाँ और मेरे soultions प्रदान: आप अपने वसंत * संस्करण की जाँच करनी चाहिए
Error1
Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: You cannot use a spring-security-2.0.xsd or spring-security-3.0.xsd or spring-security-3.1.xsd schema or spring-security-3.2.xsd schema with Spring Security 4.0. Please update your schema declarations to the 4.0 schema.
और वसंत-सुरक्षा.एक्सएमएल का हेडर टैग अपडेट करें। उदाहरण के लिए: मैं वसंत-बीन्स-4.1.6.RELEASE और वसंत-सुरक्षा-4.0.2.RELEASE का उपयोग करता हूं। इसलिए मैं इसे के रूप में अद्यतन:
<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.0.xsd">
Error2
HTTP Status 500 - Failed to evaluate expression 'ROLE_USER'
...
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'ROLE_USER' cannot be found on object of type 'org.springframework.security.web.access.expression.WebSecurityExpressionRoot' - maybe not public?
...
इस resource के संकेत के अनुसार, आप निम्नलिखित के रूप में टैग अवरोधन-यूआरएल को संशोधित करना चाहिए:
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
त्रुटि 3
HTTP Status 403 - Expected CSRF token not found. Has your session expired?
ऐसा इसलिए है क्योंकि वसंत-सुरक्षा डिफ़ॉल्ट रूप से सीएसआरएफ सुरक्षा को सक्षम बनाता है जो वाडिन के साथ संघर्ष करता है।आप http के भीतर एक नया टैग को जोड़ने चाहिए:
<csrf disabled="true" />
यहाँ संदर्भ के लिए मेरा पूरा वसंत-security.xml है:
<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-4.0.xsd">
<http auto-config='true'>
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
<csrf disabled="true" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="yourUsername" password="yourPassoword" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
- 1. वाडिन
- 2. टॉमकैट सर्वर
- 3. टॉमकैट सर्वर
- 4. टॉमकैट सर्वर
- 5. टॉमकैट सर्वर
- 6. जेबॉस सर्वर 7.1 ग्रहण लुना
- 7. वाडिन
- 8. वाडिन
- 9. वाडिन
- 10. वाडिन 7, वायुमंडल और सर्वर पुश समस्याएं
- 11. टॉमकैट सर्वर org.apache.catalina.deploy.WebXml addServlet
- 12. एक एकल टॉमकैट सर्वर
- 13. टॉमकैट सर्वर टीएमपी
- 14. जब मैं टॉमकैट सर्वर
- 15. बाहरी टॉमकैट 9 सर्वर
- 16. एम्बेडेड टॉमकैट सर्वर
- 17. वाडिन टचकिट
- 18. आईओएस 7.1 सिम्युलेटर एक्सकोड 7.1
- 19. वाडिन लॉगिन
- 20. वाडिन 7
- 21. वाडिन कम्बोबॉक्स
- 22. वाडिन लेआउट
- 23. वाडिन टचकिट या mgwt
- 24. बाहरी टॉमकैट/टीसी सर्वर इंस्टेंस
- 25. टॉमकैट 6.0.18 सेवा विंडोज सर्वर
- 26. वाडिन - कुछ संदेह
- 27. Jboss 7.1
- 28. वाडिन 7 में सर्वर से फ़ाइल कैसे डाउनलोड करें?
- 29. जेबॉस 7.1
- 30. जेबीओएस 7.1
अपने जवाब के लिए धन्यवाद, मैं पहले से ही इस परियोजना को आप का उल्लेख उपयोग करते हैं लेकिन मुझे नहीं पता कि जब मैं क्रेडेंशियल दर्ज करता हूं और लॉगिन बटन में क्लिक करता हूं तो मुझे उसी लॉगिन पेज पर अग्रेषित किया जाता है, यूआई – rgaaray