[go: up one dir, main page]

CN113268720A - 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
CN113268720A
CN113268720A CN202110608987.5A CN202110608987A CN113268720A CN 113268720 A CN113268720 A CN 113268720A CN 202110608987 A CN202110608987 A CN 202110608987A CN 113268720 A CN113268720 A CN 113268720A
Authority
CN
China
Prior art keywords
unique identifier
request
verification information
back end
result
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.)
Granted
Application number
CN202110608987.5A
Other languages
Chinese (zh)
Other versions
CN113268720B (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 a 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 back end; if the unique identification does not exist, sending a user name and a password to a back end; the back end can verify whatever information is sent; the request result may be given based on the verification result. When the login is successful, the front end stores the unique identifier, when the request is initiated again, the stored unique identifier is sent to the back end, and the back end verifies whether the unique identifier is valid or not, so that the request can be responded when the unique identifier is valid. The login state of the system is kept in a development mode with a front end and a back end separated.

Description

Front-end and back-end separation system operation method and device
Technical Field
The present invention relates to system login technologies, and in particular, to a method and an apparatus for operating a front-end and back-end separation system.
Background
In the traditional system development, a concept of front-end and back-end separation is not provided, and a front-end page and a back-end interface are the same project, so that initiated requests are processed based on one project, and the login state of a user can be identified and stored based on the sessionId of the request in the same project;
after the front-end and back-end separation is used, two sessionIds are generated at the front end and the back end respectively due to two items, and the login state of the user cannot be identified based on the sessionIds because the sessionIds are different in different items, so that the similar original user login state cannot be maintained after the front-end and back-end separation occurs.
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, which are used for solving the problem that a system cannot store a user login state after a front-end and back-end separation development mode is adopted.
The technical scheme adopted by the invention for solving the technical problems is as follows:
on the one hand, the method comprises the following steps of,
an operation method of a front-end and back-end separation system, 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 the judgment result, wherein the verification information comprises the unique identifier or a user name and a password;
and the rear end verifies the verification information after receiving the verification information and gives a request result according to the verification result.
Further, when the front end does not store the unique identifier, a user name and a password are sent to the back end.
Further, the verifying the verification information after the backend receives the verification information, and giving 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 result is correct, the request result is successful login.
Further, still include:
after login is successful, the back end acquires the current login state and generates a unique identifier according to the current login state;
and the back end sends the unique identifier to the front end so that the front end can store the unique identifier.
Further, after the front end stores the unique identifier, the front end sends the stored unique identifier to the back end while initiating a request to the back end again.
Further, the verifying the verification information after the backend receives the verification information, and giving a request result according to the verification result includes:
judging whether the unique identifier is valid;
if the request is valid, the request is completed; and if the login is invalid, prompting the user that the login fails.
Further, when the back end generates a unique identifier, setting valid time for the unique identifier, and determining whether the unique identifier is valid includes:
when the back end receives the unique identifier, acquiring the receiving time of the received unique identifier;
judging whether the receiving time is within the effective time or not;
if so, the unique identifier is valid; if not, the unique identification is invalid.
Further, when active, the active time is extended.
In a second aspect of the present invention,
an operating device for a front-end and back-end separation system, the front end of the system being developed using Vue and the back end being developed using springboot, the operating device comprising:
the unique identifier judging module is used for judging whether the front end stores the 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 a judgment result, and the verification information comprises the unique identifier or a user name and a password;
and the verification information verification module is used for verifying the verification information after the back end receives the verification information and giving a request result according to the verification result.
This application adopts above technical scheme, possesses following beneficial effect at least:
the technical scheme of the application provides a method and a device for operating a front-end and back-end separation system, when a front end initiates a request, if the front end has a unique identifier, the front end sends the unique identifier to a back end; if the unique identification does not exist, sending a user name and a password to a back end; the back end can verify whatever information is sent; the request result may be given based on the verification result. When the login is successful, the front end stores the unique identifier, when the request is initiated again, the stored unique identifier is sent to the back end, and the back end verifies whether the unique identifier is valid or not, so that the request can be responded when the unique identifier is valid. The login state of the system is kept in a development mode with a front end and a back end separated.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart of a method of operating a front-end separation system and a back-end separation system in accordance with an embodiment of the present invention;
fig. 2 is a structural diagram of an operating device of a front-end and back-end separation system according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following detailed description of the technical solutions of the present invention is provided with reference to the accompanying drawings and examples. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, an embodiment of the present invention provides an operation method for a front-end and back-end separation system, where the front end of the system is developed by Vue, and the back end of the system is developed by a springboot, and the operation method includes the following steps:
when a 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 back end according to the judgment result, wherein the verification information comprises a unique identifier or a user name and a password;
the back end receives the verification information and verifies the verification information, and a request result is given according to the verification result.
In the method for operating a front-end and back-end separation system provided by the embodiment of the invention, when a front end initiates a request, if the front end has a unique identifier, the unique identifier is sent to a back end; if the unique identification does not exist, sending a user name and a password to a back end; the back end can verify whatever information is sent; the request result may be given based on the verification result. When the login is successful, the front end stores the unique identifier, when the request is initiated again, the stored unique identifier is sent to the back end, and the back end verifies whether the unique identifier is valid or not, so that the request can be responded when the unique identifier is valid. The login state of the system is kept in a development mode with a front end and a back end separated.
As a supplementary explanation to the above embodiment, when the front end does not store the unique identifier, the user name and password are sent to the back end. The back end judges whether the user name and the password are correct or not; if not, the request result is login failure; if the result is correct, the request result is successful login.
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 identifier to the front end so that the front end can store the unique identifier. And after the front end stores the unique identifier, sending the stored unique identifier to the back end while initiating a request to the back end again.
After receiving the stored unique identifier, the rear end judges whether the unique identifier is valid;
if the request is valid, the request is completed; and if the login is invalid, 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 back end receives the unique identifier, acquiring the receiving time of the received unique identifier; judging whether the receiving time is within the effective time; if so, the unique identifier is valid; if not, the unique identifier is invalid.
When effective, the effective time is prolonged. Illustratively, if the set valid time is a preset time period, that is, within the preset time period after the login is successful, the unique identifier is valid. And when the request is initiated again and the back-end verifies that the unique identifier is valid, resetting the valid time limit of the unique identifier to be a preset time period from the time when the unique identifier is verified to be valid.
To more specifically illustrate the solution of the embodiment of the present invention, the following provides a practical operation flow; the method comprises the following steps:
1. the front end and the back end are in butt joint development through a login interface, Vue is responsible for developing a front end login page, and the back end springboot is responsible for verifying login user name and password and maintaining the login state of the user.
2. Firstly Vue calls a login interface developed by a rear-end springboot, transmits a user name and a password to the rear end through the interface, and the rear end verifies whether the user name and the password are correct.
3. The back-end passes the verification of the username and password, updates the expiration time of the identifier, e.g., 30 minutes, by automatically generating a unique identifier for the current login status of the user, storing it in the cache system, and returns Vue.
4. Vue, after receiving the unique identifier returned by the backend springboot, stores the identifier in a local storage, and each subsequent request carries the unique identifier in the http header of the request.
5. And the back end checks whether the identifier exists in the cache system in each subsequent request, prompts a user to fail in login if the identifier does not exist in the cache system, and updates the expiration time of the identifier if the identifier exists in the cache system. Illustratively, the time to generate the unique identifier is 13: 00. The expiration time is 13: 30. then 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 backend may be extended by 30 minutes from the login, such as 13: when the login is successful at 10 hours, the expiration time of the unique identifier is extended to 13: 40.
In one embodiment, the present invention provides an operation device for a front-end and back-end separated system, the front end of the system is developed by Vue, and the back end is developed by springboot, as shown in fig. 2, the operation 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;
and the verification information verification module 23 is used for verifying the verification information after the back end receives the verification information and giving a request result according to the verification result.
And when the unique identification judgment 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 result is correct, the request result is successful login.
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 identifier to the front end so that the front end can store the unique identifier.
And when the unique identification judgment module judges that the front end stores the unique identification, the sending module sends the stored unique identification to the back end while sending a request to the back end again.
After the back end receives the stored unique identifier, the verification information verification module judges whether the unique identifier is valid;
if the request is valid, the request is completed; and if the login is invalid, 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 back end receives the unique identifier, acquiring the receiving time of the received unique identifier; judging whether the receiving time is within the effective time; if so, the unique identifier is valid; if not, the unique identifier is invalid.
When effective, the effective time is prolonged.
According to the operation device provided by the embodiment of the invention, when the front end initiates a request, the unique identifier judging module judges whether the front end stores the unique identifier or not; the verification information sending module controls the front end to send verification information to the back end according to the judgment result, wherein the verification information comprises a unique identifier or a user name and a password; and the back end receives the verification information, then the verification information verification module verifies the verification information and gives a request result according to the verification result. The operating device provided by the embodiment of the invention generates the unique identifier according to the login state after the login is successful, directly sends the unique identifier when logging in again, and can maintain the original login state if the unique identifier in the back end is still valid at the moment.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that, in the description of the present application, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present application, the meaning of "a plurality" means at least two unless otherwise specified.
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 the scope of the preferred embodiments of the present application includes other implementations 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 present application.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," 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 application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. 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 is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.

Claims (9)

1. An operation method of a front-end and back-end separation system 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 the judgment result, wherein the verification information comprises the unique identifier or a user name and a password;
and the rear end verifies the verification information after receiving the verification information and gives a request result according to the verification result.
2. The method of claim 1, wherein: and when the front end does not store the unique identifier, sending a user name and a password to the back end.
3. The method of claim 2, wherein: the back end receives the verification information and then verifies the verification information, and the request result is given according to the verification result, wherein the request result comprises the following steps:
judging whether the user name and the password are correct or not;
if not, the request result is login failure; if the result is correct, the request result is successful login.
4. The method of claim 3, further comprising:
after login is successful, the back end acquires the current login state and generates a unique identifier according to the current login state;
and the back end sends the unique identifier to the front end so that the front end can store the unique identifier.
5. The method of claim 4, wherein: and after the front end stores the unique identifier, initiating a request to the back end again and simultaneously sending the stored unique identifier to the back end.
6. The method of claim 5, wherein: the back end receives the verification information and then verifies the verification information, and the request result is given according to the verification result, wherein the request result comprises the following steps:
judging whether the unique identifier is valid;
if the request is valid, the request is completed; and if the login is invalid, prompting the user that the login fails.
7. The method of claim 6, further comprising: when the back end generates the unique identifier, setting effective time for the unique identifier, and judging whether the unique identifier is effective or not comprises the following steps:
when the back end receives the unique identifier, acquiring the receiving time of the received unique identifier;
judging whether the receiving time is within the effective time or not;
if so, the unique identifier is valid; if not, the unique identification is invalid.
8. The method of claim 7, wherein: when active, the active time is extended.
9. An operating device for a front-end and back-end separation system, the front end of the system being developed using Vue, the back end being developed using springboot, the operating device comprising:
the unique identifier judging module is used for judging whether the front end stores the 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 a judgment result, and the verification information comprises the unique identifier or a user name and a password;
and the verification information verification module is used for verifying the verification information after the back end receives the verification information and giving a request result according to the verification result.
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 true CN113268720A (en) 2021-08-17
CN113268720B 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)

