[go: up one dir, main page]

CN114238888A - Method for controlling account single device login based on Redis in distributed system - Google Patents

Method for controlling account single device login based on Redis in distributed system Download PDF

Info

Publication number
CN114238888A
CN114238888A CN202111517445.3A CN202111517445A CN114238888A CN 114238888 A CN114238888 A CN 114238888A CN 202111517445 A CN202111517445 A CN 202111517445A CN 114238888 A CN114238888 A CN 114238888A
Authority
CN
China
Prior art keywords
user
redis
login information
login
distributed system
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
Application number
CN202111517445.3A
Other languages
Chinese (zh)
Inventor
宫延升
单震
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Original Assignee
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Chaozhou Zhuoshu Big Data Industry Development Co Ltd filed Critical Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority to CN202111517445.3A priority Critical patent/CN114238888A/en
Publication of CN114238888A publication Critical patent/CN114238888A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method for controlling single-account equipment login of a distributed system based on Redis, and relates to the technical field of account login of the distributed system; recording user login information of a distributed system by utilizing Redis, wherein a user id is used as a key of the Redis, the user login information is encrypted and then used as a value of the Redis, judging whether a user device requesting login is the user device currently recording the user login information according to the user login information, if so, receiving a request of the user device to log in, otherwise, clearing the user login information of the user device already logged in the Redis, recording the user login information of the user device currently requesting login, and controlling a user account to log in single device.

Description

