File access authentication method, device, equipment and storage medium

By introducing the permission verification mechanism of the service authorization code in the token generation process in the microservice architecture, the problem of insufficient security in the token generation process in the microservice architecture is solved, and higher file access authentication security is achieved.

CN115996141BActive Publication Date: 2024-09-20SHENZHEN LANLING SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211446405.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-18
Publication Date
2024-09-20
Estimated Expiration
2042-11-18

AI Technical Summary

Technical Problem

In the microservice architecture, the token generation process lacks security management, resulting in high security risks during token use, and it is impossible to ensure that tokens are not copied and abused.

Method used

Receive the token generation request through the first backend microservice, generate the service authorization code and send it to the second backend microservice for permission verification. Only when the permission verification passes, the access token is generated and sent, using the service Authorization codes are managed securely to prevent tokens from being copied at will.

Benefits of technology

It improves the security of the file access authentication process, reduces the risk of token abuse, and ensures the legitimacy and validity of the token.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115996141B
    Figure CN115996141B
Patent Text Reader

Abstract

Embodiments of the present invention provide a file access authentication method, device, equipment and storage medium, and relate to the field of artificial intelligence technology. The method includes: receiving a token generation request, and then the first backend microservice generates a service authorization code according to the request information, the first backend microservice sends the service authorization code to the second backend microservice, and then the second backend microservice performs a permission check on the service authorization code, and according to the permission check result, the second backend microservice responds to the token generation request to generate an access token for file access and sends it to the request subject. The second backend microservice uses the aforementioned generated service authorization code to perform a permission check, and only generates an access token for file access when the permission check passes. The service authorization code is used for security management during the token generation process to prevent the token from being copied at will, overcome the problem of high security risks during the use of the token, and improve the security of the file access authentication process using the token.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a file access authentication method, device, equipment and storage medium. Background Art

[0002] Microservice architecture is a distributed framework that is mainly used to deploy applications and services in the cloud. Microservice architecture is to develop a single program into a microservice. Each microservice runs in its own process and uses lightweight mechanisms to communicate. These services are divided and built around business capabilities and are independently deployed through a fully automated deployment mechanism. Different microservices can use different programming languages ​​and different data storage technologies to ensure minimal centralized management.

[0003] In the related art, if a user business needs to use a token for access control, and if the user business needs multiple microservices to provide services, one of the microservices generates a token and returns it to the user business according to the pre-agreed agreement. As the business proceeds, different microservices provide services based on the token. This method does not perform security management on the token generation process, and cannot ensure that the generated token is not fabricated, resulting in a high security risk during the use of the token. Summary of the invention

[0004] The main purpose of the embodiments of the present application is to propose a file access authentication method, apparatus, device and storage medium to improve the security of the file access authentication process.

[0005] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes a file access authentication method, comprising:

[0006] receiving a token generation request from a request subject, wherein the token generation request includes request information;

[0007] The first backend microservice generates a service authorization code according to the request information;

[0008] The first backend microservice sends the service authorization code to the second backend microservice;

[0009] The second backend microservice performs permission verification on the service authorization code;

[0010] According to the permission verification result, the second backend microservice generates an access token according to the token generation request and the service authorization code, and sends it to the request subject, so that the request subject can use the access token to access files of the second backend microservice.

[0011] In one embodiment, the first backend microservice generates a service authorization code according to the request information, including:

[0012] The first backend microservice uses the permission control module to determine whether to authorize according to the request information;

[0013] If the judgment result is authorization, the authority control module is used to generate the service authorization code according to a preset authorization code format.

[0014] In one embodiment, the request information includes: requesting user information, operation file information and file permission information; the permission control module generates the service authorization code according to a preset authorization code format, including:

[0015] Generate authorization code parameters according to the request information, the authorization code parameters including: request user parameters, operation file parameters and file permission parameters;

[0016] Based on the preset authorization code format, the service authorization code of the authorization code parameter is generated.

[0017] In one embodiment, the operation file information includes: an operation document class name and an operation document number; the service authorization code generated based on the preset authorization code format and the authorization code parameter includes:

[0018] Generate the operation file parameters according to the operation document class name and the operation document number, the operation file parameters include: operation document class parameters and operation document number parameters;

[0019] The operation file parameters are concatenated with the request user parameters to obtain the first authorization code information;

[0020] The service authorization code is obtained by concatenating the file permission parameter with the first authorization code information.

[0021] In one embodiment, after generating the service authorization code of the authorization code parameters based on the preset authorization code format, the method further includes: encrypting the service authorization code using a preset encryption algorithm and a preset key to obtain the encrypted service authorization code.

[0022] In one embodiment, the requested user information is a user session ID.

[0023] In one embodiment, the service authorization code includes at least one of the file permission parameters, and different file permission parameters are generated by separating them using a preset separator.

[0024] In one embodiment, the second backend microservice performs permission verification on the service authorization code, including:

[0025] Obtain the authorization code parameter in the service authorization code;

[0026] If the authorization code parameters meet the permission verification conditions, the permission verification passes.

[0027] In one embodiment, if the authorization code parameter satisfies the permission verification condition, the permission verification passes, including:

[0028] If the current user is determined to be an authorized user according to the request user parameters, the first permission check is passed;

[0029] If it is determined according to the operation file parameters that the file requested for operation is an authorized file, then the second permission check passes;

[0030] If the file operation permission is determined to be an authorized interface according to the file permission parameter, the third permission check passes;

[0031] If the first permission check passes, the second permission check passes, and the third permission check passes, the permission check passes.

[0032] In one embodiment, if any one of the first permission check, the second permission check and the third permission check fails, the authorization code parameter does not meet the permission check condition, and a check error code is returned.

[0033] In one embodiment, according to the permission verification result, the second backend microservice generates an access token according to the token generation request and the service authorization code, including:

[0034] Generate first token information;

[0035] Generate token parameters according to the token generation request;

[0036] Add the token parameter and the service authorization code to the first token information to obtain a plaintext token;

[0037] Encrypt the plaintext token using a preset encryption algorithm and a preset key to obtain the access token;

[0038] The access token is sent to the request body.

[0039] In one embodiment, the token parameters include: timestamp information; the appending of the token parameters and the service authorization code to the first token information to obtain a plaintext token includes:

[0040] Add the timestamp information to the first token information to obtain second token information;