Cited By (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 (8)

* 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
US20200073644A1 (en) * 2018-08-31 2020-03-05 Databricks Inc. Split front end for flexible back end cluster processing
CN111931157A (en) * 2020-08-12 2020-11-13 广东电力信息科技有限公司 Access method, device, storage medium and computer equipment of single sign-on system

Patent Citations (8)

* 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
US20200073644A1 (en) * 2018-08-31 2020-03-05 Databricks Inc. Split front end for flexible back end cluster processing
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系统下一种访问控制方法的设计与实现", 计算机时代 *

Cited By (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

Also Published As

Publication number Publication date
CN113268720B (en) 2023-05-26

Similar Documents

Publication Publication Date Title
WO2022001750A1 (en) Data synchronization processing method, electronic device, and storage medium
CN108334545B (en) Method and device for realizing asynchronous service
US9778998B2 (en) Data restoration method and system
CN107040563B (en) Asynchronous service processing method and server
US20130151468A1 (en) File synchronization method and device
US20210320977A1 (en) Method and apparatus for implementing data consistency, server, and terminal
CN102203779B (en) Method for updating data and control apparatus thereof
CN108509298B (en) Data processing method, device and storage medium
CN106534105B (en) Login method and device
US8006248B2 (en) Method, apparatus and computer program for facilitating communication between a client application and a server application
CN113268720A (en) Front-end and back-end separation system operation method and device
CN108259618A (en) The data interactive processing method and device of a kind of synchronization
US9811080B2 (en) Measuring performance of an appliance
CN108874947B (en) Data processing system and data processing method
CN108228789B (en) Synchronous abnormity recovery method and device triggered by slave node
CN110413687A (en) Distributed transaction fault processing method and related equipment based on node mutual authentication verification
CN111880947A (en) Data transmission method and device
CN103024015A (en) Flex based cross-platform method for uploading files after message digest 5 (md5) value is checked at browser end
CN113641455B (en) Message conversion method and platform
CN113935010A (en) Mobile banking login method and device based on blockchain and 5G messages
CN113872764A (en) Vehicle digital certificate management method and device
CN111708780B (en) Distributed form system, partition master selection method, device, server and medium
CN112732566B (en) Application user session timeout test method, backend, foreground and system
CN110442475B (en) Realization method, device and DRM equipment of distributed consistency group
CN113568398A (en) Configuration deleting method and system for distributed control 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