Service authentication methods, devices, equipment and media
By performing authentication processing at both the service request sending and receiving ends, the problem of poor reusability of service access control across different platforms is solved, achieving cross-platform adaptability and improved security.
Patent Information
- Application Number
- CN202611053359.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-15
- Publication Date
- 2026-11-10
AI Technical Summary
Existing service access control schemes have poor reusability across different platforms and components, high adaptation and integration costs, and increased security risks of unauthorized applications calling services and accessing data without authorization.
The authentication module obtains the service access mapping table, parses the service request message, determines the service level based on the service information, and selects an appropriate authentication module to perform authentication at the service request sending and receiving ends, generating authentication results and reducing dependence on the underlying communication components.
It improves cross-platform compatibility, enhances the flexibility and security of service access control, and reduces the risk of unauthorized access.
Smart Images

Figure CN123074752A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicle information security technology, and in particular to a service authentication method, device, electronic device, and computer-readable storage medium. Background Technology
[0002] As vehicle internal functions are increasingly offered as services, different applications can invoke these functions through service communication mechanisms. While service-oriented architecture improves function reuse and development flexibility, it also increases the scope of exposed service interfaces, raising security risks such as unauthorized applications calling services and accessing data without authorization. Existing service access control schemes typically rely on modifying service communication components or their interfaces to add authentication mechanisms during communication. However, the implementation of communication components varies across different platforms and components, and some components lack the resources for source code modification. This results in poor reusability of access control schemes across different platforms or components, leading to high adaptation and integration costs. Summary of the Invention
[0003] This application aims to at least partially address one of the technical problems in the related art.
[0004] Therefore, the first objective of this application is to propose a service authentication method that can reduce the dependence of the service authentication scheme on the underlying communication components, improve cross-platform adaptability, and enhance the flexibility and security of service access control in different service scenarios.
[0005] The second objective of this application is to propose a service authentication device.
[0006] The third objective of this application is to propose an electronic device.
[0007] The fourth objective of this application is to provide a computer-readable storage medium.
[0008] To achieve the above objectives, a first aspect of this application proposes a service authentication method, comprising: obtaining a service access mapping table through an authentication module, and obtaining a service request message from a network protocol stack based on the service access mapping table, wherein the authentication module includes a first authentication module and a second authentication module, the first authentication module being located at the service request sending end and the second authentication module being located at the service request receiving end; parsing the service request message to obtain service information, and determining a service level based on the service information; determining a target authentication module based on the service level, wherein the target authentication module includes the first authentication module and / or the second authentication module; authenticating the service request message through the target authentication module based on the service information and a preset security access policy, and generating an authentication result.
[0009] According to the service authentication method of this application embodiment, firstly, a service access mapping table is obtained through an authentication module, and a service request message is obtained from the network protocol stack based on the service access mapping table. The authentication module includes a first authentication module and a second authentication module, with the first authentication module located at the service request sending end and the second authentication module located at the service request receiving end. Then, the service request message is parsed to obtain service information, and the service level is determined based on the service information. Next, a target authentication module is determined based on the service level, whereby the target authentication module includes the first authentication module and / or the second authentication module. Finally, the target authentication module authenticates the service request message based on the service information and a preset security access policy, and generates an authentication result. This reduces the service authentication scheme's dependence on underlying communication components, improves cross-platform adaptability, and enhances the flexibility and security of service access control in different service scenarios.
[0010] In addition, the service authentication method according to the above embodiments of this application may also have the following additional technical features: In one embodiment of this application, the service access mapping table is established in the following manner: the authentication module obtains the service provision message sent by the service provider and parses the service provision message to obtain the service provision information of the service provider; and the service access mapping table is established based on the service provision information.
[0011] In one embodiment of this application, determining the target authentication module based on service level includes: determining that the target authentication module includes a first authentication module in response to a service level less than or equal to a first preset service threshold; determining that the target authentication module includes a second authentication module in response to a service level greater than the first preset service threshold and less than or equal to a second preset service threshold; and determining that the target authentication module includes both the first and second authentication modules in response to a service level greater than the second preset service threshold, wherein the second preset service threshold is greater than the first preset service threshold.
[0012] In one embodiment of this application, obtaining a service request message from the network protocol stack based on a service access mapping table includes: capturing a network message matching the service access mapping table in the network protocol stack; performing message format verification on the captured network message; determining the network message as a service request message in response to the network message passing the message format verification; and generating a message error alarm message in response to the network message failing the message format verification.
[0013] In one embodiment of this application, the target authentication module authenticates the service request message based on service information and a preset security access policy, including: determining the service requester and target service corresponding to the service request message based on the service information; and determining whether the service requester has permission to access the target service based on the preset security access policy, so as to generate an authentication result.
[0014] In one embodiment of this application, in response to a successful authentication result, the target authentication module controls the continued transmission of the service request message; in response to a failed authentication result, the target authentication module performs alarm processing on the service request message, or generates alarm information and blocks the continued transmission of the service request message.
[0015] In one embodiment of this application, the authentication module includes a first authentication module that authenticates the service request message before it is sent to the network protocol stack; the authentication module also includes a second authentication module that authenticates the service request message before it is transmitted to the service application.
[0016] To achieve the above objectives, a second aspect of this application provides a service authentication device, comprising: an acquisition module, configured to acquire a service access mapping table through an authentication module, and acquire a service request message from a network protocol stack based on the service access mapping table, wherein the authentication module includes a first authentication module and a second authentication module, the first authentication module being located at the service request sending end and the second authentication module being located at the service request receiving end; a parsing module, configured to parse the service request message to obtain service information, and determine the service level based on the service information; a determination module, configured to determine a target authentication module based on the service level, wherein the target authentication module includes the first authentication module and / or the second authentication module; and a generation module, configured to authenticate the service request message through the target authentication module according to the service information and a preset security access policy, and generate an authentication result.
[0017] According to the service authentication apparatus of this application embodiment, the firstly, an acquisition module obtains a service access mapping table through the authentication module, and then obtains a service request message from the network protocol stack based on the service access mapping table. The authentication module includes a first authentication module and a second authentication module, with the first authentication module located at the service request sending end and the second authentication module located at the service request receiving end. Next, a parsing module parses the service request message to obtain service information and determines the service level based on the service information. Then, a determination module determines the target authentication module based on the service level, whereby the target authentication module includes the first authentication module and / or the second authentication module. Finally, a generation module authenticates the service request message based on the service information and a preset security access policy through the target authentication module and generates an authentication result. This reduces the service authentication scheme's dependence on underlying communication components, improves cross-platform adaptability, and enhances the flexibility and security of service access control in different service scenarios.
[0018] To achieve the above objectives, a third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements any of the above-mentioned service authentication methods.
[0019] The electronic device according to the embodiments of this application implements any of the above-mentioned service authentication methods when the processor executes a computer program, thereby reducing the dependence of the service authentication scheme on the underlying communication components, improving cross-platform adaptability, and enhancing the flexibility and security of service access control in different service scenarios.
[0020] To achieve the above objectives, a fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement any of the above-described service authentication methods.
[0021] The computer-readable storage medium according to the embodiments of this application implements any of the above-described service authentication methods when the computer program stored thereon is executed by a processor. This reduces the dependence of the service authentication scheme on the underlying communication components, improves cross-platform adaptability, and enhances the flexibility and security of service access control in different service scenarios.
[0022] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0023] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a schematic diagram of a service authentication method according to some embodiments of this application under a vehicle SOA architecture; Figure 2 This is a flowchart illustrating a service authentication method according to some embodiments of this application; Figure 3 This is a schematic diagram illustrating the service authentication method for obtaining packets from the network protocol stack according to some embodiments of this application; Figure 4 This is a schematic diagram of the authentication process of the authentication end of a service authentication method according to some embodiments of this application; Figure 5 This is a flowchart illustrating a service authentication method according to a specific embodiment of this application; Figure 6 This is a block diagram of a service authentication apparatus according to some embodiments of this application; Figure 7 This is a schematic diagram of the structure of an electronic device according to some embodiments of this application. Detailed Implementation
[0024] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0025] The service authentication method, apparatus, electronic device, and computer-readable storage medium of embodiments of this application are described below with reference to the accompanying drawings.
[0026] It should be noted that, as Figure 1 As shown, the service authentication method provided in this application embodiment can be applied to service communication scenarios under the vehicle SOA architecture. The service provision message and service request message can be network messages generated in accordance with the SOME / IP protocol. The following embodiments mainly use the SOME / IP protocol as an example for illustration, but should not be construed as limiting the scope of protection of this application.
[0027] like Figure 2 As shown, the service authentication method of this application embodiment may include the following steps: Step S1: Obtain the service access mapping table through the authentication module, and obtain the service request message from the network protocol stack based on the service access mapping table. The authentication module includes a first authentication module and a second authentication module. The first authentication module is located at the service request sending end, and the second authentication module is located at the service request receiving end.
[0028] Specifically, the service access mapping table represents the correspondence between services and network communication information. For example, it can represent the correspondence between a service and network communication information such as the address of the node where the service resides and the communication port. The authentication module determines the service request message that needs authentication processing based on this service access mapping table. The service request message is a network message sent by the service request sender to the service request receiver in order to invoke the service. The first authentication module is set at the service request sender and is used to perform authentication processing during the transmission of the service request from the service request sender. The second authentication module is set at the service request receiver and is used to perform authentication processing after the service request arrives at the service request receiver.
[0029] The authentication module obtains service request messages from the network protocol stack based on the service access mapping table, without relying on the internal interfaces of the service application or service communication component. Therefore, even if there are implementation differences in the service communication components used by different vehicle platforms or different components, the authentication module can still obtain service request messages on the network protocol stack side, thereby providing a message basis for subsequent authentication processing based on service information.
[0030] Step S2: Parse the service request message to obtain service information, and determine the service level based on the service information.
[0031] Specifically, after obtaining the service request message, the authentication module parses it according to the message format to obtain the service information carried in the message. The service information identifies the requester, the requested service, and related information about the message transmission in this service call. It may include at least one of the following: service identifier, service instance identifier, requester identifier, method identifier, source address, destination address, and port information. Specifically, the service identifier distinguishes different services, the service instance identifier distinguishes different service instances within the same service, the requester identifier distinguishes the application or node initiating the service call, the method identifier distinguishes different calling interfaces within the target service, and the source address, destination address, and port information represent the network transmission path of the service request message.
[0032] The authentication module determines the service level based on the parsed service information. The service level is used to characterize the authentication execution requirements corresponding to the service request. For example, the authentication module can determine the service type, business scenario, or service provider corresponding to the service request based on at least one of the service identifier, service instance identifier, requester identifier, source address, destination address, and port information in the service information, and further determine the corresponding service level.
[0033] Preferably, for services with high security importance, a higher service level can be assigned to them, allowing for more stringent authentication methods to be used subsequently. For general services, a normal service level can be assigned to them, allowing for conventional authentication methods to be used subsequently. For services where the service request receiving end has limited resources, low processing performance, or is not suitable for bearing authentication overhead, a specific service level can be assigned to them, allowing authentication processing to be configured on a more suitable end side for performing authentication.
[0034] Therefore, by parsing the service request message and determining the service level, a basis can be provided for selecting the corresponding authentication module, so that service requests of different types or in different scenarios can adopt matching authentication methods.
[0035] Step S3: Determine the target authentication module based on the service level, wherein the target authentication module includes a first authentication module and / or a second authentication module.
[0036] Specifically, after determining the service level, the authentication module selects either the first authentication module, the second authentication module, or both as the target authentication module to perform subsequent authentication processing on the service request message, based on the service level. The first authentication module is located at the service request sending end, and the second authentication module is located at the service request receiving end. When the target authentication module includes the first authentication module, it indicates that the service request can be authenticated at the service request sending end. When the target authentication module includes the second authentication module, it indicates that the service request can be authenticated at the service request receiving end. When the target authentication module includes both the first and second authentication modules, it indicates that the service request can be authenticated at both the service request sending end and the service request receiving end.
[0037] Step S4: The target authentication module authenticates the service request message based on the service information and the preset security access policy, and generates an authentication result. The preset security access policy can be defined according to the actual situation.
[0038] Specifically, after identifying the target authentication module, the system performs authentication processing on the service access behavior corresponding to the service request message based on service information and preset security access policies, and generates corresponding authentication results. The preset security access policies can be customized according to actual application scenarios, service security requirements, service call relationships, and vehicle platform configurations to adapt to the service access control needs of different vehicle platforms or different business scenarios.
[0039] This embodiment first obtains a service access mapping table through an authentication module, and then retrieves service request messages from the network protocol stack based on the service access mapping table. The authentication module includes a first authentication module and a second authentication module. The first authentication module is located at the service request sender, and the second authentication module is located at the service request receiver. The service request message is then parsed to obtain service information, and the service level is determined based on the service information. Next, a target authentication module is determined based on the service level, whereby the target authentication module includes the first authentication module and / or the second authentication module. Finally, the target authentication module authenticates the service request message based on the service information and a preset security access policy, and generates an authentication result. This reduces the service authentication scheme's dependence on underlying communication components, improves cross-platform adaptability, and enhances the flexibility and security of service access control in different service scenarios.
[0040] In some embodiments of this application, the service access mapping table is established in the following way: the authentication module obtains the service provision message sent by the service provider and parses the service provision message to obtain the service provision information of the service provider; and the service access mapping table is established based on the service provision information.
[0041] Specifically, the service provider publishes the services it can provide to other nodes in the network through service provision messages. The authentication module obtains the service provision message and parses it to obtain the service provision information corresponding to the service provider. The service provision information may include at least one of the following: service identifier, service instance identifier, service provider address, and service port.
[0042] The authentication module establishes a service access mapping table based on the service provider information. This table records the correspondence between services and network communication information, enabling the authentication module to determine the service request messages that need to be obtained subsequently. For example, the service access mapping table may include the correspondence between service identifiers and the service provider's address and service port.
[0043] Therefore, the embodiments of this application can dynamically establish a service access mapping table based on the service provision information published by the service provider, avoiding the fixed writing of the service provider address and service port into the policy file, and improving the adaptability of service access control to changes in service deployment.
[0044] In some embodiments of this application, determining the target authentication module based on service level includes: determining that the target authentication module includes a first authentication module in response to a service level less than or equal to a first preset service threshold; determining that the target authentication module includes a second authentication module in response to a service level greater than the first preset service threshold and less than or equal to a second preset service threshold; and determining that the target authentication module includes both the first and second authentication modules in response to a service level greater than the second preset service threshold, wherein the second preset service threshold is greater than the first preset service threshold. The first and second preset service thresholds can be calibrated according to actual conditions.
[0045] Specifically, the service level is used to characterize the authentication execution requirements corresponding to the service request, and different service levels can correspond to different authentication module selection methods. The first preset service threshold and the second preset service threshold are used to segment the service level. The second preset service threshold is greater than the first preset service threshold, and the first preset service threshold and the second preset service threshold can be calibrated according to actual conditions such as service security requirements, service importance, service receiver processing capabilities, vehicle platform configuration, or business application scenarios, so that the method of determining the target authentication module can adapt to the authentication requirements under different service scenarios.
[0046] For example, when the service level is less than or equal to a first preset service threshold, it indicates that the service request receiving end has limited resources, low processing performance, or is unsuitable for handling authentication overhead. In this case, the target authentication module is determined to include a first authentication module located at the service request sending end, thereby completing authentication before the service request message is sent. This reduces the processing overhead of the resource-constrained service request receiving end for invalid or unauthorized service requests, reduces the load on the receiving end, and improves service processing stability. When the service level is greater than the first preset service threshold and less than or equal to a second preset service threshold, it can indicate that the service request corresponds to a regular service scenario. In this case, the target authentication module is determined to include a second authentication module located at the service request receiving end, so that authentication is performed after the service request arrives at the receiving end. This allows regular service requests to be uniformly authenticated at the receiving end, reducing the modification and processing burden on the sending end. When the service level is greater than the second preset service threshold, it can indicate that the service request corresponds to a service scenario with high security importance. In this case, the target authentication module is determined to include both a first authentication module and a second authentication module, thereby performing access control before the service request is sent and after it arrives at the receiving end, reducing the risk of unauthorized service requests being sent or processed, and improving the access security of important services.
[0047] Therefore, the embodiments of this application can flexibly determine the authentication execution position of the service request message by comparing the service level with the preset service threshold, so that the service authentication method can adapt to the service access control requirements under different security importance and performance conditions.
[0048] In some embodiments of this application, obtaining a service request message from the network protocol stack based on a service access mapping table includes: capturing a network message matching the service access mapping table in the network protocol stack; performing message format verification on the captured network message; determining the network message as a service request message in response to the network message passing the message format verification; and generating a message error alarm message in response to the network message failing the message format verification.
[0049] Specifically, the authentication module captures network packets that match the service access mapping table on the network protocol stack side, based on the correspondence between services and network communication information recorded in the service access mapping table. For example, the authentication module matches network packets in the network protocol stack based on at least one of the service provider address, service port, service identifier, or service instance identifier in the service access mapping table to filter out network packets that may be related to service access.
[0050] like Figure 3As shown, taking the Linux system as an example, the INPUT and OUTPUT mount points in the Netfilter framework can be used to process network packets entering or originating from the local node. Specifically, during broadcast packet processing, matching rules can be set using iptables to obtain broadcast packets during the service discovery phase, and packet information can be obtained through communication mechanisms such as libnetlink or libmnl. During service packet processing, matching rules can be set based on the IP address and port information in the service access mapping table to obtain service data packets during the service invocation phase, and these packets can then be parsed.
[0051] In addition, the authentication module can perform packet format verification on captured network packets to determine whether the network packet conforms to the packet format requirements of a service request packet. Packet format verification can include at least one of the following: packet length verification, field integrity verification, packet header format verification, service identifier field verification, and port matching verification. If the captured network packet passes the packet format verification, it can be identified as a service request packet for subsequent parsing and authentication processing. If the captured network packet fails the packet format verification, it indicates that the network packet may have format abnormalities, missing fields, incorrect fields, or mismatch with the target service. In this case, packet abnormality alarm information can be generated for logging, risk analysis, or security monitoring.
[0052] Therefore, the embodiments of this application can perform matching, capture and format verification of network packets on the network protocol stack side, reduce irrelevant packets from entering the subsequent authentication process, and improve the accuracy and reliability of service request packet identification.
[0053] In some embodiments of this application, the target authentication module authenticates the service request message based on service information and a preset security access policy, including: determining the service requester and target service corresponding to the service request message based on the service information; and determining whether the service requester has permission to access the target service based on the preset security access policy, so as to generate an authentication result.
[0054] Specifically, the target authentication module determines the service requester and the target service in this service access behavior based on the service information. The service requester can be the application, process, controller, or vehicle node initiating the service call, and the target service can be the vehicle function service requested by the service requester. For example, the service requester can be determined based on at least one of the requester identifier, source address, and source port in the service information, and the target service can be determined based on at least one of the service identifier, service instance identifier, destination address, and destination port in the service information.
[0055] The target authentication module matches the service requester and the target service against a preset security access policy, and determines whether the service request meets the requirements of the preset security access policy based on the matching result. For example, the preset security access policy may record permission relationships such as a first application being able to access the car door control service and a second application being unable to access the car door control service. When the target authentication module determines that the service requester is the first application and the target service is the car door control service based on the service information, it can generate an authentication result indicating successful authentication. When the target authentication module determines that the service requester is the second application and the target service is the car door control service, it can generate an authentication result indicating failed authentication.
[0056] Therefore, the embodiments of this application can authenticate the service access behavior corresponding to the service request message based on the access permission relationship between the service requester and the target service, thereby preventing unauthorized service requests from accessing the target service.
[0057] In some embodiments of this application, in response to a successful authentication result, the target authentication module controls the continued transmission of the service request message; in response to a failed authentication result, the target authentication module performs alarm processing on the service request message, or generates alarm information and blocks the continued transmission of the service request message.
[0058] Specifically, after generating the authentication result, the target authentication module performs corresponding processing on the service request message based on the authentication result. When the authentication result is successful, it means that the service access behavior corresponding to the service request message meets the requirements of the preset security access policy. At this time, the target authentication module can control the service request message to continue to be transmitted, so that the service request message can continue to be sent to the service request receiver or continue to be delivered to the corresponding target service.
[0059] When the authentication result is "authentication failed," it indicates that the service access behavior corresponding to the service request message does not meet the requirements of the preset security access policy. In this case, the target authentication module can process the service request message according to the preset handling method. The preset handling method may include at least one of alarm handling, blocking handling, or alarm and blocking handling, and the preset handling method can be specified according to the actual situation such as service security requirements, service level, vehicle platform configuration, or business application scenario.
[0060] In one example, if the default handling method is alarm processing, the target authentication module can generate alarm information and control the continued transmission of service request messages to monitor abnormal access behavior without affecting business continuity. In another example, if the default handling method is blocking processing or alarm and blocking processing, the target authentication module can block the continued transmission of service request messages, or block the continued transmission of service request messages after generating alarm information, to reduce the risk of unauthorized service requests being processed by the target service.
[0061] Therefore, the embodiments of this application can differentiate the processing of service request messages based on the authentication results, so as to meet the service access control requirements while taking into account security protection and business operation continuity.
[0062] In some embodiments of this application, the target authentication module includes a first authentication module that authenticates the service request message before it is sent to the network protocol stack; the target authentication module also includes a second authentication module that authenticates the service request message before it is transmitted to the service application.
[0063] Specifically, when the target authentication module includes a first authentication module, the first authentication module authenticates the service request message at the service request sending end. For example, the first authentication module can authenticate the service request message before it enters the network protocol stack for output processing, or during the process of the service request message being sent outward via the network protocol stack, thereby completing access control before the service request message is sent to the service request receiving end.
[0064] When the target authentication module includes a second authentication module, the second authentication module authenticates the service request message at the service request receiving end. For example, such as... Figure 4 As shown, the second authentication module can authenticate the service request message after it arrives at the service request receiving end and before it is transmitted to the service application, thereby completing access control before the target service processes the service request message.
[0065] When the target authentication module includes both a first authentication module and a second authentication module, the service request message is first authenticated by the first authentication module at the service request sending end, and then authenticated by the second authentication module after arriving at the service request receiving end, thus forming an authentication method that combines the sending end and the receiving end.
[0066] Therefore, the embodiments of this application can set the authentication process at different transmission stages of the service request message according to different target authentication modules, so that the service request message can be subject to corresponding access control before sending, after receiving, or before the target service is processed, thereby improving the flexibility and security of service authentication.
[0067] As a specific embodiment of this application, such as Figure 1 As shown, taking the vehicle SOA architecture as an example, such as Figure 5 As shown, the service authentication method may include the following steps: S101, the authentication module obtains the service provision message sent by the service provider and parses the service provision message to obtain the service provision information of the service provider.
[0068] Specifically, during SOME / IP service communication, the service provider advertises its services to other nodes in the network through a service discovery mechanism. For example, the service offering message is the Offer_Service message within the SOME / IP service discovery message, which is sent via UDP broadcast or multicast. The authentication module obtains this service offering message from the network protocol stack and parses it to obtain the service offering information of the service provider. This service offering information includes at least one of ServiceID, InstanceID, service provider IP address, and service port.
[0069] S102, the authentication module establishes a service access mapping table based on the service provision information.
[0070] Specifically, the authentication module establishes a service access mapping table (TABLE) based on the parsed service provision information. The service access mapping table records the correspondence between SOA services and network communication information. For example, the service access mapping table records the correspondence between ServiceID, InstanceID, service provider IP address, and service port (PORT).
[0071] For example, if the authentication module parses a Service_Service message and obtains that ServiceID is the first service identifier, InstanceID is the first service instance identifier, the service provider's IP address is the first IP address, and the service port is the first port for service A, then it establishes a mapping relationship between the first service identifier, the first service instance identifier, the first IP address, and the first port in the service access mapping table. Therefore, the authentication module can subsequently identify service request messages for accessing service A based on this mapping relationship, without needing to pre-write the service provider's IP address and port into the security access policy file.
[0072] In one example, the authentication module utilizes the packet processing capabilities of the network protocol stack to obtain service offering packets. For instance, in a Linux system, the OUTPUT mount point based on the Netfilter framework obtains service discovery packets sent outward by the service provider and can combine this with iptables rules to export or match corresponding UDP packets. After obtaining the UDP packets, the authentication module identifies whether they contain SOME / IP service discovery packets, and upon identifying the Offer_Service packet, parses the ServiceID, InstanceID, IP address, and port information carried within it.
[0073] S103, the authentication module obtains service request messages from the network protocol stack based on the service access mapping table.
[0074] Specifically, the authentication module captures network packets matching the service access mapping table in the network protocol stack based on information such as IP addresses and ports recorded in the service access mapping table. Taking receiver authentication as an example, the authentication module captures network packets whose destination IP address and destination port match the service access mapping table in the input path of the network protocol stack of the service request receiver. Taking sender authentication as an example, the authentication module captures the service request packet to be sent in the output path of the network protocol stack of the service request sender.
[0075] In one example, network packets are captured using the INPUT and / or OUTPUT mount points in the Netfilter framework. The INPUT mount point is used to capture network packets entering the local node, while the OUTPUT mount point is used to capture network packets being sent out of the local node. The authentication module, in conjunction with iptables rules, matches destination IP addresses, destination ports, transport layer protocols, etc., thereby capturing network packets that may belong to SOA service access processes.
[0076] Furthermore, the authentication module performs SOME / IP packet format identification and verification on the captured network packets. If the network packet meets the format requirements of a SOME / IP service request packet, it is identified as a service request packet. If the network packet does not meet the corresponding format requirements, a packet anomaly alarm message is generated.
[0077] S104, the authentication module parses the service request message to obtain service information and determines the service level based on the service information.
[0078] Specifically, the authentication module deserializes and parses the service request message to obtain the service information carried within it. In a SOME / IP communication scenario, the service information includes at least one of the following: ServiceID, InstanceID, ClientID, MethodID, source IP address, destination IP address, source port, and destination port. Among these, ServiceID identifies the requested service, InstanceID identifies the corresponding service instance, ClientID identifies the client or application initiating the service call, MethodID identifies the specific calling method within the target service, and the IP address and port represent the network transmission information of the service request message.
[0079] Furthermore, the authentication module determines the service level based on the service information. The service level is related to factors such as the service's importance, security sensitivity, the processing performance of the service request receiver, and the capacity to bear authentication overhead. For example, a higher service level is determined for services with high security importance. A normal service level is determined for ordinary services. For services where the service request receiver has limited resources, low processing performance, or is unsuitable for bearing authentication overhead, a specific service level is determined to allow for the selection of a more suitable authentication execution location later.
[0080] S105, the authentication module determines the target authentication module based on the service level.
[0081] Specifically, the authentication module includes a first authentication module and a second authentication module. The first authentication module is located at the service request sending end, and the second authentication module is located at the service request receiving end. The authentication module determines the target authentication module from the first and second authentication modules based on the service level.
[0082] For example, in general service access scenarios, the target authentication module is determined to include a second authentication module, enabling service request messages to be authenticated at the service request receiving end. In service access scenarios with high security importance, the target authentication module is determined to include a first authentication module and a second authentication module, enabling service request messages to be authenticated at both the service request sending end and the service request receiving end. In scenarios where the service request receiving end has limited resources or insufficient performance to support the authentication overhead, the target authentication module is determined to include a first authentication module, enabling service request messages to be authenticated at the service request sending end, thereby reducing the processing burden on the service request receiving end.
[0083] S106, the target authentication module authenticates the service request message based on the service information and the preset security access policy, and generates the authentication result.
[0084] Specifically, the target authentication module determines the service requester and the target service based on service information. For example, it determines the service requester based on ClientID, source IP address, or source port, and determines the target service based on ServiceID, InstanceID, destination IP address, or destination port. The preset security access policy includes access control rules between the service requester and the target service, which are defined based on the actual service call relationship, service security requirements, and vehicle platform configuration.
[0085] During authentication, the target authentication module matches the requester-related information and service-related information in the service information against preset security access policies. For example, it matches the ClientID with the requester matching items in the policy, and the ServiceID and / or InstanceID with the service matching items in the policy. When the matching result shows that the service request meets the preset security access policy, an authentication success result is generated. When the matching result shows that the service request does not meet the preset security access policy, an authentication failure result is generated.
[0086] S107, The target authentication module processes the service request message based on the authentication result.
[0087] Specifically, when the authentication result is successful, the target authentication module controls the continued transmission of the service request message. For example, in a sender-end authentication scenario, it controls the service request message to continue being sent to the service request receiver via the network protocol stack. In a receiver-end authentication scenario, it controls the service request message to continue being delivered to the corresponding service application.
[0088] When authentication fails, the target authentication module processes the service request message according to a preset handling method. The preset handling methods include at least one of the following: alarm only, alarm and block, and direct block. For example, if the preset handling method is alarm only, the target authentication module generates an alarm message and records the abnormal access log. If the preset handling method is alarm and block, the target authentication module generates an alarm message and blocks the continued transmission of the service request message to prevent unauthorized service requests from being processed by the target service.
[0089] In summary, the service authentication method according to the embodiments of this application first obtains a service access mapping table through an authentication module, and then obtains a service request message from the network protocol stack based on the service access mapping table. The authentication module includes a first authentication module and a second authentication module, with the first authentication module located at the service request sender and the second authentication module located at the service request receiver. The service request message is then parsed to obtain service information, and the service level is determined based on the service information. Next, a target authentication module is determined based on the service level, whereby the target authentication module includes the first authentication module and / or the second authentication module. Finally, the target authentication module authenticates the service request message based on the service information and a preset security access policy, and generates an authentication result. This reduces the service authentication scheme's dependence on underlying communication components, improves cross-platform adaptability, and enhances the flexibility and security of service access control in different service scenarios.
[0090] Corresponding to the above embodiments, this application also proposes a service authentication device.
[0091] like Figure 6As shown, the service authentication device 600 of this application includes: an acquisition module 610, a parsing module 620, a determination module 630, and a generation module 640.
[0092] The acquisition module 610 is used to acquire a service access mapping table through the authentication module and acquire service request messages from the network protocol stack based on the service access mapping table. The authentication module includes a first authentication module and a second authentication module, with the first authentication module located at the service request sending end and the second authentication module located at the service request receiving end. The parsing module 620 is used to parse the service request messages to obtain service information and determine the service level based on the service information. The determination module 630 is used to determine the target authentication module based on the service level. The target authentication module includes the first authentication module and / or the second authentication module. The generation module 640 is used to authenticate the service request messages through the target authentication module based on the service information and a preset security access policy and generate an authentication result.
[0093] According to one embodiment of this application, the service access mapping table is established in the following manner: the authentication module obtains the service provision message sent by the service provider and parses the service provision message to obtain the service provision information of the service provider; and the service access mapping table is established based on the service provision information.
[0094] According to one embodiment of this application, the determining module 630 is further configured to determine a target authentication module based on the service level, including: in response to a service level less than or equal to a first preset service threshold, determining that the target authentication module includes a first authentication module; in response to a service level greater than the first preset service threshold and less than or equal to a second preset service threshold, determining that the target authentication module includes a second authentication module; in response to a service level greater than the second preset service threshold, determining that the target authentication module includes both the first authentication module and the second authentication module, wherein the second preset service threshold is greater than the first preset service threshold.
[0095] According to one embodiment of this application, the acquisition module 610 is further configured to acquire a service request message from the network protocol stack based on a service access mapping table, including: capturing a network message matching the service access mapping table in the network protocol stack based on the service access mapping table; performing message format verification on the captured network message; determining the network message as a service request message in response to the network message passing the message format verification; and generating a message abnormality alarm message in response to the network message failing the message format verification.
[0096] According to one embodiment of this application, the authentication module 640 is further configured to authenticate the service request message through the target authentication module based on service information and a preset security access policy, including: determining the service requester and target service corresponding to the service request message based on the service information; and determining whether the service requester has permission to access the target service based on the preset security access policy, so as to generate an authentication result.
[0097] According to one embodiment of this application, the service authentication device 600 further includes a control module, configured to control the continued transmission of the service request message through the target authentication module in response to an authentication success result; and to perform alarm processing on the service request message through the target authentication module in response to an authentication failure result, or to generate alarm information and block the continued transmission of the service request message.
[0098] According to one embodiment of this application, the generation module 640 is further configured to, in response to the authentication module including a first authentication module, authenticate the service request message before the service request message is sent to the network protocol stack; and in response to the authentication module including a second authentication module, authenticate the service request message before the service request message is transmitted to the service application.
[0099] It should be noted that the above explanation of the embodiments and beneficial effects of the service authentication method also applies to the service authentication device in the embodiments of this application. To avoid redundancy, it will not be elaborated in detail here.
[0100] In summary, the service authentication device of this application first obtains a service access mapping table through the authentication module via the acquisition module, and then obtains a service request message from the network protocol stack based on the service access mapping table. The authentication module includes a first authentication module and a second authentication module, with the first authentication module located at the service request sender and the second authentication module located at the service request receiver. Next, the parsing module parses the service request message to obtain service information and determines the service level based on the service information. Then, the determination module determines the target authentication module based on the service level, whereby the target authentication module includes the first authentication module and / or the second authentication module. Finally, the generation module authenticates the service request message based on the service information and a preset security access policy through the target authentication module and generates an authentication result. This reduces the service authentication scheme's dependence on underlying communication components, improves cross-platform adaptability, and enhances the flexibility and security of service access control in different service scenarios.
[0101] Corresponding to the above embodiments, this application also proposes an electronic device.
[0102] like Figure 7As shown, the electronic device 700 of this application embodiment includes a memory 710, a processor 720, and a computer program stored in the memory 710 and executable on the processor 720. The processor 720 executes the program to implement any of the above-mentioned service authentication methods.
[0103] The electronic device according to the embodiments of this application implements any of the above-mentioned service authentication methods when the processor executes a computer program, thereby reducing the dependence of the service authentication scheme on the underlying communication components, improving cross-platform adaptability, and enhancing the flexibility and security of service access control in different service scenarios.
[0104] Corresponding to the above embodiments, this application also proposes a computer-readable storage medium.
[0105] The computer-readable storage medium of this application embodiment stores a computer program thereon, which is executed by a processor to implement any of the above-described service authentication methods.
[0106] The computer-readable storage medium according to the embodiments of this application implements any of the above-described service authentication methods when the computer program stored thereon is executed by a processor. This reduces the dependence of the service authentication scheme on the underlying communication components, improves cross-platform adaptability, and enhances the flexibility and security of service access control in different service scenarios.
[0107] Specifically, in the embodiments of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0108] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0109] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. A service authentication method, characterized in that, include: The authentication module obtains a service access mapping table and obtains a service request message from the network protocol stack based on the service access mapping table. The authentication module includes a first authentication module and a second authentication module. The first authentication module is located at the service request sending end and the second authentication module is located at the service request receiving end. The service request message is parsed to obtain service information, and the service level is determined based on the service information. The target authentication module is determined based on the service level, wherein the target authentication module includes the first authentication module and / or the second authentication module; The target authentication module authenticates the service request message based on the service information and the preset security access policy, and generates an authentication result.
2. The service authentication method according to claim 1, characterized in that, The service access mapping table is established in the following way: The authentication module obtains the service provision message sent by the service provider and parses the service provision message to obtain the service provision information of the service provider. The service access mapping table is established based on the service provision information.
3. The service authentication method according to claim 1, characterized in that, The module for determining the target authentication based on the service level includes: In response to the service level being less than or equal to a first preset service threshold, it is determined that the target authentication module includes the first authentication module; In response to the service level being greater than the first preset service threshold and less than or equal to the second preset service threshold, it is determined that the target authentication module includes the second authentication module; In response to the service level being greater than the second preset service threshold, it is determined that the target authentication module includes the first authentication module and the second authentication module, wherein the second preset service threshold is greater than the first preset service threshold.
4. The service authentication method according to claim 1, characterized in that, The step of obtaining the service request message from the network protocol stack based on the service access mapping table includes: Based on the service access mapping table, network packets that match the service access mapping table are captured in the network protocol stack. Perform packet format verification on the captured network packets; In response to the network packet passing the packet format verification, the network packet is determined to be the service request packet; In response to the network packet failing the packet format verification, a packet anomaly alarm message is generated.
5. The service authentication method according to claim 1, characterized in that, The step of authenticating the service request message by the target authentication module based on the service information and the preset security access policy includes: The service requester and target service corresponding to the service request message are determined based on the service information. Based on the preset security access policy, it is determined whether the service requester has permission to access the target service, so as to generate the authentication result.
6. The service authentication method according to claim 1, characterized in that, Also includes: In response to the authentication result being successful, the target authentication module controls the continued transmission of the service request message; In response to the authentication failure result, the target authentication module performs alarm processing on the service request message, or generates alarm information and blocks the continued transmission of the service request message.
7. The service authentication method according to claim 3, characterized in that, Also includes: In response to the target authentication module including the first authentication module, the service request message is authenticated before it is sent to the network protocol stack; In response to the target authentication module including the second authentication module, the service request message is authenticated before it is transmitted to the service application.
8. A service authentication device, characterized in that, include: The acquisition module is used to acquire a service access mapping table through the authentication module and acquire a service request message from the network protocol stack based on the service access mapping table. The authentication module includes a first authentication module and a second authentication module. The first authentication module is located at the service request sending end, and the second authentication module is located at the service request receiving end. The parsing module is used to parse the service request message to obtain service information and determine the service level based on the service information; A determining module is used to determine a target authentication module based on the service level, wherein the target authentication module includes the first authentication module and / or the second authentication module; The generation module is used to authenticate the service request message and generate an authentication result by means of the target authentication module based on the service information and the preset security access policy.
9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the service authentication method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program is executed by a processor to implement the service authentication method as described in any one of claims 1-7.