[0041] The authorization code parameter of the service authorization code is added to the second token information to obtain the plain text token.

[0042] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a file access authentication device, comprising:

[0043] A first request receiving unit: configured to receive a token generation request from a request subject, wherein the token generation request includes request information;

[0044] Service authorization code generation unit: used for the first backend microservice to generate a service authorization code according to the request information;

[0045] Service authorization code sending unit: used for the first backend microservice to send the service authorization code to the second backend microservice;

[0046] Permission verification unit: used for the second backend microservice to perform permission verification on the service authorization code;

[0047] Token generation unit: used to generate an access token according to the permission verification result, and the second backend microservice generates an access token according to the token generation request and the service authorization code and sends it to the request subject, so that the request subject can use the access token to access files of the second backend microservice.

[0048] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.

[0049] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium, and the storage medium stores a computer program. When the computer program is executed by a processor, the method described in the first aspect is implemented.

[0050] The file access authentication method, device, equipment and storage medium proposed in the embodiment of the present application, wherein the method includes: receiving a token generation request, the token generation request includes request information, and then the first backend microservice generates a service authorization code according to the request information, the first backend microservice sends the service authorization code to the second backend microservice, and then the second backend microservice performs permission verification on the service authorization code, and according to the permission verification result, the second backend microservice responds to the token generation request to generate an access token for file access and sends it to the request subject. The embodiment of the present application utilizes the first backend microservice to generate a service authorization code according to the token generation request, and then sends the service authorization code to the second backend microservice. The second backend microservice uses the aforementioned generated service authorization code to perform permission verification, and only when the permission verification passes, generates an access token for file access. The service authorization code is used for security management during the token generation process to prevent the token from being copied at will, overcome the problem of high security risks during the use of the token, and improve the security of the file access authentication process using the token. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 It is a schematic diagram of the structure of a microservice system provided by an embodiment of the present invention.

[0052] Figure 2 The present invention provides a flowchart of a method for authenticating access to a file.

[0053] Figure 3 yes Figure 2 Flowchart of step S120 in .

[0054] Figure 4 yes Figure 3 Flowchart of step S122 in .

[0055] Figure 5 yes Figure 4 Flowchart of step S1222 in .

[0056] Figure 6 It is a schematic diagram of the encryption process of the file access authentication method provided by an embodiment of the present invention.

[0057] Figure 7 It is a schematic diagram of the group encryption process of the file access authentication method provided by an embodiment of the present invention.

[0058] Figure 8 yes Figure 2 Flowchart of step S140 in .

[0059] Fig. 9 yes Figure 8 Flowchart of step S142 in .

[0060] Fig.10 yes Figure 2 Flowchart of step S150 in FIG.

[0061] Fig.11 yes Fig.10 Flowchart of step S153 in .

[0062] Fig.12 This is a flowchart of a file access authentication method provided by another embodiment of the present invention.

[0063] Fig.13 This is a flowchart of a file access authentication method provided by another embodiment of the present invention.

[0064] Fig.14 This is a structural block diagram of a file access authentication device provided by another embodiment of the present invention.

[0065] Fig.15 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0066] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0067] It should be noted that although the functional modules are divided in the device schematic and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart.

[0068] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.

[0069] Microservice architecture is a distributed framework that is mainly used to deploy applications and services in the cloud. Microservice architecture is to develop a single program into a microservice. Each microservice runs in its own process and uses lightweight mechanisms to communicate. These services are divided and built around business capabilities and are independently deployed through a fully automated deployment mechanism. Different microservices can use different programming languages ​​and different data storage technologies to ensure minimal centralized management.

[0070] In the related art, if a user business needs to use a token for access control, and if the user business needs multiple microservices to provide services, one of the microservices generates a token and returns it to the user business according to the pre-agreed agreement. As the business proceeds, different microservices provide services based on the token. For example, if the requesting subject requests a file download, the first microservice first receives the file download request, the second microservice provides the file download service, and the first microservice generates a file download link, wherein the download link contains token information, and the requesting subject uses the token information to request the second microservice to provide the download service. However, this method does not perform security management on the token generation process, and cannot ensure that the generated token is not fabricated, resulting in a high security risk during the use of the token.

[0071] Based on this, the embodiment of the present invention provides a file access authentication method, device, equipment and storage medium, which uses a first backend microservice to generate a service authorization code according to a token generation request, and then sends the service authorization code to a second backend microservice. The second backend microservice uses the aforementioned generated service authorization code to perform permission verification, and only when the permission verification passes, it generates an access token for file access. The service authorization code is used for security management during the token generation process to prevent the token from being copied at will, overcome the problem of high security risks during the use of the token, and improve the security of the file access authentication process using the token.

[0072] The embodiments of the present invention provide a file access authentication method, apparatus, device and storage medium, which are specifically described through the following embodiments. First, the file access authentication method in the embodiments of the present invention is described.

[0073] In order to facilitate understanding of the embodiments of the present application, the microservice system in the embodiments of the present application is first described below.

[0074] Reference Figure 1 , the microservice system 100 includes: multiple microservices 200 (three microservices are used as an example in the figure).

[0075] In one embodiment, a permission control module is provided in each microservice 200. In other embodiments, the permission control module can also be provided independently, and each microservice 200 is connected to the permission control module, and the specific location of the permission control module is not limited here. Among them, the permission control module is used to generate a service authorization code and perform permission verification.

[0076] The first backend microservice and the second backend microservice both belong to Figure 1 In the multiple microservices 200, the permission control module can be integrated with the first backend microservice and the second backend microservice, or it can be an independent module, which is not specifically limited in this embodiment.

[0077] In one embodiment, the request subject 10 sends a token generation request to the microservice system 100 to download the file. First, the microservice system 100 transmits the token generation request to the microservice 200 providing the business service. The microservice 200 uses the authority control module to perform an authority check on the business request. If the authority check passes, the microservice 200 providing the business service provides a token to the request subject. It can be understood that the request subject can be a mobile device application or a network application, etc.

[0078] The following describes a file access authentication method in an embodiment of the present invention.

[0079] Figure 2 is an optional flowchart of the file access authentication method provided by an embodiment of the present invention. Figure 2 The method in the embodiment may include but is not limited to steps S110 to S150. Figure 2 The order of step S110 to step S150 is not specifically limited, and the order of steps can be adjusted or some steps can be reduced or added according to actual needs.

