CN110008025A - A kind of session sharing method and system cross-domain based on Redis, across language - Google Patents
A kind of session sharing method and system cross-domain based on Redis, across language Download PDFInfo
- Publication number
- CN110008025A CN110008025A CN201910274095.9A CN201910274095A CN110008025A CN 110008025 A CN110008025 A CN 110008025A CN 201910274095 A CN201910274095 A CN 201910274095A CN 110008025 A CN110008025 A CN 110008025A
- Authority
- CN
- China
- Prior art keywords
- session
- redis
- cross
- language
- domain
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 25
- 238000011161 development Methods 0.000 claims abstract description 36
- 238000012986 modification Methods 0.000 claims description 17
- 230000004048 modification Effects 0.000 claims description 17
- 235000014510 cooky Nutrition 0.000 claims description 12
- 241000208822 Lactuca Species 0.000 claims description 6
- 235000003228 Lactuca sativa Nutrition 0.000 claims description 6
- 230000004913 activation Effects 0.000 claims description 6
- 101001094649 Homo sapiens Popeye domain-containing protein 3 Proteins 0.000 description 1
- 101000608234 Homo sapiens Pyrin domain-containing protein 5 Proteins 0.000 description 1
- 101000578693 Homo sapiens Target of rapamycin complex subunit LST8 Proteins 0.000 description 1
- 102100027802 Target of rapamycin complex subunit LST8 Human genes 0.000 description 1
- 238000013475 authorization Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007935 neutral effect Effects 0.000 description 1
- 230000002688 persistence Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
Abstract
Session sharing method and system cross-domain based on Redis, across language that the invention discloses a kind of, belongs to technical field of data processing.A kind of cross-domain based on Redis session sharing method across language, subscriber sign-in conversation information unification is stored in Redis database, using session Internal Code as the unique identification for reading session information.A kind of cross-domain based on Redis session shared system across language, subscriber sign-in conversation information unification is stored in Redis database by the system, using session Internal Code as the unique identification for reading session information, including certificate server, service client and load balancing module.The present invention can solve single-point in government industry between each operation system and the shared problem of session, avoids single instance from happening suddenly delay machine, meets the flexible switching between multiple systems, be suitable for cross-domain and to the unconfined each operation system of development language.
Description
Technical field
The present invention relates to big data technical fields, and in particular to a kind of shared side of cross-domain based on Redis session across language
Method and system.
Background technique
Spring-Session is provided to be integrated with the transparent of HttpSession, is allowed with Application Container (i.e.
Tomcat) neutral mode replaces HttpSession, it realizes collection group session, multiple browser sessions, Restful api
And it is integrated with the perfection of Websocket.
Redis be one open source write using ANSI C language, support network, it is memory-based also can persistence day
Will type, Key-Value database, and the API of multilingual is provided.
Nginx (engine x) is the HTTP and reverse proxy service and an IMAP/ of a high-performance and lightweight
POP3/SMTP service.
SAML is the open source standard data format based on XML, it is exchanging authentication and authorization between the parties
Data exchange especially between Identity Provider and ISP.
At present in government industry, operation system has used the Development Framework of multilingual and the operation system respectively meeting of storage
Information is talked about, session is cannot achieve and shares, be not able to satisfy user's handover access between multiple operation systems.If operation system simultaneously
It is disposed in the case where cross-domain, especially when using multiple instances deployment, is not available the load balancing of poll to mitigate clothes
Business end pressure, causing, which influences client in the next example delay machine of emergency case, uses, poor user experience.
Summary of the invention
Technical assignment of the invention is to provide a kind of session sharing method and system cross-domain based on Redis, across language, solution
The certainly shared problem of the single-point in government industry between each operation system and session, be suitable for it is cross-domain and to development language without limitation
Each operation system.
The technical solution adopted by the present invention to solve the technical problems is:
A kind of cross-domain based on Redis session sharing method across language, this method deposit subscriber sign-in conversation information unification
It is stored in Redis database, using session Internal Code as the unique identification for reading session information.It can change traditional in government industry
Operation system respectively store that session, to cannot achieve session shared and using multiple instances deployment, it is real not to be available polling schemas
The phenomenon that existing load balancing, solves individual example burst delay machine with this, meets user under the premise of based on security strategy, more
Close friend normally carries out the handover access between multiple operation systems.
Further, the implementation of this method can pass through three certificate server, service client and load balancing aspects
Implementation embody, the specific implementation of this method is as follows:
For certificate server:
Based on spring-session Integrated Solution configuration modification;
Cookie and the header strategy for merging spring-session, make it while supporting two kinds of strategies;
The rest service interface based on header strategy is developed, is called for the development language other than JAVA, it is total to reach session
The purpose enjoyed.
For service client:
Service client is directed to based on same area and using the operation system of JAVA development language and based on cross-domain or use
The unexpected operation system of JAVA development language provides different solutions respectively.
Further, for load balancing, the polling schemas based on Nginx acts on behalf of respective operation system, to improve business
The robustness of system.
Specifically, the concrete mode based on spring-session Integrated Solution configuration modification are as follows:
Introduce spring-session-data-redis jar packet related to lettuce;
Spring-session associated profile is inserted, and adds respective filter in web.xml.
Specifically, for based on same area and using the operation system of JAVA development language, being used for service client
Integrated Solution based on Spring-Session introduces correlation JAR packet and modification configuration, uses Cookie strategy.
Specifically, for service client, for based on the cross-domain or use unexpected operation system of JAVA development language, head
It first passes through the one-point system based on SAML and obtains session Internal Code from certificate server, each business is intercepted in the form of blocker and is asked
Ask, then carry session Internal Code have access to the Rest service interface based on Header strategy, with keep Redis session activation and
Verify whether the session fails.
A kind of cross-domain based on Redis session shared system across language is also claimed in the present invention, which steps on user
Record session information is uniformly stored in Redis database, using session Internal Code as the unique identification of reading session information, including is recognized
Demonstrate,prove server-side, service client and load balancing module.
Specifically, in the described system
Certificate server is based on spring-session Integrated Solution configuration modification, is then combined with spring-session
Cookie and header strategy, make its simultaneously support two kinds of strategies, finally develop the rest service based on header strategy and connect
Mouthful, it is called for the development language other than JAVA, achievees the purpose that session is shared;
Service client be directed to respectively based on same area and using the operation system of JAVA development language and based on cross-domain or
Different solutions is provided using the unexpected operation system of JAVA development language;
Load balancing module acts on behalf of respective operation system based on the polling schemas of Nginx, to improve the stalwartness of operation system
Property.
Specifically, concrete mode of the certificate server based on spring-session Integrated Solution configuration modification are as follows:
Introduce spring-session-data-redis jar packet related to lettuce;
Spring-session associated profile is inserted, and adds respective filter in web.xml.
Further, service client
Based on same area and using the operation system of JAVA development language, using integrated based on Spring-Session
Scheme introduces correlation JAR packet and modification configuration, uses Cookie strategy;
Based on it is cross-domain or use the unexpected operation system of JAVA development language, first by the one-point system based on SAML from
Certificate server obtains session Internal Code, and each service request is intercepted in the form of blocker, and carrying session Internal Code, which is had access to, to be based on
The Rest service interface of Header strategy, to keep the session activation of Redis and verify whether the session fails.
A kind of session sharing method and system cross-domain based on Redis, across language of the invention compared with prior art, has
Have it is following the utility model has the advantages that
Use this method or system, thus it is possible to vary traditional business system cannot be asked when disposing more examples using polling schemas
Topic avoids single example burst delay machine and influences the normal access of operation system;Uniformly store the meeting between different business systems
Words, realize the flexible switching between multiple systems, enhance the experience sense of user.
Specific embodiment
The present invention is further explained in the light of specific embodiments.
A kind of cross-domain based on Redis session sharing method across language, this method deposit subscriber sign-in conversation information unification
It is stored in Redis database, using session Internal Code as the unique identification for reading session information.It can change traditional in government industry
Operation system respectively store that session, to cannot achieve session shared and using multiple instances deployment, it is real not to be available polling schemas
The phenomenon that existing load balancing, solves individual example burst delay machine with this, meets user under the premise of based on security strategy, more
Close friend normally carries out the handover access between multiple operation systems.
This method provides different solutions for JAVA development language and non-JAVA development language.The implementation of this method
It can be embodied by the implementation of three certificate server, service client and load balancing aspects, the specific implementation of this method
Mode is as follows:
One, for certificate server:
1, it is based on spring-session Integrated Solution configuration modification;
Introduce spring-session-data-redis jar packet related to lettuce;
Spring-session associated profile is inserted, and adds respective filter in web.xml;
2, cookie and the header strategy for merging spring-session, make it while supporting two kinds of strategies;
3, the rest service interface based on header strategy is developed, is called for the development language other than JAVA, reaches session
Shared purpose.
Two, for service client:
Service client is directed to based on same area and using the operation system of JAVA development language and based on cross-domain or use
The unexpected operation system of JAVA development language provides different solutions respectively.
Based on same area and using the operation system of JAVA development language, using integrated based on Spring-Session
Scheme introduces correlation JAR packet and modification configuration, uses Cookie strategy;
Based on it is cross-domain or use the unexpected operation system of JAVA development language, first by the one-point system based on SAML from
Certificate server obtains session Internal Code, and each service request is intercepted in the form of blocker, then carries session Internal Code and has access to base
In the Rest service interface of Header strategy, to keep the session activation of Redis and verify whether the session fails.
Three, for load balancing:
Polling schemas based on Nginx acts on behalf of respective operation system, to improve the robustness of operation system.
Another embodiment of the invention the most, a kind of cross-domain based on Redis session shared system across language, this is
Subscriber sign-in conversation information unification is stored in Redis database by system, using session Internal Code as the unique of reading session information
Mark, including certificate server, service client and load balancing module.
In the system,
1, certificate server is based on spring-session Integrated Solution configuration modification, is then combined with spring-session
Cookie and header strategy, make its simultaneously support two kinds of strategies, finally develop the rest service based on header strategy and connect
Mouthful, it is called for the development language other than JAVA, achievees the purpose that session is shared.
Wherein, concrete mode of the certificate server based on spring-session Integrated Solution configuration modification are as follows:
Introduce spring-session-data-redis jar packet related to lettuce;
Spring-session associated profile is inserted, and adds respective filter in web.xml.
2, service client is directed to respectively based on same area and using the operation system of JAVA development language and based on cross-domain
Or different solutions is provided using the unexpected operation system of JAVA development language.
Based on same area and using the operation system of JAVA development language, using integrated based on Spring-Session
Scheme introduces correlation JAR packet and modification configuration, uses Cookie strategy;
Based on it is cross-domain or use the unexpected operation system of JAVA development language, first by the one-point system based on SAML from
Certificate server obtains session Internal Code, and each service request is intercepted in the form of blocker, and carrying session Internal Code, which is had access to, to be based on
The Rest service interface of Header strategy, to keep the session activation of Redis and verify whether the session fails.
3, load balancing module acts on behalf of respective operation system based on the polling schemas of Nginx, to improve the strong of operation system
Strong property.
The present invention has had been applied to Shandong Province territory integrated management cloud platform and integrated management service in Nanchang City territory is flat
In platform construction, the cross-domain session across language realized between different development language operation system is shared integrated;Increase user's body
Degree of testing provides the robustness between the more examples of operation system.
The technical personnel in the technical field can readily realize the present invention with the above specific embodiments,.But it answers
Work as understanding, the present invention is not limited to above-mentioned specific embodiments.On the basis of the disclosed embodiments, the technical field
Technical staff can arbitrarily combine different technical features, to realize different technical solutions.
Claims (10)
1. a kind of cross-domain based on Redis session sharing method across language, it is characterised in that by subscriber sign-in conversation information unification
It is stored in Redis database, using session Internal Code as the unique identification for reading session information.
2. a kind of cross-domain based on Redis session sharing method across language according to claim 1, it is characterised in that should
The specific implementation of method is as follows:
For certificate server:
Based on spring-session Integrated Solution configuration modification,
Cookie and the header strategy for merging spring-session make it while supporting two kinds of strategies,
The rest service interface based on header strategy is developed, is called for the development language other than JAVA, reaches what session was shared
Purpose;
For service client:
Service client is directed to based on same area and uses the operation system of JAVA development language and be based on cross-domain or use JAVA
The unexpected operation system of development language provides different solutions respectively.
3. a kind of cross-domain based on Redis session sharing method across language according to claim 2, it is characterised in that right
In load balancing, the polling schemas based on Nginx acts on behalf of respective operation system.
4. a kind of cross-domain based on Redis session sharing method across language according to claim 2, it is characterised in that institute
State the concrete mode based on spring-session Integrated Solution configuration modification are as follows:
Introduce spring-session-data-redis jar packet related to lettuce;
Spring-session associated profile is inserted, and adds respective filter in web.xml.
5. a kind of cross-domain based on Redis session sharing method across language according to claim 2, it is characterised in that right
It is directed in service client based on same area and using the operation system of JAVA development language, using based on Spring-Session
Integrated Solution introduce correlation JAR packet and modification configures, use Cookie tactful.
6. a kind of cross-domain based on Redis session sharing method across language according to claim 2 or 5, it is characterised in that
Service client is directed to and is based on cross-domain or uses the unexpected operation system of JAVA development language, first by based on SAML's
One-point system obtains session Internal Code from certificate server, and each service request is intercepted in the form of blocker, carries session Internal Code
The Rest service interface based on Header strategy is had access to, to keep the session activation of Redis and verify whether the session fails.
7. a kind of cross-domain based on Redis session shared system across language, it is characterised in that the system believes subscriber sign-in conversation
Breath is uniformly stored in Redis database, using session Internal Code as the unique identification for reading session information, including authentication service
End, service client and load balancing module.
8. a kind of cross-domain based on Redis session shared system across language according to claim 7, it is characterised in that
Certificate server be based on spring-session Integrated Solution configuration modification, merge spring-session cookie and
Header strategy makes it while supporting two kinds of strategies, the rest service interface based on header strategy developed, other than JAVA
Development language calls, and achievees the purpose that session is shared;
Service client is directed to respectively based on same area and using the operation system of JAVA development language and based on cross-domain or use
The unexpected operation system of JAVA development language provides different solutions;
Load balancing module acts on behalf of respective operation system based on the polling schemas of Nginx.
9. a kind of cross-domain based on Redis session shared system across language according to claim 8, it is characterised in that recognize
Demonstrate,prove concrete mode of the server-side based on spring-session Integrated Solution configuration modification are as follows:
Introduce spring-session-data-redis jar packet related to lettuce;
Spring-session associated profile is inserted, and adds respective filter in web.xml.
10. a kind of cross-domain based on Redis session shared system across language according to claim 8 or claim 9, feature exist
In service client
Based on same area and using the operation system of JAVA development language, drawn using the Integrated Solution based on Spring-Session
Enter related JAR packet and modification configuration, uses Cookie strategy;
Based on cross-domain or use the unexpected operation system of JAVA development language, first by the one-point system based on SAML from certification
Server-side obtains session Internal Code, and each service request is intercepted in the form of blocker, carries session Internal Code and has access to based on Header
The Rest service interface of strategy, to keep the session activation of Redis and verify whether the session fails.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910274095.9A CN110008025A (en) | 2019-04-08 | 2019-04-08 | A kind of session sharing method and system cross-domain based on Redis, across language |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910274095.9A CN110008025A (en) | 2019-04-08 | 2019-04-08 | A kind of session sharing method and system cross-domain based on Redis, across language |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110008025A true CN110008025A (en) | 2019-07-12 |
Family
ID=67170200
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910274095.9A Pending CN110008025A (en) | 2019-04-08 | 2019-04-08 | A kind of session sharing method and system cross-domain based on Redis, across language |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110008025A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111125653A (en) * | 2019-12-18 | 2020-05-08 | 紫光云(南京)数字技术有限公司 | High-concurrency unified authentication method based on Nginx and Redis |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080104618A1 (en) * | 2006-09-11 | 2008-05-01 | Rogers Timothy A | Event-driven/service oriented online testing |
CN103209223A (en) * | 2013-04-27 | 2013-07-17 | 中国农业银行股份有限公司 | Distributed application conversation information sharing method and system and application server |
CN109274751A (en) * | 2018-10-08 | 2019-01-25 | 中邮科通信技术股份有限公司 | A kind of session sharing method rewriteeing servlet request |
-
2019
- 2019-04-08 CN CN201910274095.9A patent/CN110008025A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080104618A1 (en) * | 2006-09-11 | 2008-05-01 | Rogers Timothy A | Event-driven/service oriented online testing |
CN103209223A (en) * | 2013-04-27 | 2013-07-17 | 中国农业银行股份有限公司 | Distributed application conversation information sharing method and system and application server |
CN109274751A (en) * | 2018-10-08 | 2019-01-25 | 中邮科通信技术股份有限公司 | A kind of session sharing method rewriteeing servlet request |
Non-Patent Citations (8)
Title |
---|
BBSMAX: "Spring-Session实现Session共享入门教程", 《HTTPS://WWW.BBSMAX.COM/A/1O5EYGA357/》, 9 March 2018 (2018-03-09) * |
ZIYU WANG: "Analysis of Load-Balancing of Web Cluster Based on TLS Session Sharing", 《2009 FIRST INTERNATIONAL WORKSHOP ON EDUCATION TECHNOLOGY AND COMPUTER SCIENCE》 * |
ZIYU WANG: "Analysis of Load-Balancing of Web Cluster Based on TLS Session Sharing", 《2009 FIRST INTERNATIONAL WORKSHOP ON EDUCATION TECHNOLOGY AND COMPUTER SCIENCE》, 26 May 2009 (2009-05-26) * |
善假于物也: "SpringSession同时支持Cookie和header策略", 《HTTPS://WWW.ITEYE.COM/BLOG/309593586-QQ-COM-2415463》 * |
善假于物也: "SpringSession同时支持Cookie和header策略", 《HTTPS://WWW.ITEYE.COM/BLOG/309593586-QQ-COM-2415463》, 4 April 2018 (2018-04-04) * |
柳纲等: "服务端无状态技术研究", 《电力信息与通信技术》 * |
柳纲等: "服务端无状态技术研究", 《电力信息与通信技术》, no. 11, 15 November 2017 (2017-11-15) * |
王继林: "《信息安全导论》", 西安电子科技大学出版社, pages: 284 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111125653A (en) * | 2019-12-18 | 2020-05-08 | 紫光云(南京)数字技术有限公司 | High-concurrency unified authentication method based on Nginx and Redis |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104023092B (en) | A kind of method and system for realizing orientation flow bag | |
CA2716544C (en) | Method and system for providing network services | |
CN106162574A (en) | Group system is applied universal retrieval method, server and terminal | |
CN110324284A (en) | Access the method and communication device of IMS | |
CN108200146A (en) | A kind of micro services framework implementation method of lightweight | |
CN105791206B (en) | The acquisition methods and device of LAN services | |
US20170149916A1 (en) | Page Push Method, Device and Server, and Centralized Network Management Controller | |
CN108990115B (en) | Method for guaranteeing QoS under multi-core network networking of cluster communication system | |
US7478172B1 (en) | Supporting communication applications between enterprises in a secure manner | |
CN110008025A (en) | A kind of session sharing method and system cross-domain based on Redis, across language | |
CN110191304A (en) | Data processing method, device and storage medium | |
CN107864189A (en) | A kind of application layer traffic load-balancing method based on DPI | |
CN101060428A (en) | A P2P network dispatching method | |
CN108134824A (en) | A kind of travel products running log recording method and system | |
CN103327087B (en) | Conference control method and device | |
CN104994181B (en) | A kind of method that dynamic MAC address table is shown in distributed OLT system | |
US8060568B2 (en) | Real time messaging framework hub to intercept and retransmit messages for a messaging facility | |
CN103841221B (en) | Policy execution method, system, strategy execution equipment and control device | |
CN109587121A (en) | The management-control method and device of security strategy | |
CN100558053C (en) | The method that the performance of communication for coordination system is measured | |
CN104094618B (en) | Access control method, apparatus and system | |
CN106385356A (en) | Login method and terminal, session establishing method and server | |
CN109120727A (en) | Distributed message supplying system | |
CN106162563B (en) | Group system user management method and server | |
CN114172958A (en) | Private computing node, system, method, apparatus, and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |