[go: up one dir, main page]

CN113268720B - Front-end and back-end separation system operation method and device - Google Patents

Front-end and back-end separation system operation method and device Download PDF

Info

Publication number
CN113268720B
CN113268720B CN202110608987.5A CN202110608987A CN113268720B CN 113268720 B CN113268720 B CN 113268720B CN 202110608987 A CN202110608987 A CN 202110608987A CN 113268720 B CN113268720 B CN 113268720B
Authority
CN
China
Prior art keywords
unique identifier
request
verification information
rear end
login
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.)
Active
Application number
CN202110608987.5A
Other languages
Chinese (zh)
Other versions
CN113268720A (en
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.)
Guangdong Huanwang Technology Co Ltd
Original Assignee
Guangdong Huanwang Technology 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 Guangdong Huanwang Technology Co Ltd filed Critical Guangdong Huanwang Technology Co Ltd
Priority to CN202110608987.5A priority Critical patent/CN113268720B/en
Publication of CN113268720A publication Critical patent/CN113268720A/en
Application granted granted Critical
Publication of CN113268720B publication Critical patent/CN113268720B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Storage Device Security (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a front-end and back-end separation system operation method and device, belonging to the field of system login; when the front end initiates a request, if the front end has a unique identifier, the front end sends the unique identifier to the rear end; if the unique identification does not exist, a user name and a password are sent to the back end; the back end can verify whatever information is sent; the request result may be given according to the verification result. After successful login, the front end stores the unique identifier, and when the request is initiated again, the stored unique identifier is sent to the rear end, and the rear end verifies whether the unique identifier is valid or not, so that the request can be responded. The login state of the system is kept in a development mode of front-end and rear-end separation.

Description

Front-end and back-end separation system operation method and device
Technical Field
The present invention relates to a system login technology, and in particular, to a front-end and back-end separation system operation method and apparatus.
Background
In the traditional system development, the concept of front-end and back-end separation is not available, and the front-end page and the back-end interface are the same item, so that the initiated request is processed based on one item, and the login state of the user can be identified and stored based on the sessionId of the request when the request is the same item;
after the front end and the back end are separated, two sessionIds are generated at the front end and the back end respectively for one request, and the login state of the user cannot be identified based on the sessionIds because the different items are different, so that the user login state cannot be maintained similar to the original user login state after the front end and the back end are separated.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides a front-end and back-end separation system operation method and device, and aims to solve the problem that after a development mode of front-end and back-end separation is adopted, a system cannot store a user login state.
The technical scheme adopted for solving the technical problems is as follows:
in one aspect of the present invention,
the front end and back end separation system operation method is characterized in that the front end of the system is developed by Vue, the back end of the system is developed by springboot, and the operation method comprises the following steps:
when the front end initiates a request, judging whether the front end stores a unique identifier or not;
controlling the front end to send verification information to the rear end according to a judging result, wherein the verification information comprises the unique identifier or a user name and a password;
and the rear end receives the verification information, verifies the verification information, and gives out a request result according to the verification result.
Further, when the front end does not store the unique identification, a user name and a password are sent to the back end.
Further, the step of receiving the verification information at the back end, verifying the verification information, and providing a request result according to the verification result includes:
judging whether the user name and the password are correct or not;
if not, the request result is login failure; if the request is correct, the request result is that the login is successful.
Further, the method further comprises the following steps:
when login is successful, the rear end acquires the current login state and generates a unique identifier according to the current login state;
the back end sends the unique identification to the front end so that the front end stores the unique identification.
Further, after the front end stores the unique identifier, the request is sent to the back end again, and the stored unique identifier is sent to the back end.
Further, the step of receiving the verification information at the back end, verifying the verification information, and providing a request result according to the verification result includes:
judging whether the unique identifier is valid or not;
if so, completing the request; if not, prompting the user that the login fails.
Further, when the back end generates the unique identifier, setting a valid time for the unique identifier, and determining whether the unique identifier is valid includes:
when the rear end receives the unique identifier, acquiring the receiving time for receiving the unique identifier;
judging whether the receiving time is within the effective time or not;
if yes, the unique identification is valid; if not, the unique identification is invalid.
Further, when active, the active time is prolonged.
In a second aspect of the present invention,
the front end and back end separation system operating device, the front end of the system adopts Vue development, the back end adopts springboot development, the operating device includes:
the unique identifier judging module is used for judging whether the front end stores a unique identifier or not when the front end initiates a request;
the verification information sending module is used for controlling the front end to send verification information to the rear end according to the judging result, wherein the verification information comprises the unique identifier or the user name and the password;
and the verification information verification module is used for verifying the verification information after the rear end receives the verification information and giving out a request result according to the verification result.
The application adopts the technical scheme, possesses following beneficial effect at least:
the technical scheme of the application provides a front-end and back-end separation system operation method and device, when a front end initiates a request, if a unique identifier exists at the front end, the unique identifier is sent to a back end; if the unique identification does not exist, a user name and a password are sent to the back end; the back end can verify whatever information is sent; the request result may be given according to the verification result. After successful login, the front end stores the unique identifier, and when the request is initiated again, the stored unique identifier is sent to the rear end, and the rear end verifies whether the unique identifier is valid or not, so that the request can be responded. The login state of the system is kept in a development mode of front-end and rear-end separation.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method of operation of a front-end and back-end separation system according to an embodiment of the present invention;
fig. 2 is a block diagram of an operating device of a front-end and back-end separation system according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present invention will be described in detail with reference to the accompanying drawings and examples. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present application. All other embodiments, based on the examples herein, which are within the scope of the protection sought by those of ordinary skill in the art without undue effort, are intended to be encompassed by the present application.
Referring to fig. 1, an embodiment of the present invention provides a front-back end separation system operation method, where the front end of the system is developed by Vue, the back end of the system is developed by springboot, and the operation method includes the following steps:
when the front end initiates a request, judging whether the front end stores a unique identifier;
the front end is controlled to send verification information to the rear end according to the judging result, wherein the verification information comprises a unique identifier or a user name and a password;
the rear end receives the verification information, verifies the verification information, and gives out a request result according to the verification result.
According to the front-end and back-end separation system operation method provided by the embodiment of the invention, when the front end initiates a request, if the front end has a unique identifier, the unique identifier is sent to the back end; if the unique identification does not exist, a user name and a password are sent to the back end; the back end can verify whatever information is sent; the request result may be given according to the verification result. After successful login, the front end stores the unique identifier, and when the request is initiated again, the stored unique identifier is sent to the rear end, and the rear end verifies whether the unique identifier is valid or not, so that the request can be responded. The login state of the system is kept in a development mode of front-end and rear-end separation.
As a supplementary explanation to the above embodiment, when the front end does not store the unique identification, the user name and the password are transmitted to the back end. The back end judges whether the user name and the password are correct; if not, the request result is login failure; if the request is correct, the request result is that the login is successful.
When the login is successful, the back end acquires the current login state and generates a unique identifier according to the current login state; the back-end sends the unique identification to the front-end so that the front-end stores the unique identification. After the unique identifier is stored in the front end, the request is sent to the back end again, and the stored unique identifier is sent to the back end.
After the rear end receives the stored unique identifier, judging whether the unique identifier is valid or not;
if so, completing the request; if not, prompting the user that the login fails.
As an optional implementation manner of the embodiment of the present invention, when the back end generates the unique identifier, setting an effective time for the unique identifier, and determining whether the unique identifier is effective includes:
when the rear end receives the unique identifier, acquiring the receiving time for receiving the unique identifier; judging whether the receiving time is within the effective time or not; if yes, the unique identification is valid; if not, the unique identification is invalid.
When effective, the effective time is prolonged. For example, if the set valid time is a preset time period, that is, the unique identifier is valid within the preset time period after the login is successful. And when the request is initiated again and the unique identifier is validated by the back end, the validity period of the unique identifier is reset to the preset period of time from the time when the unique identifier is validated.
In order to more specifically describe the scheme of the embodiment of the present invention, a practical operation flow is provided below; the method comprises the following steps:
1. the front end and the back end carry out docking development through a login interface, vue is responsible for developing a front-end login page, and the back-end springboot is responsible for user name password verification of login and verification of user login state maintenance.
2. Firstly, the Vue calls a login interface developed by the back-end springboot, a user name and a password are transmitted to the back-end through the interface, and the back-end checks whether the user name and the password are correct or not.
3. The backend passes the verification of the user name and password, automatically generates a unique identifier for the current login state of the user, stores the unique identifier in the cache system, updates the expiration time of the identifier, for example, 30 minutes, and returns to the Vue.
4. After receiving the unique identifier returned by the back-end springboot, the Vue stores the identifier in the local storage, and each subsequent request is provided with the unique identifier in the http header of the request.
5. And the back end checks whether the identifier exists in the cache system or not in each subsequent request, if the identifier does not exist in the cache system, the user is prompted to log in to be invalid, and if the identifier exists in the cache system, the expiration time of the identifier is updated. Illustratively, the time to generate the unique identifier is 13:00. The expiration time is 13:30. the unique identification received during this period is valid and the user can log in. After successful login, the expiration time of the unique identifier in the back end can be prolonged by 30 minutes from the login, for example, 13: and when the login is successful at 10, the expiration time of the unique identification is prolonged to 13:40.
In one embodiment, the present invention provides a front-end and back-end separation system operating device, where the front end of the system is developed by Vue, and the back end of the system is developed by springboot, as shown in fig. 2, and the operating device includes:
the unique identifier judging module 21 is configured to judge whether the front end stores a unique identifier when the front end initiates a request;
the verification information sending module 22 is configured to control the front end to send verification information to the back end according to the determination result, where the verification information includes a unique identifier or a user name and a password;
the verification information verification module 23 is configured to verify the verification information after the back end receives the verification information, and give a request result according to the verification result.
When the unique identification judging module judges that the front end does not store the unique identification, the verification information sending module sends the user name and the password to the rear end. After the rear end receives the user name and the password, the verification information verification module judges whether the user name and the password are correct or not; if not, the request result is login failure; if the request is correct, the request result is that the login is successful.
When the login is successful, the back end acquires the current login state and generates a unique identifier according to the current login state; the back-end sends the unique identification to the front-end so that the front-end stores the unique identification.
When the unique identifier judging module judges that the front end stores the unique identifier, the transmitting module transmits the stored unique identifier to the rear end while initiating a request to the rear end again.
After the rear end receives the stored unique identifier, the verification information verification module judges whether the unique identifier is valid or not;
if so, completing the request; if not, prompting the user that the login fails.
As an optional implementation manner of the embodiment of the present invention, when the back end generates the unique identifier, setting an effective time for the unique identifier, and determining whether the unique identifier is effective includes:
when the rear end receives the unique identifier, acquiring the receiving time for receiving the unique identifier; judging whether the receiving time is within the effective time or not; if yes, the unique identification is valid; if not, the unique identification is invalid.
When effective, the effective time is prolonged.
According to the operating device provided by the embodiment of the invention, when a front end initiates a request, the unique identification judging module judges whether the front end stores the unique identification or not; the verification information sending module controls the front end to send verification information to the rear end according to the judging result, wherein the verification information comprises a unique identifier or a user name and a password; the rear end receives the verification information, verifies the verification information by the verification information verification module, and gives out a request result according to the verification result. After the login is successful, the operation device provided by the embodiment of the invention generates the unique identifier according to the login state, and directly sends the unique identifier when the user logs in again, and if the unique identifier in the rear end is still valid at the moment, the original login state can be maintained.
It is to be understood that the same or similar parts in the above embodiments may be referred to each other, and that in some embodiments, the same or similar parts in other embodiments may be referred to.
It should be noted that in the description of the present application, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Furthermore, in the description of the present application, unless otherwise indicated, the meaning of "plurality" means at least two.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present application.
It is to be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or a portion of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, where the program may be stored in a computer readable storage medium, and where the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present application have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the application, and that variations, modifications, alternatives, and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the application.

Claims (4)

1. The front-end and back-end separation system operation method is characterized in that the front end of the system is developed by Vue, the back end of the system is developed by springboot, and the operation method comprises the following steps:
when the front end initiates a request, judging whether the front end stores a unique identifier or not;
controlling the front end to send verification information to the rear end according to a judging result, wherein the verification information comprises the unique identifier or a user name and a password;
the rear end receives the verification information, verifies the verification information, and gives out a request result according to the verification result;
the method comprises the steps that after the rear end receives the verification information, the verification information is verified, and a request result is given according to the verification result, wherein the step of:
when the front end does not store the unique identification, a user name and a password are sent to the rear end; judging whether the user name and the password are correct or not; if not, the request result is login failure; if the request is correct, the request result is successful login; when login is successful, the rear end acquires the current login state and generates a unique identifier according to the current login state; the back end sends the unique identifier to the front end so that the front end stores the unique identifier;
when the front end stores the unique identifier, sending the stored unique identifier to the rear end while initiating a request to the rear end again; judging whether the unique identifier is valid or not; if so, completing the request; if not, prompting the user that the login fails.
2. The method as recited in claim 1, further comprising: when the back end generates the unique identifier, valid time is set for the unique identifier, and the judging whether the unique identifier is valid comprises the following steps:
when the rear end receives the unique identifier, acquiring the receiving time for receiving the unique identifier;
judging whether the receiving time is within the effective time or not;
if yes, the unique identification is valid; if not, the unique identification is invalid.
3. The method according to claim 2, characterized in that: when active, the active time is prolonged.
4. The front-back end separation system operating device is characterized in that the front end of the system is developed by Vue, the back end of the system is developed by springboot, and the operating device comprises:
the unique identifier judging module is used for judging whether the front end stores a unique identifier or not when the front end initiates a request;
the verification information sending module is used for controlling the front end to send verification information to the rear end according to the judging result, wherein the verification information comprises the unique identifier or the user name and the password;
the verification information verification module is used for verifying the verification information after the rear end receives the verification information and giving a request result according to the verification result,
the method comprises the steps that after the rear end receives the verification information, the verification information is verified, and a request result is given according to the verification result, wherein the step of:
when the front end does not store the unique identification, a user name and a password are sent to the rear end; judging whether the user name and the password are correct or not; if not, the request result is login failure; if the request is correct, the request result is successful login; when login is successful, the rear end acquires the current login state and generates a unique identifier according to the current login state; the back end sends the unique identifier to the front end so that the front end stores the unique identifier;
when the front end stores the unique identifier, sending the stored unique identifier to the rear end while initiating a request to the rear end again; judging whether the unique identifier is valid or not; if so, completing the request; if not, prompting the user that the login fails.
CN202110608987.5A 2021-06-01 2021-06-01 Front-end and back-end separation system operation method and device Active CN113268720B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110608987.5A CN113268720B (en) 2021-06-01 2021-06-01 Front-end and back-end separation system operation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110608987.5A CN113268720B (en) 2021-06-01 2021-06-01 Front-end and back-end separation system operation method and device

Publications (2)

Publication Number Publication Date
CN113268720A CN113268720A (en) 2021-08-17
CN113268720B true CN113268720B (en) 2023-05-26

Family

ID=77233806

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110608987.5A Active CN113268720B (en) 2021-06-01 2021-06-01 Front-end and back-end separation system operation method and device

Country Status (1)

Country Link
CN (1) CN113268720B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023159900A1 (en) * 2022-02-25 2023-08-31 华为云计算技术有限公司 Remote development method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9419799B1 (en) * 2014-08-22 2016-08-16 Emc Corporation System and method to provide secure credential
CN106331042A (en) * 2015-07-01 2017-01-11 阿里巴巴集团控股有限公司 Single sign-on method and device for heterogeneous user system
CN109246089A (en) * 2018-08-20 2019-01-18 北京交通大学 A kind of the front and back end separation architecture access control system and method for based role
CN110120952A (en) * 2019-05-16 2019-08-13 极智(上海)企业管理咨询有限公司 A kind of total management system single-point logging method, device, computer equipment and storage medium
CN110427181A (en) * 2019-08-13 2019-11-08 山东浪潮商用系统有限公司 A kind of Web system front and back end separation method
CN110708313A (en) * 2019-10-09 2020-01-17 中国电子科技集团公司第二十八研究所 Single sign-on system and method supporting multiple modes
CN111931157A (en) * 2020-08-12 2020-11-13 广东电力信息科技有限公司 Access method, device, storage medium and computer equipment of single sign-on system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10691433B2 (en) * 2018-08-31 2020-06-23 Databricks Inc. Split front end for flexible back end cluster processing

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9419799B1 (en) * 2014-08-22 2016-08-16 Emc Corporation System and method to provide secure credential
CN106331042A (en) * 2015-07-01 2017-01-11 阿里巴巴集团控股有限公司 Single sign-on method and device for heterogeneous user system
CN109246089A (en) * 2018-08-20 2019-01-18 北京交通大学 A kind of the front and back end separation architecture access control system and method for based role
CN110120952A (en) * 2019-05-16 2019-08-13 极智(上海)企业管理咨询有限公司 A kind of total management system single-point logging method, device, computer equipment and storage medium
CN110427181A (en) * 2019-08-13 2019-11-08 山东浪潮商用系统有限公司 A kind of Web system front and back end separation method
CN110708313A (en) * 2019-10-09 2020-01-17 中国电子科技集团公司第二十八研究所 Single sign-on system and method supporting multiple modes
CN111931157A (en) * 2020-08-12 2020-11-13 广东电力信息科技有限公司 Access method, device, storage medium and computer equipment of single sign-on system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
宋清卿.前后端分离Web系统下一种访问控制方法的设计与实现.计算机时代.2020,(第5期),第27-30页. *

Also Published As

Publication number Publication date
CN113268720A (en) 2021-08-17

Similar Documents

Publication Publication Date Title
KR100442884B1 (en) Method for updating firmware
US20180013856A1 (en) Automatic data request recovery after session failure
WO2022001750A1 (en) Data synchronization processing method, electronic device, and storage medium
CN113268720B (en) Front-end and back-end separation system operation method and device
US20060259545A1 (en) Method, Apparatus and Computer Program for Facilitating Communication Between a Client Application and a Server Application
CN105292130A (en) Method and system for imbedding voice standard data, and method and system for controlling vehicles to start through voice
US7991941B2 (en) Memory access assist
CN110908691A (en) Matching method, device, equipment and medium for tire pressure monitoring system
CN111880947A (en) Data transmission method and device
US6389559B1 (en) Controller fail-over without device bring-up
CN114386005A (en) Login method and device of vehicle-mounted system, electronic equipment and readable storage medium
CN112590560A (en) Energy consumption reduction control method and device for electric automobile
CN113727299B (en) Handshake authentication method and device, readable storage medium and vehicle
CN113469676B (en) Method, device and server for synchronizing execution states of over-the-air personalized instructions
KR100550477B1 (en) Driver agent device and its method for supporting remote device driver development environment in embedded system
CN110442475A (en) Implementation method, device and the DRM device of distributed consensus group
CN116346484A (en) Linux system login method, device and equipment
CN111679930B (en) Single-point rollback method and system for CICS online transaction
KR102418404B1 (en) Apparatus and method for controlling guided control computer to update guided weapon embedded software
CN113900685A (en) Software upgrading method for automobile instrument system and automobile instrument system
CN115022017B (en) Block chain-based mobile phone bank login verification method and device
CN118714148B (en) Coroutine-based message synchronization method, device, equipment and storage medium
CN109062931B (en) Cache synchronization control method, device, system, server and readable storage medium
JP3164207B2 (en) Network operation information management method
CN106789857B (en) An information interaction method, device and cache system

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
GR01 Patent grant
GR01 Patent grant