[0080] Step S110: receiving a token generation request from a request subject.

[0081] In one embodiment, the requesting subject may be a third-party platform or other subject with file access requirements. The requesting subject sends a token generation request to request the execution of related services. For example, a request to download a file. The token generation request includes request information. In one embodiment, the first microservice receives the token generation request from the requesting subject.

[0082] Step S120: The first backend microservice generates a service authorization code according to the request information.

[0083] In one embodiment, the service authorization code is used to represent the authorization information for accessing at least two microservices. Figure 3 , is a specific implementation flow chart of step S120 shown in an embodiment. In this embodiment, step S120 of the first backend microservice generating a service authorization code according to the request information includes:

[0084] Step S121: The first backend microservice uses the permission control module to determine whether to authorize based on the request information.

[0085] In one embodiment, the token generation request includes business information. The microservice system selects one or more microservices to execute the business according to the business information and generates an access order. The token generation request is sent to the first microservice according to the access order. The first microservice is the first backend microservice. The first backend microservice responds to the token generation request and uses the permission control module to determine whether to authorize according to the request information.

[0086] In one embodiment, the token generation request also includes request information, the request information includes user identity information, and the user identity information represents the user information of the request subject. The first backend microservice authenticates the user identity of the request subject to the authority control module according to the user identity information to determine whether a service authorization code can be generated.

[0087] Step S122: If the judgment result is authorization, the authority control module generates a service authorization code according to a preset authorization code format.

[0088] In one embodiment, the user identity information includes an application number, represented as App Id. The permission control module determines whether the request subject that sends the token generation request is an authorized request subject based on the application number, that is, whether the microservice system can implement the business request of the application. If the judgment result is authorization, the business request of the request subject is authorized.

[0089] In one embodiment, the user identity information may also be obtained through an account number and password.

[0090] In one embodiment, when the authority control module determines that the request subject needs to be authorized, the authority control module generates a service authorization code according to a preset authorization code format.

[0091] In one embodiment, referring to Figure 4 , is a specific implementation flow chart of step S122 shown in an embodiment. In this embodiment, step S122 of generating a service authorization code according to a token generation request using an authority control module includes:

[0092] Step S1221, generating authorization code parameters according to the request information.

[0093] Step S1222: Generate a service authorization code for the authorization code parameters based on the preset authorization code format.

[0094] In one embodiment, the request information of the token generation request also includes: requesting user information, operation file information and file permission information.

[0095] The request user information is the session number of the application for which the request subject requests the service. Since HTTP is a stateless protocol, when the request subject sends a service request to the microservice system, the microservice system does not know whether this is the first or nth request of the request subject. Therefore, in this embodiment, the request information is associated through the session number, and the session number can be used as a unique user identifier. For example, in frameworks such as spring or containers such as tomcat, the session number can be used to indicate the unique identification information of the same user corresponding to different service requests.

[0096] In one embodiment, the operation file information includes: an operation document class name and an operation document number, that is, in this embodiment, the business request sent by the requesting subject is related to the file operation. The operation file information is used to represent the document name corresponding to the requested data when requesting the corresponding service, and is combined with the "operation document number" to represent the data item content of the permission granted when performing permission verification. For example, if you need to download configuration file 1, the operation document class name can be: configuration file, and the operation document number can be: "1".

[0097] In one embodiment, the file permission information indicates the permission of the user to operate the configuration file 1. For example, the file permission information includes one or more of download permission, upload permission, edit permission, view permission or delete permission, and the permission can be selected according to actual needs, which is not limited in this embodiment.

[0098] In one embodiment, corresponding to the requesting user information, operating file information and file permission information of the token generation request, the corresponding authorization code parameters include: requesting user parameters (expressed as sessionId), operating file parameters and file permission parameters (expressed as file permissions). It can be understood that the authorization code parameters are parameterized requesting user information, operating file information and file permission information, which is a format conversion that converts requesting user information, operating file information and file permission information into a character format that the system can operate.

[0099] In one embodiment, referring to Figure 5 , is a specific implementation flow chart of step S1222 shown in an embodiment. In this embodiment, step S1222 of generating a service authorization code of the authorization code parameter based on the preset authorization code format includes:

[0100] Step S1223: Generate operation file parameters according to the operation document class name and the operation document number.

[0101] In one embodiment, since the operation file information includes: an operation document class name and an operation document number, the operation file parameters include: an operation document class parameter (expressed as a document class name) and an operation document number parameter (expressed as a document ID).

[0102] Step S1224: concatenate the operation file parameters with the request user parameters to obtain the first authorization code information.

[0103] Step S1225: concatenate the file permission parameter with the first authorization code information to obtain a service authorization code.

[0104] In one embodiment, the preset authorization code format of the service authorization code is: "requesting user parameters; operation document class parameters#operation document number parameters; file permission parameters", expressed as: "sessionId; document class name#document ID; file permissions".

[0105] In one embodiment, the service authorization code includes at least one file permission parameter, that is, the service requested by the user includes multiple permissions for file operations, such as editing and deletion, so different file permission parameters are separated by a preset separator. The preset separator can be: " / ", "-", "&" and other symbols, as long as different file permission parameters can be distinguished.

[0106] From the above, it can be seen that the embodiment of the present application arranges the requesting user parameters, the operating file parameters and the file permission parameters according to the format of the preset authorization code.

[0107] In one embodiment, for security reasons, the service authorization code obtained above is encrypted. For example, the service authorization code is encrypted using a preset encryption algorithm and a preset key to obtain an encrypted service authorization code.

[0108] It is understandable that in order to avoid the problem that the length of the generated ciphertext service authorization code string is long and increases with the number of permissions, the embodiment of the present application can selectively encrypt the authorization code parameters.

[0109] In one embodiment, the preset encryption algorithm is the AES encryption algorithm. The AES encryption algorithm is also called the Advanced Encryption Standard (AES), which is a symmetric encryption algorithm. The meaning of a symmetric encryption algorithm is that the encryption process and the decryption process use the same preset key. Specifically, this embodiment uses the ECB encryption mode of the AES encryption algorithm, which divides the entire plaintext into several identical small segments, and then encrypts each small segment.