Method for controlling account single device login based on Redis in distributed system
Technical Field
The invention discloses a method, relates to the technical field of account login of a distributed system, and particularly relates to a method for controlling account single device login of the distributed system based on Redis.
Background
The condition that a user uses an account to log in multiple devices exists in a distributed system, the condition that a unified account logs in multiple devices has potential safety hazards, and the system response speed is easy to cause to be slow.
Redis (remote Dictionary Server), a remote Dictionary service, is an open source log-type and Key-Value database written in ANSI C language, supporting network, based on memory and persistent, and provides API of multiple languages.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a method for controlling account single-device login based on Redis in a distributed system, so that the number of devices with single accounts on line at the same time is limited, and the response speed of the system is improved.
The specific scheme provided by the invention is as follows:
a method for controlling single account equipment login of a distributed system based on Redis includes recording user login information of the distributed system by utilizing Redis, enabling user id to be key of Redis, enabling user login information to be value of Redis after being encrypted,
judging whether the user equipment requesting login is the user equipment currently recording the user login information according to the user login information, if so, receiving the request of the user equipment to log in, otherwise, clearing the user login information of the logged-in user equipment in Redis, recording the user login information of the user equipment currently requesting login, and controlling a user account to log in single equipment.
Further, in the method for controlling account single device login based on Redis in the distributed system, encrypting the user login information to be used as the value of Redis includes:
the user login information is encrypted by MD5 and is referred to as value of Redis.
Further, in the method for controlling single device login of an account based on Redis in the distributed system, the determining, according to the user login information, whether the user device requesting login is the user device currently recording the user login information includes:
obtaining a value from Redis according to the user id, obtaining user login information according to the value, and judging whether the user equipment requesting login is the user equipment currently recording the user login information according to the user login information.
Further, in the method for controlling the single-account device login based on Redis in the distributed system, the user login information includes login device information, and whether the user device requesting login is the user device currently recording the user login information is judged according to the login device information.
A distributed system for controlling single-device login based on Redis comprises an acquisition recording module and a judgment control module,
the acquisition recording module acquires user login information of a distributed system recorded by Redis, wherein the user id is used as the key of the Redis, the user login information is encrypted and then used as the value of the Redis,
the judging control module judges whether the user equipment which requests to log in is the user equipment which currently records the user login information according to the user login information, if so, the user equipment requests to log in, otherwise, the user login information of the logged-in user equipment in Redis is cleared, the user login information of the user equipment which currently requests to log in is recorded, and a user account is controlled to log in the single equipment.
Further, in the distributed system based on single device login of the Redis control account, the obtaining and recording module obtains user login information of the distributed system recorded by the Redis, wherein the user login information is encrypted by MD5 and then is used as a value of the Redis.
Further, in the distributed system based on single device login of Redis control account, the determining control module determines, according to the user login information, whether the user device requesting login is a user device currently recording the user login information, including:
obtaining a value from Redis according to the user id, obtaining user login information according to the value, and judging whether the user equipment requesting login is the user equipment currently recording the user login information according to the user login information.
Further, the user login information in the distributed system based on single device login of the Redis control account includes login device information, and the judgment control module judges whether the user device requesting login is the user device currently recording the user login information according to the login device information.
The invention has the advantages that:
the invention provides a method for controlling account single-device login of a distributed system based on Redis, which mainly solves the problem of single-device login of a price or safety account limited in the distributed system. In addition, the method supports quick query through Redis, avoids reading and writing of the database, and solves the problem of data information sharing of a distributed system; the key overdue setting can be supported through Redis, login users who do not operate for a long time need login verification when operating again, and meanwhile, the response speed of the system is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic diagram of the application framework of the method of the present invention.
Detailed Description
The present invention is further described below in conjunction with the following figures and specific examples so that those skilled in the art may better understand the present invention and practice it, but the examples are not intended to limit the present invention.
The invention provides a method for controlling account single device login of a distributed system based on Redis, which records user login information of the distributed system by utilizing the Redis, wherein a user id is used as a key of the Redis, the user login information is encrypted and then used as a value of the Redis,
judging whether the user equipment requesting login is the user equipment currently recording the user login information according to the user login information, if so, receiving the request of the user equipment to log in, otherwise, clearing the user login information of the logged-in user equipment in Redis, recording the user login information of the user equipment currently requesting login, and controlling a user account to log in single equipment.
The method and the system can solve the problem of single equipment login of limiting the price or safety account number in a distributed system, such as a VIP account number of a certain website, and can be used for limiting the number of the equipment with the single account number on line at the same time.
In a specific application, in some embodiments of the method of the present invention, the user login information is recorded by using Redis in a distributed system, and the user login information includes information of a login device. When a user requests a login interface by using the device A, judging whether other devices log in, if not, storing the login information of the device A to Redis by using the method of the invention, and realizing the login of the device A; if the B device is logged in, the login information of the B device is cleared in Redis, or the login information of the A device is stored in Redis, when the B device requests a server, the B device is judged to be in an unregistered state, the B device is prompted to be logged in, and the control of login of the account number list device in the distributed system is realized.
In the above application process, in another embodiment of the present invention, a process of recording user login information is specifically described. The unique id of the user is used as a key of Redis, other user login information is encrypted by MD5 and used as a value of Redis, and the value is acquired from the Redis by taking the user id as the key when the user requests, wherein the code is exemplified as follows:
Figure BDA0003407454340000041
Figure BDA0003407454340000051
and obtaining user login information according to the value, judging whether the user equipment requesting login is the user equipment currently recording the user login information according to the user login information, if so, receiving the request of the user equipment to log in, otherwise, clearing the user login information of the user equipment already logged in Redis, recording the user login information of the user equipment currently requesting login, and controlling a user account to log in the single equipment.
Meanwhile, the invention also provides a distributed system for single-device login based on Redis control account, which comprises an acquisition recording module and a judgment control module,
the acquisition recording module acquires user login information of a distributed system recorded by Redis, wherein the user id is used as the key of the Redis, the user login information is encrypted and then used as the value of the Redis,
the judging control module judges whether the user equipment which requests to log in is the user equipment which currently records the user login information according to the user login information, if so, the user equipment requests to log in, otherwise, the user login information of the logged-in user equipment in Redis is cleared, the user login information of the user equipment which currently requests to log in is recorded, and a user account is controlled to log in the single equipment.
The information interaction, execution process and other contents between the modules in the system are based on the same concept as the method embodiment of the present invention, and specific contents can be referred to the description in the method embodiment of the present invention, and are not described herein again.
Likewise, the system of the present invention can solve the single device login problem of limiting a price or secured account number in a distributed system. The system supports quick query through Redis, avoids reading and writing of the database, and solves the problem of data information sharing of the distributed system; the key overdue setting can be supported through Redis, login users who do not operate for a long time need login verification when operating again, and meanwhile, the response speed of the system is improved.
It should be noted that not all steps and modules in the above flows and system structure diagrams are necessary, and some steps or modules may be omitted according to actual needs. The execution order of the steps is not fixed and can be adjusted as required. The system structure described in the above embodiments may be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by a plurality of physical entities, or some components in a plurality of independent devices may be implemented together.
The above-mentioned embodiments are merely preferred embodiments for fully illustrating the present invention, and the scope of the present invention is not limited thereto. The equivalent substitution or change made by the technical personnel in the technical field on the basis of the invention is all within the protection scope of the invention. The protection scope of the invention is subject to the claims.

Claims (8)

