"Original" Save the Redis Single sign-on configuration file "cross-domain" before spring-session

Source: Internet
Author: User

Since a single point was needed to debug the project earlier, the project was a single sign-on based on the older version of Spring-session, which did not implement cross-domain logins because it was only stored for user caches under the same domain name, such as Http://127.0.0.1/wap and Http://127.0.0.1/wap2 , so as long as the first domain name login and then go to the 22nd domain name for the user login, there is no need to log in repeatedly, but if it is Http://127.0.0.1/wap and HTTP/ 192.168.1/WAP2 So there is no way to find the session.

<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:c= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/C"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:p= "http://www.springframework.org/schema/p"Xmlns:beans= "Http://www.springframework.org/schema/beans"Xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd"><BeanId= "Poolconfig"Class= "Redis.clients.jedis.JedisPoolConfig"><PropertyName= "Maxtotal"Value= "${redis.maxtotal}"/><PropertyName= "Maxidle"Value= "${redis.maxidle}"/><PropertyName= "Maxwaitmillis"Value= "${redis.maxwaitmillis}"/><PropertyName= "Testonborrow"Value= "${redis.testonborrow}"/></Bean><BeanId= "ConnectionFactory"Class= "Org.springframework.data.redis.connection.jedis.JedisConnectionFactory"><PropertyName= "HostName"Value= "${redis.host}"/><PropertyName= "Port"Value= "${redis.port}"/><PropertyName= "Password"Value= "${redis.auth}"/><PropertyName= "Poolconfig"Ref= "Poolconfig"/></Bean><BeanId= "Redistemplate"Class= "Org.springframework.data.redis.core.RedisTemplate"><PropertyName= "ConnectionFactory"Ref= "ConnectionFactory"/><!--If the serializer is not configured, then the intelligent use of String when stored, if the object type is stored, it will prompt the wrong object can ' t cast to string!!!-<PropertyName= "Keyserializer"><BeanClass= "Org.springframework.data.redis.serializer.StringRedisSerializer"/></Property><PropertyName= "ValueSerializer"><BeanClass= "Org.springframework.data.redis.serializer.JdkSerializationRedisSerializer"/></Property></Bean><BeanId= "Redistemplatec"Class= "Org.springframework.data.redis.core.RedisTemplate"><PropertyName= "ConnectionFactory"Ref= "ConnectionFactory"/><PropertyName= "Keyserializer"><BeanClass= "Org.springframework.data.redis.serializer.StringRedisSerializer"/></Property><PropertyName= "ValueSerializer"><!--Set the value of the serializer, or the hexadecimal issue will occur when saving to Redis-<BeanClass= "Org.springframework.data.redis.serializer.StringRedisSerializer"/></Property></Bean><!--Place session into Redis-<bean id= " Redishttpsessionconfiguration " Class=" Org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration "> <property name=" Httpsessionstrategy "ref=" Cookiehttpsessionstrategy "/> </bean> set cookiename and path <bean id=" Defaultcookieserializer "class=" Org.springframework.session.web.http.DefaultCookieSerializer "> <property Name= "CookieName" value= "dtl_session_id"/> <property name= "cookiepath" value= "/"/> </bean> <bean ID = "Cookiehttpsessionstrategy" class= "Org.springframework.session.web.http.CookieHttpSessionStrategy" > < Property Name= "Cookieserializer" ref= "Defaultcookieserializer"/> </bean> </beans>   

"Original" Save the Redis Single sign-on configuration file "cross-domain" before spring-session

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.