[0110] Reference Figure 6 , which is a schematic diagram of the encryption process of an embodiment of the present application.

[0111] The encryption party (such as the permission control module) uses the AES encryption function and the preset key K to encrypt the plaintext service authorization code P to obtain the encrypted ciphertext service authorization code C. If the subsequent decryption party (such as a microservice) needs to decrypt the ciphertext service authorization code C, the ciphertext service authorization code C is decrypted using the AES decryption function and the same preset key K as the encryption process to obtain the plaintext service authorization code P. Furthermore, according to the format of the preset authorization code, the request user parameters, operation file parameters, and file permission parameters are obtained from the plaintext service authorization code.

[0112] In one embodiment, the service authorization code is encrypted using a block encryption process. Figure 7 In the block encryption process, the plaintext service authorization code P is first divided into multiple independent plaintext blocks Pi according to the preset segmentation length, and then each plaintext block Pi is encrypted using the AES encryption function and the preset key K to generate the corresponding ciphertext block Ci. All ciphertext blocks Ci are spliced ​​together in the segmentation order to obtain the ciphertext service authorization code C. The preset segmentation length can be 128 bits.

[0113] In one embodiment, if the length of a plaintext block obtained after the plaintext service authorization code P is split according to the preset split length is less than the preset split length, the plaintext block is padded. For example, the length of the plaintext service authorization code P is 192 bits, and the preset split length is 128 bits. If it is split into one plaintext block of 128 bits, the second plaintext block is only 64 bits, which is less than 128 bits, so it is necessary to fill in the second plaintext block. The filling method of this embodiment is PKCS5. This filling method is: if the number of bytes missing in the plaintext block is less than 16 bytes (128 bits), the corresponding number of characters are added at the end of the plaintext block, and the value of each byte is equal to the number of missing characters. It can be understood that decryption needs to be performed according to the filling method used in the encryption process.

[0114] It is understandable that the encryption key of the embodiment of the present application can be freely defined or obtained in a configuration file.

[0115] From the above, it can be seen that the embodiment of the present application arranges the requesting user parameters, operation file parameters and file permission parameters according to the format of the preset authorization code to obtain a plaintext service authorization code, and then generates an encrypted service authorization code according to the preset encryption method and preset key.

[0116] Step S130: The first backend microservice sends the service authorization code to the second backend microservice.

[0117] In one embodiment, the microservice system calls the first backend microservice to respond to the token generation request, generates a corresponding service authorization code, and then sends the service authorization code to the second backend microservice that executes the business in the order of business execution. In one embodiment, the second backend microservice is a file server, which does not need to generate a service authorization code and store the service authorization code by itself, but only needs to receive the service authorization code generated by the first backend microservice for permission verification. This method can improve the file processing efficiency of the second backend microservice.

[0118] In one embodiment, the first backend microservice of the microservice system sends the service authorization code to the second backend microservice by means of parameter transmission, that is, the service authorization code is converted into a URL parameter and sent to the second backend microservice.

[0119] Step S140: Use the second backend microservice to perform permission verification on the service authorization code.

[0120] In one embodiment, the second backend microservice needs to perform permission verification before executing the business request to ensure security.

[0121] In one embodiment, referring to Figure 8 , is a specific implementation flow chart of step S140 shown in an embodiment. In this embodiment, step S140 of using the second backend microservice to perform permission verification on the service authorization code includes:

[0122] Step S141: Obtain the authorization code parameters in the service authorization code.

[0123] In one embodiment, after obtaining the service authorization code as described above, the following are obtained from the service authorization code according to a preset authorization code format: requesting user parameters, operation file parameters and file permission parameters, wherein the operation file parameters include: operation document class parameters and operation document number parameters.

[0124] Step S142: If the authorization code parameters meet the permission verification conditions, the permission verification passes.

[0125] In one embodiment, referring to Fig. 9 , is a specific implementation flow chart of step S142 shown in an embodiment. In this embodiment, if the authorization code parameter meets the permission verification condition, step S142 in which the permission verification passes includes:

[0126] Step S1421: If the current user is determined to be an authorized user based on the requesting user parameters, the first permission check is passed.

[0127] In one embodiment, the user identity must first be determined, that is, whether the current user is an authorized user is determined based on the request user parameters. If the current user is an authorized user, the first permission check is passed.

[0128] Step S1422: Determine, based on the operation file parameters, whether the file for which the operation is requested is an authorized file, and the second permission check passes.

[0129] In one embodiment, under the premise that the user identity is legal, it is determined whether the file requested for operation is an authorized file based on the operation file parameters, that is, files outside the operation authority cannot be operated. If it is an authorized file, the second permission check passes.

[0130] Step S1423: judging from the file permission parameters that the file operation permission is an authorized interface, the third permission check passes.

[0131] In one embodiment, corresponding to the multiple permissions of file operations, the authorization interface includes: viewing interface, editing interface or deletion interface, etc. Under the premise of requesting the authorization file, it is determined whether the file operation permission is an authorization interface according to the file permission parameters. If the operation permission range interface is consistent, the third permission check is passed.

[0132] Step S1424: If the first permission check passes, the second permission check passes, and the third permission check passes, the permission check passes.

[0133] From the above, it can be seen that the permission check is passed only when the first permission check passes, the second permission check passes and the third permission check passes, and all three permission checks pass.

[0134] In one embodiment, if any of the first permission check, the second permission check and the third permission check fails, the authorization code parameter does not meet the permission check condition, and a verification error code is returned to the requesting subject, and the service is refused to be executed.

[0135] Step S150: Based on the permission verification result, the second backend microservice generates an access token based on the token generation request and the service authorization code and sends it to the requesting subject.

[0136] In one embodiment, if the permission check passes, the microservice system uses the second backend microservice to respond to the token generation request, uses the request information and service authorization code in the token generation request to generate an access token and sends it to the request subject, so that the request subject can use the access token to access files on the second backend microservice.

[0137] In one embodiment, referring to Fig.10 , is a specific implementation flow chart of step S150 shown in an embodiment. In this embodiment, according to the permission verification result, the second backend microservice generates an access token according to the token generation request and the service authorization code. Step S150 includes:

[0138] Step S151: Generate first token information.

[0139] In one embodiment, the second backend microservice generates initial token information according to the rules agreed with the request subject, recorded as the first token information, and the first token information includes the identity and permission information of the process or thread related to the user account of the request subject when executing the business request.

[0140] Step S152: Generate token parameters according to the token generation request.

[0141] In one embodiment, the time of the file access permission of the request subject is determined based on the token generation request of the request subject, and the token parameters are generated based on the access time. The token parameters here include: timestamp information, that is, the time limit information of the request subject using the access token to access the file as specified by the second backend microservice, which can effectively control the authorization time limit of the request subject and improve the security of file access.

[0142] Step S153: Add token parameters and service authorization code to the first token information to obtain a plain text token.

[0143] In one embodiment, referring to Fig.11 , is a specific implementation flow chart of step S153 shown in an embodiment. In this embodiment, according to the permission verification result, step S153 of the second backend microservice generating an access token according to the token generation request and the service authorization code includes:

[0144] Step S1531: append timestamp information to the first token information to obtain second token information.

[0145] Step S1532: Add the authorization code parameter of the service authorization code to the second token information to obtain a plain text token.

[0146] In one embodiment, corresponding to the requesting user information, operating file information and file permission information of the token generation request, the corresponding authorization code parameters include: requesting user parameters (expressed as sessionId), operating file parameters and file permission parameters (expressed as file permissions). It can be understood that the authorization code parameters are parameterized requesting user information, operating file information and file permission information, which is a format conversion that converts requesting user information, operating file information and file permission information into a character format that the system can operate. In this embodiment, firstly, the timestamp information is added to the first token information to generate the second token information, and then the requesting user parameters, operating file parameters and file permission parameters are appended to the second token information in turn to obtain a plaintext token.

[0147] Step S154: Encrypt the plaintext token using a preset encryption algorithm and a preset key to obtain an access token.

[0148] Step S155: Send the access token to the request subject.

[0149] In one embodiment, the preset encryption algorithm is the AES encryption algorithm. The AES encryption algorithm is also known as the Advanced Encryption Standard (AES), which is a symmetric encryption algorithm. The meaning of a symmetric encryption algorithm is that the encryption process and the decryption process use the same preset key. Specifically, this embodiment uses the ECB encryption mode of the AES encryption algorithm, which divides the entire plaintext into several identical small segments, and then encrypts each small segment. The encrypted access token plaintext displays no regularity, and similar illegal tokens cannot be generated through existing access tokens, thereby improving the security of the token usage process. It can be understood that the encrypted content can be flexibly adjusted according to actual needs within the scope of access security.

[0150] In one embodiment, the access token includes: timestamp information, request user parameters, operation file parameters and file permission parameters. For example, when authorizing the requesting subject to access a file, the timestamp information can be used to effectively control the validity of the access token. The requesting user parameters are used to identify the identity of the requesting subject using the access token to prevent the access token from being cracked by a database collision and fabricated, thereby improving the security of file access. Some heterogeneous systems can only authorize the requesting subject to download files, but cannot authorize the requesting subject to upload files. The embodiment of the present application uses operation file parameters and file permission parameters to manage and control the operation permissions of the requesting subject, thereby preventing the requesting subject from accessing files without permission or performing operations beyond the permission on files with permission to access.

[0151] As can be seen from the above, the embodiment of the present application receives a token generation request, and the token generation request includes request information. Then the first backend microservice generates a service authorization code according to the request information, and the first backend microservice sends the service authorization code to the second backend microservice. Then the second backend microservice performs permission verification on the service authorization code. According to the permission verification result, the second backend microservice responds to the token generation request to generate an access token for file access and sends it to the request subject. Avoiding the second backend microservice from completing the entire process of authorization-business execution can, on the one hand, overcome the problem of easy access timeout and improve the access efficiency of the microservice system. On the other hand, the first backend microservice is used to verify the user identity information and then generate a service authorization code, and then send the service authorization code to the second backend microservice. The second backend microservice uses the aforementioned generated service authorization code to perform permission verification. Only when the permission verification passes, an access token for file access is generated. In the token generation process, the service authorization code is used for security management to avoid the token from being copied at will, overcome the problem of high security risks during the use of the token, and improve the security of the file access authentication process using the token.

[0152] The embodiment of the present application does not need to store the service authorization code in the second backend microservice, avoiding the problem of the second backend microservice generating tokens easily timing out. It is understandable that since the access token contains timestamp information and requesting user parameters, when the requesting user information is the session number of the application for which the requesting subject requests the service, when the user logs out or the session times out, the service authorization code will automatically become invalid, and the corresponding access token will also automatically become invalid.

[0153] The following describes the specific process of the file access authentication method in the embodiment of the present application through a specific embodiment.

[0154] In this embodiment, the microservice system requires two microservices to implement the business request sent by the request subject. The business implementation order is: microservice A (first backend microservice)-microservice B (first backend microservice). Microservice A first responds to the business request, generates a service authorization code, and then passes the service authorization code to microservice B. Microservice B performs permission verification and responds to the business request to generate an access token.

[0155] Reference Fig.12 , which is a schematic diagram of the first backend microservice processing flow of the file access authentication method in an embodiment of the present application.

[0156] Since the token generation request of the request subject needs to be processed by the first backend microservice, step S1210 obtains the token generation request from the user interface of the request subject. The token generation request contains business information. The microservice system selects the first backend microservice to execute the business based on the business information, so the main entrance of the token generation request is connected to the first backend microservice.

[0157] In this embodiment, the token generation request also includes user identity information, and the access token represents the user identity information of the request subject.

[0158] In step S1220, the first backend microservice authenticates the user identity of the requesting subject to the permission control module according to the access token. In step S1230, the permission control module determines whether to authorize based on the user identity information. If the judgment result is yes, step S1240 performs authorization, and the permission control module generates a service authorization code according to the preset authorization code format and sends it to the second backend microservice; otherwise, step S1250 rejects authorization and returns the result of this authorization request to the first backend microservice.

[0159] In this embodiment, step S1240 performs authorization, and the process in which the authority control module generates a service authorization code according to a preset authorization code format is specifically as follows:

[0160] The request information of the token generation request also includes: request user information, operation file information and file permission information. The corresponding authorization code parameters obtained corresponding to the token generation request include: request user parameters (expressed as sessionId), operation file parameters and file permission parameters (expressed as file permissions). Since the operation file information includes: operation document class name and operation document number, the operation file parameters include: operation document class parameter (expressed as document class name) and operation document number parameter (expressed as document ID). The authorization code parameters are parameterized request user information, operation file information and file permission information.