1. A method for controlling single account equipment login of a distributed system based on Redis is characterized in that Redis is used for recording user login information of the distributed system, wherein user id is used as key of Redis, the user login information is encrypted and then used as value of Redis,
judging whether the user equipment requesting login is the user equipment currently recording the user login information according to the user login information, if so, receiving the request of the user equipment to log in, otherwise, clearing the user login information of the logged-in user equipment in Redis, recording the user login information of the user equipment currently requesting login, and controlling a user account to log in single equipment.
2. The method for controlling single device login of account based on Redis in a distributed system according to claim 1, wherein the step of encrypting the user login information to be the value of Redis comprises:
the user login information is encrypted by MD5 and is referred to as value of Redis.
3. The method for controlling account single device login based on Redis in a distributed system according to claim 1 or 2, wherein the determining whether the user device requesting login is the user device currently recording the user login information according to the user login information comprises:
obtaining a value from Redis according to the user id, obtaining user login information according to the value, and judging whether the user equipment requesting login is the user equipment currently recording the user login information according to the user login information.
4. The method according to claim 3, wherein the user login information includes login device information, and the user device requesting login is determined whether to be the user device currently recording the user login information according to the login device information.
5. A distributed system for controlling single-device login based on Redis is characterized by comprising an acquisition recording module and a judgment control module,
the acquisition recording module acquires user login information of a distributed system recorded by Redis, wherein the user id is used as the key of the Redis, the user login information is encrypted and then used as the value of the Redis,
the judging control module judges whether the user equipment which requests to log in is the user equipment which currently records the user login information according to the user login information, if so, the user equipment requests to log in, otherwise, the user login information of the logged-in user equipment in Redis is cleared, the user login information of the user equipment which currently requests to log in is recorded, and a user account is controlled to log in the single equipment.
6. The distributed system based on Redis control account single device login according to claim 5, wherein the obtaining and recording module obtains user login information of the distributed system recorded by Redis, wherein the user login information is encrypted by MD5 and then is used as the value of Redis.
7. The distributed system according to claim 5 or 6, wherein the determining control module determines whether the user device requesting login is a user device currently recording user login information according to the user login information, comprising:
obtaining a value from Redis according to the user id, obtaining user login information according to the value, and judging whether the user equipment requesting login is the user equipment currently recording the user login information according to the user login information.
8. The distributed system according to claim 3, wherein the user login information includes login device information, and the determination control module determines whether the user device requesting login is a user device currently recording the user login information according to the login device information.
CN202111517445.3A 2021-12-13 2021-12-13 Method for controlling account single device login based on Redis in distributed system Pending CN114238888A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111517445.3A CN114238888A (en) 2021-12-13 2021-12-13 Method for controlling account single device login based on Redis in distributed system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111517445.3A CN114238888A (en) 2021-12-13 2021-12-13 Method for controlling account single device login based on Redis in distributed system

Publications (1)

Publication Number Publication Date
CN114238888A true CN114238888A (en) 2022-03-25

Family

ID=80755087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111517445.3A Pending CN114238888A (en) 2021-12-13 2021-12-13 Method for controlling account single device login based on Redis in distributed system

Country Status (1)

Country Link
CN (1) CN114238888A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115801320A (en) * 2022-10-19 2023-03-14 慧之安信息技术股份有限公司 Single-device login control method for Redis control account in distributed system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110708320A (en) * 2019-10-11 2020-01-17 北京弘远博学科技有限公司 Method for controlling number of user APP login devices based on Redis
CN111294335A (en) * 2020-01-14 2020-06-16 上海风秩科技有限公司 Login method and device
CN112243007A (en) * 2020-10-15 2021-01-19 广东科徕尼智能科技有限公司 Single-user login method, equipment and storage medium
CN112968862A (en) * 2020-12-31 2021-06-15 南京联创互联网技术有限公司 Single sign-on method and device based on redis

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110708320A (en) * 2019-10-11 2020-01-17 北京弘远博学科技有限公司 Method for controlling number of user APP login devices based on Redis
CN111294335A (en) * 2020-01-14 2020-06-16 上海风秩科技有限公司 Login method and device
CN112243007A (en) * 2020-10-15 2021-01-19 广东科徕尼智能科技有限公司 Single-user login method, equipment and storage medium
CN112968862A (en) * 2020-12-31 2021-06-15 南京联创互联网技术有限公司 Single sign-on method and device based on redis

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115801320A (en) * 2022-10-19 2023-03-14 慧之安信息技术股份有限公司 Single-device login control method for Redis control account in distributed system

Similar Documents

Publication Publication Date Title
US11030084B2 (en) API specification parsing at a mocking server
CN111414643B (en) Data authority control method, device, server and storage medium
EP2240899B1 (en) Systems and methods for delegating access to online accounts
US9239762B1 (en) Method and apparatus for virtualizing file system placeholders at a computer
US20130227047A1 (en) Methods for managing content stored in cloud-based storages
US8181236B2 (en) Method for and apparatus for retrieving username and password in an authentication protocol
US11294973B2 (en) Codeless information service for abstract retrieval of disparate data
US10521423B2 (en) Apparatus and methods for scanning data in a cloud storage service
CN107315972B (en) A kind of big data unstructured document dynamic desensitization method and system
WO2022142536A1 (en) Grayscale publishing method, system and apparatus, and device and storage medium
CN105631035A (en) Data storage method and device
US20150020167A1 (en) System and method for managing files
JP2014119962A (en) Information communication system, authentication device, access control method of information communication system, and access control program
CN117171108B (en) Virtual model mapping method and system
CN114238888A (en) Method for controlling account single device login based on Redis in distributed system
CN113590554B (en) File processing method, device, electronic device and storage medium
CN119248799A (en) Database multi-transaction processing method, device, equipment and storage medium
US10360234B2 (en) Recursive extractor framework for forensics and electronic discovery
CN114676439A (en) Configuration-oriented dynamic structured data management method
US20120089849A1 (en) Cookie management system and method
CN115268797B (en) Method for realizing system and object storage communication through WebDav
JP4873185B2 (en) Audit log generation system and method
KR102742443B1 (en) Method, server and computer program for file continuation transfer using indexed-db in web browsers
US11671417B2 (en) Information processing apparatus and non-transitory computer readable medium
CN103795796A (en) Management method for files forced to be centralized

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20220325

RJ01 Rejection of invention patent application after publication