[0161] The preset authorization code format of the service authorization code is: "request user parameters; operation document class parameters#operation document number parameters; file permission parameters", expressed as: "sessionId; document class name#document ID; file permissions".

[0162] In this embodiment, the encryption and decryption algorithm of the service authorization code is the AES encryption algorithm, the working mode is ECB encryption mode, the filling method is PKCS5, and the encrypted ciphertext service authorization code is converted by Base64.encodeBase64URLSafeString conversion. The purpose of the conversion is to convert the ciphertext service authorization code into the URL parameter form, and no transcoding is required in the subsequent processing process.

[0163] The first service response information and service authorization code generated by the first backend microservice according to the token generation request are obtained by sending the first service response information and service authorization code to the request subject to obtain the second business request information generated by the request subject.

[0164] Reference Fig.12 , describing the second backend microservice processing flow diagram of the file access authentication method in an embodiment of the present application.

[0165] Since the second service request information of the request subject needs to be processed by the second backend microservice (different from the first backend microservice). In step S1260, the second backend microservice performs permission verification on the service authorization code. If the permission verification passes, step S1270 generates an access token using the second backend microservice. Step S1280 returns the generated access token. If the permission verification fails, step S1290 returns an error code.

[0166] In this embodiment, in step S1260, the process of the second backend microservice performing permission verification on the service authorization code is: obtaining the authorization code parameter in the service authorization code using the same decryption method as the encryption method. If the authorization code parameter meets the permission verification condition, the permission verification passes.

[0167] The verification process is:

[0168] First, determine whether the current user is an authorized user based on the request user parameter ("SessionId"), then the first permission check passes; then determine whether the file requested for operation is an authorized file based on the operation file parameters ("Document ID" and "Document Class Name"), then the second permission check passes; and determine that the file operation permission is an authorized interface based on the file permission parameters ("Document Permission"), then the third permission check passes. If the first permission check passes, the second permission check passes, and the third permission check passes, then the permission check passes. As can be seen from the above, the permission check passes only if the first permission check passes, the second permission check passes, and the third permission check pass. Once the permission check passes, the "Document ID" and "Document Class Name" can be used to process data, such as querying.

[0169] Reference Fig.13 , the specific process of the file access authentication method of another embodiment of the present application.

[0170] The figure includes a request body, a first backend microservice and a second backend microservice, wherein the request body is the business module front end, the first backend microservice is the business module back end, and the second backend microservice is the attachment backend service.

[0171] Among them, the first backend microservice and the second backend microservice are both integrated with permission control modules. The business processing module of the first backend microservice sends the user identity information to the permission control module. The permission control module generates a service authorization code based on the user identity information. The second backend microservice uses the permission control module to perform permission verification on the service authorization code.

[0172] First, the requesting subject sends a token generation request through the viewing page (i.e., the user interface), calls the first backend microservice, and sends the token generation request to the first backend microservice. The business processing module of the first backend microservice applies for the permission control module to authenticate the user identity of the requesting subject based on the token generation request. The permission control module authorizes based on the access token. If the authorization is successful, a service authorization code is generated and returned to the first backend microservice. The first backend microservice sends the service authorization code to the second backend microservice.

[0173] Then the business execution module of the second backend microservice sends the service authorization code to the permission control module, and uses the same decryption method as the encryption method to obtain the authorization code parameters in the service authorization code. If the authorization code parameters meet the permission verification conditions, the permission verification is passed. The permission control module sends the result of the permission verification to the second backend microservice. The second backend microservice generates an access token based on the token generation request and the service authorization code, and sends the access token to the requesting subject. For example, the second backend microservice can provide a microservice for attachment services for the requesting subject, and correspondingly, the requesting subject is allowed to download the attachment through the access token.

[0174] In this embodiment, the authorization code parameter is expressed as:

[0175] Request user parameters (sessionId):

[0176] 1gfv4gv1lw0w1w9e4eou1p69cab11no67qw0;

[0177] Operation document class parameters (document class name):

[0178] com.landray.sys.xform.core.entity.official.SysXFormOfficial;

[0179] Operation document number parameter (document ID): 1gfv4f7gpw0w1w8eb6ps2fvj9212haup4dw0;

[0180] File permission parameters (file permissions): attachGetAll;

[0181] The above parameters generate a plain text service authorization code according to the preset authorization code format "sessionId; document class name#document ID; file permissions".

[0182] The second backend microservice decodes the ciphertext service authorization code to obtain the plaintext service authorization code, and performs permission verification according to the authorization parameters of the service authorization code. If the first permission verification passes, the second permission verification passes, and the third permission verification passes, the permission verification passes.

[0183] The request user parameter ("SessionId") is compared with the current user identity information, that is, the user identity information X-AUTH-TOKEN carried in the header information. It is compared with the SessionId obtained by decrypting the service authorization code to determine whether the current user is an authorized user, and the first permission check is passed. Then, based on the operation file parameters ("document ID" and "document class name"), it is determined whether the file requested for operation is a file existing in the second backend microservice. If so, the second permission check is passed. Based on the file permission parameters ("document permission"), it is determined whether the file operation permission is consistent with the file permission. If they are consistent, the third permission check is passed. If the first permission check passes, the second permission check passes, and the third permission check passes, the permission check passes, and operations such as document download, query, modification or deletion can be performed. Then, an access token is generated based on the token generation request and the service authorization code.

[0184] First, generate the first token information, expressed as:

[0185] opFGhE7eg0j0C4qRD+rtpPCYXFoIp1BD2qy / 61QRAWgCdwMazfMBAP8VMjift / Ed3qObsBk0kEfC 7RfBm+bR2BmBap2SJbZvSHJqVdlXHsJBf9J02At5ayDY75BalxbR8AvicS+4b0xgleAMljC1BA==

[0186] The timestamp information is appended to the first token information to obtain the second token information. In this embodiment, the timestamp information is appended to the front of the first token information. The timestamp information is expressed as: 1666368000000

[0188] The second token information is represented as:

[0189] 1666368000000_opFGhE7eg0j0C4qRD+rtpPCYXFoIp1BD2qy / 61QRAWgCdwMazfMBAP8VMjift / Ed3qObs Bk0kEfC7RfBm+bR2BmBap2SJbZvSHJqVdlXHsJBf9J02At5ayDY75BalxbR8AvicS+4b0xgleAMljC1BA==

[0190] Add the authorization code parameter of the service authorization code to the second token information, and add it to the front of the first token information to obtain a plaintext token.

[0191] Among them, the request user parameter (sessionId) is expressed as:

[0192] 1gfv4gv1lw0w1w9e4eou1p69cab11no67qw0;

[0193] Operation document class parameters (document class name):

[0194] com.landray.sys.xform.core.entity.official.SysXFormOfficial;

[0195] Operation document number parameter (document ID):

[0196] 1gfv4f7gpw0w1w8eb6ps2fvj9212haup4dw0;

[0197] File permission parameters (file permissions): attachGetAll;

[0198] It is understandable that the above-mentioned operation document type parameters and file permission parameters can be represented by agreed characters, such as: attachGetAll (represented by "D"), etc., and the characters are not limited here. Further, if there is only one operation document type parameter, it can be omitted.

[0199] Therefore, omitting the operation document class parameter, the plaintext token is represented as:

[0200] 1666368000000_1gfv4f7gpw0w1w8eb6ps2fvj9212haup4dw0_1gfv4gv1lw0w1w9e4eou1p69cab11no67qw0_D_opFGh E7eg0j0C4qRD+rtpPCYXFoIp1BD2qy / 61QRAWgCdwMazfMBAP8VMjift / Ed3qObsBk0kEfC7RfBm+bR2BmBap2SJbZvSHJq VdlXHsJBf9J02At5ayDY75BalxbR8AvicS+4b0xgleAMljC1BA==

[0201] The default key is:

[0202] {-122,47,-49,-55,-14,-99,-51,-69,-2,124,-80,45,27,76,-17,93}

[0203] Based on the AES encryption method, the ciphertext access token obtained using the above preset key is expressed as:

[0204] TpfpROYGLURxadEn1CHgxvcgQPw_YrBDA6H9kdWZc0ldBaGbEOF5r0szx vwv4CJzAOhi5NghDaafTRfDyZt1pq0yzaTMi1WBoJ0rrgnP5msB2PEjOeu0hsugA mAYwEUVe193GL7Y-BMNw34VSbU0BMmw3HCJt3xBMg6psbbghYxIa57dUHnl zr7ReFSQmZ5pFMYQXOZrqJd-6Lo6fz32TA

[0205] Since the attachment download request protocol is HTTPS, the access token generated above is passed to the request body through parameter passing (mechAuthToken), which is expressed as:

[0206] https: / / test.ywork.me / data / sys-attach / checkDownload / 1g6v5l3tuw57lwg7dwfps pnbnlcpbp2bjiw0? mechAuthToken=TpfpROYGLURxadEn1CHgxvcgQPw_YrBDA6H9kdWZc0ldBaGbEOF5r0szxvwv4CJzAOhi5NghDaafTRfDyZt1pq0yzaTMi1WB oJ0rrgnP5msB2PEjOeu0hsugAmAYwEUVe193GL7Y-BMNw34VSbU0BMmw3HC Jt3xBMg6psbbghYxIa57dUHnlzr7ReFSQmZ5pFMYQXOZrqJd-6Lo6fz32TA

[0207] The file access authentication method proposed in the embodiment of the present application receives a token generation request, which includes request information. Then, the first backend microservice generates a service authorization code based on the request information. The first backend microservice sends the service authorization code to the second backend microservice. Then, the second backend microservice performs permission verification on the service authorization code. Based on the permission verification result, the second backend microservice responds to the token generation request to generate an access token for file access and sends it to the request subject.

[0208] The embodiment of the present application utilizes the first backend microservice to generate a service authorization code according to a token generation request, and then sends the service authorization code to the second backend microservice. The second backend microservice uses the aforementioned generated service authorization code to perform permission verification, and only when the permission verification passes, an access token for file access is generated. Using the service authorization code for security management during the token generation process prevents the token from being copied at will, overcomes the problem of high security risks during the use of the token, and improves the security of the file access authentication process using the token.

[0209] The embodiment of the present invention also provides a file access authentication device, which can implement the above-mentioned file access authentication method, referring to Fig.14 , the device comprises:

[0210] The first request receiving unit 1410 is used to receive a token generation request from a request subject, where the token generation request includes request information.

[0211] Service authorization code generation unit 1420: used for the first backend microservice to generate a service authorization code according to the request information.

[0212] Service authorization code sending unit 1430: used for the first backend microservice to send the service authorization code to the second backend microservice.

[0213] Permission verification unit 1440: used for the second backend microservice to perform permission verification on the service authorization code;

[0214] Token generation unit 1450: used to generate an access token based on the permission verification result, and send it to the request subject according to the token generation request and the service authorization code, so that the request subject can use the access token to access files on the second backend microservice.

[0215] The specific implementation of the file access authentication device of this embodiment is basically the same as the specific implementation of the above-mentioned file access authentication method, and will not be repeated here.

[0216] An embodiment of the present invention further provides an electronic device, including:

[0217] at least one memory;

[0218] at least one processor;

[0219] at least one program;

[0220] The program is stored in the memory, and the processor executes the at least one program to implement the file access authentication method of the present invention. The electronic device can be any intelligent terminal including a mobile phone, a tablet computer, a personal digital assistant (PDA), a car computer, etc.

[0221] See also Fig.15 , Fig.15 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0222] The processor 1501 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention;

[0223] The memory 1502 can be implemented in the form of ROM (Read Only Memory), static storage device, dynamic storage device or RAM (Random Access Memory). The memory 1502 can store operating systems and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1502, and the processor 1501 calls and executes the file access authentication method of the embodiment of the present invention;

[0224] Input / output interface 1503, used to implement information input and output;

[0225] Communication interface 1504, used to realize communication interaction between the device and other devices, which can be realized by wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.); and

[0226] A bus 1505 that transmits information between the various components of the device (e.g., the processor 1501, the memory 1502, the input / output interface 1503, and the communication interface 1504);

[0227] The processor 1501 , the memory 1502 , the input / output interface 1503 and the communication interface 1504 are connected to each other in communication within the device via the bus 1505 .

[0228] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium. The storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned file access authentication method is implemented.

[0229] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0230] The file access authentication method, file access authentication device, electronic device, and storage medium proposed in the embodiments of the present invention receive a token generation request, the token generation request includes request information, and then the first backend microservice generates a service authorization code according to the request information, the first backend microservice sends the service authorization code to the second backend microservice, and then the second backend microservice performs permission verification on the service authorization code. According to the permission verification result, the second backend microservice responds to the token generation request to generate an access token for file access and sends it to the request subject. The embodiment of the present application utilizes the first backend microservice to generate a service authorization code according to the token generation request, and then sends the service authorization code to the second backend microservice. The second backend microservice performs permission verification using the aforementioned generated service authorization code, and only generates an access token for file access when the permission verification passes. The service authorization code is used for security management during the token generation process to prevent the token from being copied at will, overcome the problem of high security risks during the use of the token, and improve the security of the file access authentication process using the token.

[0231] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0232] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.

[0233] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0234] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0235] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0236] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0237] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0238] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0239] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0240] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0241] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. A file access authentication method, applied to a microservice system, characterized in that: include: receiving a token generation request from a request subject, wherein the token generation request includes request information; The request information includes: requesting user information, operation file information and file permission information, and the operation file information includes: operation document class name and operation document number; The first backend microservice generates a service authorization code according to the request information; The first backend microservice sends the service authorization code to the second backend microservice; The second backend microservice performs permission verification on the service authorization code; According to the permission verification result, the second backend microservice generates an access token according to the token generation request and the service authorization code and sends it to the request subject, so that the request subject can use the access token to access files of the second backend microservice; The first backend microservice generates a service authorization code according to the request information, including: The first backend microservice uses the permission control module to determine whether to authorize according to the request information; If the judgment result is authorization, the service authorization code is generated by the permission control module according to the preset authorization code format; The authority control module generates the service authorization code according to a preset authorization code format, including: Generate authorization code parameters according to the request information, the authorization code parameters including: request user parameters, operation file parameters and file permission parameters; Based on the preset authorization code format, generate the service authorization code of the authorization code parameter; The step of generating the service authorization code of the authorization code parameter based on the preset authorization code format includes: Generate the operation file parameters according to the operation document class name and the operation document number, the operation file parameters include: operation document class parameters and operation document number parameters; The operation file parameters are concatenated with the request user parameters to obtain the first authorization code information; The service authorization code is obtained by concatenating the file permission parameter with the first authorization code information.

2. A file access authentication method according to claim 1, characterized in that: After generating the service authorization code of the authorization code parameters based on the preset authorization code format, the method further includes: encrypting the service authorization code by using a preset encryption algorithm and a preset key to obtain the encrypted service authorization code.

3. A file access authentication method according to claim 1, characterized in that: The request user information is a user session number.

4. A file access authentication method according to claim 1, characterized in that: The service authorization code includes at least one of the file permission parameters, and different file permission parameters are generated by separating them using a preset separator.

5. A file access authentication method according to claim 1, characterized in that: The second backend microservice performs permission verification on the service authorization code, including: Obtain the authorization code parameter in the service authorization code; If the authorization code parameters meet the permission verification conditions, the permission verification passes.

6. A file access authentication method according to claim 5, characterized in that: If the authorization code parameter satisfies the permission verification condition, the permission verification is passed, including: If the current user is determined to be an authorized user according to the request user parameters, the first permission check is passed; If it is determined according to the operation file parameters that the file requested for operation is an authorized file, then the second permission check passes; If the file operation permission is determined to be an authorized interface according to the file permission parameter, the third permission check passes; If the first permission check passes, the second permission check passes, and the third permission check passes, the permission check passes.

7. A file access authentication method according to claim 5, characterized in that: If any of the first permission check, the second permission check and the third permission check fails, the authorization code parameter does not meet the permission check condition, and a check error code is returned.

8. The file access authentication method according to claim 1, characterized in that: According to the permission verification result, the second backend microservice generates an access token according to the token generation request and the service authorization code and sends it to the request subject, including: Generate first token information; Generate token parameters according to the token generation request; Add the token parameter and the service authorization code to the first token information to obtain a plaintext token; Encrypt the plaintext token using a preset encryption algorithm and a preset key to obtain the access token; The access token is sent to the request body.

9. The file access authentication method according to claim 8, characterized in that: The token parameters include: timestamp information; the appending of the token parameters and the service authorization code to the first token information to obtain a plaintext token includes: Add the timestamp information to the first token information to obtain second token information; The authorization code parameter of the service authorization code is added to the second token information to obtain the plain text token.

10. A file access authentication device, characterized in that: include: A first request receiving unit: configured to receive a token generation request from a request subject, wherein the token generation request includes request information; The request information includes: requesting user information, operation file information and file permission information, and the operation file information includes: operation document class name and operation document number; Service authorization code generation unit: used for the first backend microservice to generate a service authorization code according to the request information; Service authorization code sending unit: used for the first backend microservice to send the service authorization code to the second backend microservice; Permission verification unit: used for the second backend microservice to perform permission verification on the service authorization code; Token generation unit: used for, according to the permission verification result, the second backend microservice generates an access token according to the token generation request and the service authorization code and sends it to the request subject, so that the request subject can use the access token to access files of the second backend microservice; The first backend microservice generates a service authorization code according to the request information, including: The first backend microservice uses the permission control module to determine whether to authorize according to the request information; If the judgment result is authorization, the service authorization code is generated by the permission control module according to the preset authorization code format; The authority control module generates the service authorization code according to a preset authorization code format, including: Generate authorization code parameters according to the request information, the authorization code parameters including: request user parameters, operation file parameters and file permission parameters; Based on the preset authorization code format, generate the service authorization code of the authorization code parameter; The step of generating the service authorization code of the authorization code parameter based on the preset authorization code format includes: Generate the operation file parameters according to the operation document class name and the operation document number, the operation file parameters include: operation document class parameters and operation document number parameters; The operation file parameters are concatenated with the request user parameters to obtain the first authorization code information; The service authorization code is obtained by concatenating the file permission parameter with the first authorization code information.

11. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the file access authentication method according to any one of claims 1 to 9 when executing the computer program.

12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the file access authentication method according to any one of claims 1 to 9 is implemented.