CN112333198B - Secure cross-domain login method, system and server - Google Patents
Secure cross-domain login method, system and server Download PDFInfo
- Publication number
- CN112333198B CN112333198B CN202011284833.7A CN202011284833A CN112333198B CN 112333198 B CN112333198 B CN 112333198B CN 202011284833 A CN202011284833 A CN 202011284833A CN 112333198 B CN112333198 B CN 112333198B
- Authority
- CN
- China
- Prior art keywords
- application server
- request
- trust token
- temporary trust
- application
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
- H04L63/0807—Network architectures or network communication protocols for network security for authentication of entities using tickets, e.g. Kerberos
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
- H04L63/0815—Network architectures or network communication protocols for network security for authentication of entities providing single-sign-on or federations
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
- H04L63/083—Network architectures or network communication protocols for network security for authentication of entities using passwords
- H04L63/0838—Network architectures or network communication protocols for network security for authentication of entities using passwords using one-time-passwords
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0863—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/088—Usage controlling of secret information, e.g. techniques for restricting cryptographic keys to pre-authorized uses, different access levels, validity of crypto-period, different key- or password length, or different strong and weak cryptographic algorithms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/321—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority
- H04L9/3213—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority using tickets or tokens, e.g. Kerberos
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3226—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using a predetermined code, e.g. password, passphrase or PIN
- H04L9/3228—One-time or temporary data, i.e. information which is sent for every authentication or authorization, e.g. one-time-password, one-time-token or one-time-key
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3247—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本发明提供了安全跨域登录方法、系统及服务器,其中方法包括:第一应用服务器接收第一应用客户端发送的、用于请求登录第二应用服务器提供的目标网页的登录请求,并根据登录请求获取第一应用客户端对应的用户身份信息,根据用户身份信息生成请求报文并发送至第二应用服务器;第二应用服务器基于请求报文生成临时信任令牌,并发送至第一应用客户端;第一应用客户端向第二应用服务器提供的目标网页页面发送携带临时信任令牌的跳转请求;第二应用服务器对临时信任令牌进行验证,并在通过后对第一应用客户端进行登录授信。利用上述方法,无须二次登录即可实现无感跨站访问,给用户提供更好的互联网体验,并且基于临时信任令牌保护跳转链接,更安全。
The present invention provides a secure cross-domain login method, system and server, wherein the method includes: the first application server receives the login request sent by the first application client for requesting login to the target web page provided by the second application server, and according to the login Request to obtain the user identity information corresponding to the first application client, generate a request message according to the user identity information and send it to the second application server; the second application server generates a temporary trust token based on the request message, and send it to the first application client end; the first application client sends a jump request carrying a temporary trust token to the target web page provided by the second application server; the second application server verifies the temporary trust token, and after passing Perform login authorization. Using the above method, non-sensing cross-site access can be realized without secondary login, providing users with a better Internet experience, and the jump link is protected based on the temporary trust token, which is more secure.
Description
技术领域technical field
本发明属于通信技术领域,具体涉及安全跨域登录方法、系统及服务器。The invention belongs to the technical field of communications, and in particular relates to a secure cross-domain login method, system and server.
背景技术Background technique
本部分旨在为权利要求书中陈述的本发明的实施方式提供背景或上下文。此处的描述不因为包括在本部分中就承认是现有技术。This section is intended to provide a background or context for implementations of the invention that are recited in the claims. The descriptions herein are not admitted to be prior art by inclusion in this section.
随着互联网技术的飞速发展,应用软件和网站的数量也日益增多,而且多数应用软件或网站往往都需要注册登录后才能使用相关的服务。在某些应用之间,例如社交应用、购物应用、游戏应用、企业内部业务系统等,因为业务整合需要,用户只需要在一个应用网站中登录,即可以登录态访问其他应用网站,这也称之为跨系统的登录认证。With the rapid development of Internet technology, the number of application software and websites is also increasing day by day, and most application software or websites often require registration and login before using related services. Between certain applications, such as social networking applications, shopping applications, game applications, internal business systems of enterprises, etc., due to business integration needs, users only need to log in to one application website, that is, they can log in to other application websites, which is also called It is cross-system login authentication.
目前有一种跨系统的登录认证方案是基于OAuth2.0的用户认证,OAuth2.0是允许第三方应用通过跳转本系统的登录页面,用户通过授权后获取授权码,再利用授权码获取令牌,最后通过令牌去本系统获取受保护资源。然而这种方式要求第三方应用的用户必须在本系统注册,对第三方应用要求比较苛刻。At present, there is a cross-system login authentication scheme based on OAuth2.0 user authentication. OAuth2.0 allows third-party applications to jump to the login page of the system, and the user obtains an authorization code after authorization, and then uses the authorization code to obtain a token. , and finally go to the system to obtain protected resources through the token. However, this method requires users of third-party applications to register in this system, which is more demanding for third-party applications.
因此,目前需要本领域技术人员迫切解决的一个技术问题就是:如何提出一种安全跨域登录机制,以增强用户的无感安全跨域登录体验,并且保证安全跨域登录。Therefore, a technical problem urgently needed by those skilled in the art is: how to propose a secure cross-domain login mechanism to enhance the user's senseless secure cross-domain login experience and ensure secure cross-domain login.
发明内容Contents of the invention
针对上述现有技术中存在的问题,提出了一种安全跨域登录方法、装置及计算机可读存储介质,利用这种方法、装置及计算机可读存储介质,能够解决上述问题。Aiming at the above-mentioned problems in the prior art, a secure cross-domain login method, device, and computer-readable storage medium are proposed, and the above-mentioned problems can be solved by using the method, device, and computer-readable storage medium.
本发明提供了以下方案。The present invention provides the following solutions.
第一方面,提供一种安全跨域登录方法,包括:第一应用服务器接收第一应用客户端发送的登录请求,登录请求用于请求登录第二应用服务器提供的目标网页页面;第一应用服务器根据登录请求获取对应于第一应用客户端的用户身份信息,根据用户身份信息生成请求报文,并将请求报文发送至第二应用服务器;第二应用服务器基于请求报文生成临时信任令牌,并通过第一应用服务器发送至第一应用客户端;第一应用客户端向第二应用服务器提供的目标网页页面发送跳转请求,跳转请求至少携带临时信任令牌;第二应用服务器对跳转请求携带的临时信任令牌进行验证,并在验证通过后对第一应用客户端进行登录授信。In the first aspect, a secure cross-domain login method is provided, including: the first application server receives a login request sent by the first application client, and the login request is used to request to log in to the target web page provided by the second application server; the first application server Obtaining user identity information corresponding to the first application client according to the login request, generating a request message according to the user identity information, and sending the request message to the second application server; the second application server generates a temporary trust token based on the request message, and sent to the first application client through the first application server; the first application client sends a jump request to the target webpage provided by the second application server, and the jump request carries at least a temporary trust token; The temporary trust token carried in the transfer request is verified, and after the verification is passed, the login authorization is performed to the first application client.
在一些实施方式中,登录请求包含第一应用客户端的设备地址信息,第一应用服务器根据登录请求获取对应于第一应用客户端的用户身份信息,还包括:第一应用服务器根据第一应用客户端的设备地址信息进行本地查询,以获得对应于第一应用客户端的用户身份信息。In some implementations, the login request includes device address information of the first application client, and the first application server acquires user identity information corresponding to the first application client according to the login request, and further includes: the first application server obtains the user identity information corresponding to the first application client according to the Perform a local query on the device address information to obtain user identity information corresponding to the first application client.
在一些实施方式中,第一应用服务器根据用户身份信息生成请求报文,还包括:第一应用服务器基于预设报文规范生成请求报文;其中,请求报文包括以下中的一项或多项:第一应用服务器的身份标识、第一应用客户端对应的设备地址信息和用户身份信息。In some implementations, the first application server generates the request message according to the user identity information, and further includes: the first application server generates the request message based on the preset message specification; wherein the request message includes one or more of the following Item: the identity of the first application server, the device address information and user identity information corresponding to the first application client.
在一些实施方式中,在第二应用服务器基于请求报文生成临时信任令牌之前,方法还包括:第二应用服务器根据第一应用服务器的身份标识查找预先配置的服务器白名单,以进行服务器身份校验;其中,若服务器身份校验不通过,则第二应用服务器拒绝生成临时信任令牌,并向第一应用服务器返回第一报错信息。In some implementations, before the second application server generates the temporary trust token based on the request message, the method further includes: the second application server searches a pre-configured server whitelist according to the identity of the first application server to identify the server identity verification; where, if the server identity verification fails, the second application server refuses to generate a temporary trust token, and returns the first error message to the first application server.
在一些实施方式中,在第二应用服务器基于请求报文生成临时信任令牌之前,方法还包括:第二应用服务器根据预设报文规范对请求报文进行报文校验;其中,若报文校验不通过,则第二应用服务器拒绝生成临时信任令牌,并向第一应用服务器返回第二报错信息。In some embodiments, before the second application server generates the temporary trust token based on the request message, the method further includes: the second application server performs message verification on the request message according to the preset message specification; If the text verification fails, the second application server refuses to generate a temporary trust token, and returns a second error message to the first application server.
在一些实施方式中,预设报文规范指示请求报文包括至少一个报文必填域,以及,第二应用服务器根据预设报文规范对请求报文进行报文校验,包括:第二应用服务器判断请求报文中的报文必填域是否非空和/或是否按预设格式填写。In some implementations, the preset message specification indicates that the request message includes at least one message mandatory field, and the second application server performs message verification on the request message according to the preset message specification, including: the second The application server judges whether the mandatory field in the request message is not empty and/or is filled in according to a preset format.
在一些实施方式中,方法还包括:第一应用服务器预先基于加密算法生成第一密钥对,包括第一公钥和第一私钥;第一应用服务器根据第一私钥对请求报文进行签名,并将签名后的请求报文发送给第二应用服务器;第二应用服务器预先获取第一应用服务器提供的第一公钥,并根据第一公钥对接收的请求报文进行签名验证;其中,若签名验证不通过,则第二应用服务器拒绝生成临时信任令牌,并向第一应用服务器返回第三报错信息。In some embodiments, the method further includes: the first application server generates a first key pair in advance based on an encryption algorithm, including a first public key and a first private key; Sign, and send the signed request message to the second application server; the second application server obtains the first public key provided by the first application server in advance, and performs signature verification on the received request message according to the first public key; Wherein, if the signature verification fails, the second application server refuses to generate the temporary trust token, and returns a third error message to the first application server.
在一些实施方式中,第二应用服务器基于请求报文生成临时信任令牌之前,方法还包括:第一应用服务器对用户身份信息的一项或多项进行敏感信息加密,以获得敏感身份信息段,请求报文还包括敏感身份信息段;第二应用服务器预先获取第一应用服务器提供的敏感信息密钥,并根据敏感信息密钥对接收的请求报文中的敏感身份信息段进行敏感解密,以获得用户身份信息的明文信息;其中,若未成功实现敏感解密,则第二应用服务器拒绝生成临时信任令牌,并向第一应用服务器返回第四报错信息。In some embodiments, before the second application server generates the temporary trust token based on the request message, the method further includes: the first application server encrypts sensitive information on one or more pieces of user identity information to obtain sensitive identity information segments , the request message also includes a sensitive identity information segment; the second application server pre-acquires the sensitive information key provided by the first application server, and performs sensitive decryption on the sensitive identity information segment in the received request message according to the sensitive information key, The plaintext information of the user identity information is obtained; wherein, if the sensitive decryption is not successfully implemented, the second application server refuses to generate a temporary trust token, and returns a fourth error message to the first application server.
在一些实施方式中,第二应用服务器基于请求报文生成临时信任令牌,还包括:第二应用服务器根据请求报文中包含的用户身份信息生成全局唯一的临时信任令牌;第二应用服务器将临时信任令牌和对应的用户身份信息以键值对形式缓存至内存数据库,并为临时信任令牌设置预定有效期限,其中,在预定有效期限到达之后将临时信任令牌对应的键值对从内存数据库删除。In some embodiments, the second application server generates a temporary trust token based on the request message, and further includes: the second application server generates a globally unique temporary trust token according to the user identity information contained in the request message; the second application server Cache the temporary trust token and corresponding user identity information to the memory database in the form of key-value pairs, and set a predetermined validity period for the temporary trust token, where the key-value pair corresponding to the temporary trust token will be Deleted from the in-memory database.
在一些实施方式中,第二应用服务器根据用户身份信息生成全局唯一的临时信任令牌,还包括:第二应用服务器利用SnowFlake算法生成临时信任令牌。In some implementations, the second application server generates a globally unique temporary trust token according to the user identity information, and further includes: the second application server generates the temporary trust token by using a SnowFlake algorithm.
在一些实施方式中,第二应用服务器基于请求报文生成临时信任令牌之后,还包括:第二应用服务器根据请求报文中包含的用户身份信息进行用户注册或用户绑定。In some embodiments, after the second application server generates the temporary trust token based on the request message, it further includes: the second application server performs user registration or user binding according to the user identity information contained in the request message.
在一些实施方式中,方法还包括:第二应用服务器基于加密算法预先生成第二密钥,包括第二公钥和第二私钥;第二应用服务器根据临时信任令牌生成应答报文,并根据第二私钥对应答报文进行签名,并将签名后的应答报文发送给第一应用服务器;第一应用服务器预先获取第二应用服务器提供的第二公钥,并根据第二公钥对接收的应答报文进行签名解密。In some implementations, the method further includes: the second application server pre-generates a second key based on an encryption algorithm, including a second public key and a second private key; the second application server generates a response message according to the temporary trust token, and Sign the response message according to the second private key, and send the signed response message to the first application server; the first application server obtains the second public key provided by the second application server in advance, and according to the second public key Signature decryption is performed on the received response message.
在一些实施方式中,第二应用服务器对跳转请求携带的临时信任令牌进行验证,包括:若第二应用服务器验证确定跳转请求中包含临时信任令牌,且在内存数据库中包含对应于临时信任令牌的值,则对第一应用客户端进行登录授信;否则,第二应用服务器拒绝对第一应用客户端进行登录授信。In some implementations, the second application server verifies the temporary trust token carried in the redirect request, including: if the second application server verifies that the redirect request contains the temporary trust token, and contains the corresponding value of the temporary trust token, the first application client is authenticated for login; otherwise, the second application server refuses to be authenticated for login of the first application client.
在一些实施方式中,第二应用服务器对跳转请求携带的临时信任令牌进行验证,还包括:第二应用服务器获取跳转请求包含的源域名,根据源域名查找预设域名白名单,以对跳转请求以进行源域名校验;若源域名校验不通过,则第二应用服务器拒绝对第一应用客户端进行登录授信。In some implementations, the second application server verifies the temporary trust token carried in the redirection request, and further includes: the second application server obtains the source domain name included in the redirection request, searches the preset domain name whitelist according to the source domain name, and Perform source domain name verification on the redirection request; if the source domain name verification fails, the second application server refuses to perform login authorization for the first application client.
在一些实施方式中,对第一应用客户端进行登录授信之后,方法还包括:第二应用服务器提取内存数据库中对应于临时信任令牌的用户身份信息;第二应用服务器根据用户身份信息获取对应的历史交易信息;以及,第二应用服务器基于预设权益规则、历史交易信息和用户身份信息为第一应用客户端提供对应的权益信息。In some implementations, after performing login authorization on the first application client, the method further includes: the second application server extracts the user identity information corresponding to the temporary trust token in the memory database; the second application server obtains the corresponding and, the second application server provides corresponding equity information to the first application client based on preset equity rules, historical transaction information, and user identity information.
第二方面,提供一种安全跨域登录方法,应用于第一应用服务器,包括:接收第一应用客户端发送的登录请求,登录请求用于请求登录第二应用服务器提供的目标网页页面;根据登录请求获取对应于第一应用客户端的用户身份信息,根据用户身份信息生成请求报文,并将请求报文发送至第二应用服务器;接收第二应用服务器发送的临时信任令牌,临时信任令牌基于请求报文生成;将临时信任令牌发送至第一应用客户端,使第一应用客户端向第二应用服务器提供的目标网页页面发送跳转请求,跳转请求至少携带临时信任令牌。In the second aspect, a secure cross-domain login method is provided, which is applied to a first application server, including: receiving a login request sent by a first application client, where the login request is used to request login to a target web page provided by a second application server; according to The login request obtains the user identity information corresponding to the first application client, generates a request message according to the user identity information, and sends the request message to the second application server; receives the temporary trust token sent by the second application server, and the temporary trust token The card is generated based on the request message; the temporary trust token is sent to the first application client, so that the first application client sends a jump request to the target web page provided by the second application server, and the jump request carries at least the temporary trust token .
在一些实施方式中,登录请求包含第一应用客户端的设备地址信息,根据登录请求获取对应于第一应用客户端的用户身份信息,还包括:根据第一应用客户端的设备地址信息进行本地查询,以获得对应于第一应用客户端的用户身份信息;其中,第一应用客户端基于用户身份信息预先注册于第一应用服务器。In some implementations, the login request includes the device address information of the first application client, and obtaining the user identity information corresponding to the first application client according to the login request further includes: performing a local query according to the device address information of the first application client to obtain Obtaining user identity information corresponding to the first application client; wherein, the first application client is pre-registered with the first application server based on the user identity information.
第三方面,提供一种安全跨域登录方法,应用于第二应用服务器,包括:接收第一应用服务器发送的请求报文,请求报文包含与第一应用服务器通信连接的第一应用客户端对应的用户身份信息;基于请求报文生成临时信任令牌,并通过第一应用服务器发送至第一应用客户端,以使第一应用客户端向第二应用服务器提供的目标网页页面发送跳转请求,跳转请求至少携带临时信任令牌;对跳转请求携带的临时信任令牌进行验证,并在验证通过后对第一应用客户端进行登录授信。In a third aspect, a secure cross-domain login method is provided, which is applied to a second application server, including: receiving a request message sent by the first application server, the request message including the first application client communicating with the first application server Corresponding user identity information; generate a temporary trust token based on the request message, and send it to the first application client through the first application server, so that the first application client sends a jump to the target web page provided by the second application server request, and the redirection request carries at least a temporary trust token; verify the temporary trust token carried in the redirection request, and perform login authorization for the first application client after the verification is passed.
在一些实施方式中,请求报文包括以下中的一项或多项:第一应用服务器的身份标识、第一应用客户端对应的设备地址信息和用户身份信息。In some implementations, the request message includes one or more of the following: the identity of the first application server, device address information corresponding to the first application client, and user identity information.
在一些实施方式中,方法还包括:根据第一应用服务器的身份标识查找预先配置的服务器白名单,以进行服务器身份校验;其中,若服务器身份校验不通过,则拒绝生成临时信任令牌,并向第一应用服务器返回第一报错信息。In some implementations, the method further includes: searching a pre-configured server whitelist according to the identity of the first application server to perform server identity verification; wherein, if the server identity verification fails, refusing to generate a temporary trust token , and return the first error message to the first application server.
在一些实施方式中,方法还包括:根据预设报文规范对请求报文进行报文校验;其中,若报文校验不通过,则拒绝生成临时信任令牌,并向第一应用服务器返回第二报错信息。In some implementations, the method further includes: performing message verification on the request message according to the preset message specification; wherein, if the message verification fails, refusing to generate a temporary trust token, and sending the request to the first application server Return the second error message.
在一些实施方式中,预设报文规范指示请求报文包括至少一个报文必填域,以及,根据预设报文规范对请求报文进行报文校验,包括:判断请求报文中的报文必填域是否非空和/或是否按预设格式填写。In some implementations, the preset message specification indicates that the request message includes at least one message mandatory field, and performing message verification on the request message according to the preset message specification includes: judging the Whether the mandatory field of the message is not empty and/or whether it is filled in according to the preset format.
在一些实施方式中,请求报文携带根据第一私钥生成的第一加密签名,方法还包括:预先获取第一应用服务器提供的第一公钥,其中第一公钥和第一私钥是第一应用服务器基于加密算法生成的密钥对;根据第一公钥对接收的请求报文中的第一加密签名进行签名验证;其中,若签名验证不通过,则拒绝生成临时信任令牌,并向第一应用服务器返回第三报错信息。In some implementations, the request message carries the first encrypted signature generated according to the first private key, and the method further includes: obtaining in advance the first public key provided by the first application server, where the first public key and the first private key are The first application server generates a key pair based on an encryption algorithm; performs signature verification on the first encrypted signature in the received request message according to the first public key; wherein, if the signature verification fails, then refuses to generate a temporary trust token, And return the third error message to the first application server.
在一些实施方式中,请求报文还包括对用户身份信息的一项或多项进行敏感信息加密后获得的敏感身份信息段,方法还包括:预先获取第一应用服务器提供的敏感信息密钥,并根据敏感信息密钥对请求报文中的敏感身份信息段进行敏感解密,以获得用户身份信息的明文信息;其中,若未成功实现敏感解密,则拒绝生成临时信任令牌,并向第一应用服务器返回第四报错信息。In some embodiments, the request message further includes a sensitive identity information segment obtained by encrypting sensitive information on one or more pieces of user identity information, and the method further includes: obtaining in advance the sensitive information key provided by the first application server, And according to the sensitive information key, sensitively decrypt the sensitive identity information segment in the request message to obtain the plaintext information of the user identity information; if the sensitive decryption is not successfully realized, then refuse to generate a temporary trust token, and submit to the first The application server returns the fourth error message.
在一些实施方式中,基于请求报文生成临时信任令牌,还包括:根据请求报文中包含的用户身份信息生成全局唯一的临时信任令牌;将临时信任令牌和对应的用户身份信息以键值对形式缓存至内存数据库,并为临时信任令牌设置预定有效期限,其中,在预定有效期限到达之后将临时信任令牌对应的键值对从内存数据库删除。In some implementations, generating a temporary trust token based on the request message further includes: generating a globally unique temporary trust token according to the user identity information contained in the request message; combining the temporary trust token and the corresponding user identity information with The key-value pair is cached in the memory database, and a predetermined validity period is set for the temporary trust token, wherein, after the predetermined validity period is reached, the key-value pair corresponding to the temporary trust token is deleted from the memory database.
在一些实施方式中,根据用户身份信息生成全局唯一的临时信任令牌,还包括:利用SnowFlake算法生成临时信任令牌。In some implementation manners, generating a globally unique temporary trust token according to user identity information further includes: generating the temporary trust token by using a SnowFlake algorithm.
在一些实施方式中,基于请求报文生成临时信任令牌之后,方法还包括:根据请求报文中包含的用户身份信息进行用户注册或用户绑定。In some embodiments, after the temporary trust token is generated based on the request message, the method further includes: performing user registration or user binding according to the user identity information contained in the request message.
在一些实施方式中,基于请求报文生成临时信任令牌之后,方法还包括:基于加密算法预先生成第二密钥,包括第二公钥和第二私钥;根据临时信任令牌生成应答报文,并根据第二私钥对应答报文进行签名,并将签名后的应答报文发送给第一应用服务器,以使第一应用服务器基于第二应用服务器提供的第二公钥对接收的应答报文进行签名解密。In some implementations, after the temporary trust token is generated based on the request message, the method further includes: pre-generating a second key based on an encryption algorithm, including a second public key and a second private key; generating a response message based on the temporary trust token The response message is signed according to the second private key, and the signed response message is sent to the first application server, so that the first application server pairs the received information based on the second public key provided by the second application server. The response message is signed and decrypted.
在一些实施方式中,对跳转请求携带的临时信任令牌进行验证,包括:若验证确定跳转请求中包含临时信任令牌,且在内存数据库中包含对应于临时信任令牌的值,则对第一应用客户端进行登录授信;否则,拒绝对第一应用客户端进行登录授信。In some implementations, verifying the temporary trust token carried in the redirect request includes: if the verification determines that the redirect request contains the temporary trust token and contains a value corresponding to the temporary trust token in the memory database, then Perform login authorization for the first application client; otherwise, refuse to perform login authorization for the first application client.
在一些实施方式中,对跳转请求携带的临时信任令牌进行验证,还包括:获取跳转请求包含的源域名,根据源域名查找预设域名白名单,以对跳转请求以进行源域名校验;若源域名校验不通过,拒绝对第一应用客户端进行登录授信。In some embodiments, verifying the temporary trust token carried in the redirection request further includes: obtaining the source domain name included in the redirection request, and searching the preset domain name whitelist according to the source domain name, so as to verify the source domain name in the redirection request. verification; if the verification of the source domain name fails, the login credit authorization for the first application client is refused.
在一些实施方式中,对第一应用客户端进行登录授信之后,方法还包括:提取内存数据库中对应于临时信任令牌的用户身份信息;根据用户身份信息获取对应的历史交易信息;以及,基于预设权益规则、历史交易信息和用户身份信息为第一应用客户端提供对应的权益信息。In some implementations, after performing login authorization on the first application client, the method further includes: extracting user identity information corresponding to the temporary trust token in the memory database; obtaining corresponding historical transaction information according to the user identity information; and, based on The preset equity rules, historical transaction information and user identity information provide corresponding equity information for the first application client.
第四方面,提供一种安全跨域登录系统,包括:用户终端、第一应用服务器以及第二应用服务器;其中,用户终端搭载有第一应用客户端,第一应用客户端用于向第一应用服务器发送用于请求登录第二应用服务器提供的目标网页页面的登录请求,还用于在接收到临时信任令牌之后,向第二应用服务器提供的目标网页页面发送跳转请求,跳转请求至少携带临时信任令牌;第一应用服务器用于执行如第二方面的方法;第二应用服务器用于执行如第三方面的方法;用户终端还用于显示第二应用服务器提供的目标网页页面。In a fourth aspect, a secure cross-domain login system is provided, including: a user terminal, a first application server, and a second application server; wherein, the user terminal is equipped with a first application client, and the first application client is used to log in to the first application server. The application server sends a login request for requesting to log in to the target web page provided by the second application server, and is also used to send a jump request to the target web page provided by the second application server after receiving the temporary trust token, and the jump request Carry at least a temporary trust token; the first application server is used to execute the method as in the second aspect; the second application server is used to execute the method as in the third aspect; the user terminal is also used to display the target web page provided by the second application server .
第五方面,提供第一应用服务器,用于执行如第二方面的方法。In a fifth aspect, a first application server is provided, configured to execute the method as in the second aspect.
第六方面,提供第二应用服务器,用于执行如第三方面的方法。In a sixth aspect, a second application server is provided for executing the method in the third aspect.
本申请实施例采用的上述至少一个技术方案能够达到以下有益效果:本实施例中,无须用户二次登录即可实现无感跨域登录,为用户提供更好的互联网体验,并且基于临时信任令牌保护跳转链接,安全性能更高。The above-mentioned at least one technical solution adopted in the embodiment of the present application can achieve the following beneficial effects: In this embodiment, the non-inductive cross-domain login can be realized without the user's second login, providing users with a better Internet experience, and based on the temporary trust token The card protects the jump link, which has higher security performance.
应当理解,上述说明仅是本发明技术方案的概述,以便能够更清楚地了解本发明的技术手段,从而可依照说明书的内容予以实施。为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举例说明本发明的具体实施方式。It should be understood that the above description is only an overview of the technical solution of the present invention, so as to understand the technical means of the present invention more clearly, and thus implement it according to the contents of the description. In order to make the above and other objects, features and advantages of the present invention more comprehensible, specific embodiments of the present invention are illustrated below.
附图说明Description of drawings
通过阅读下文的示例性实施例的详细描述,本领域普通技术人员将明白本文所述的优点和益处以及其他优点和益处。附图仅用于示出示例性实施例的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的标号表示相同的部件。在附图中:The advantages and benefits described herein, as well as other advantages and benefits, will be apparent to those of ordinary skill in the art upon reading the following detailed description of the exemplary embodiments. The drawings are only for the purpose of illustrating exemplary embodiments and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to denote the same parts. In the attached picture:
图1为根据本发明一实施例的安全跨域登录方法的流程示意图;FIG. 1 is a schematic flow diagram of a secure cross-domain login method according to an embodiment of the present invention;
图2为根据本发明另一实施例的安全跨域登录方法的流程示意图;FIG. 2 is a schematic flow diagram of a secure cross-domain login method according to another embodiment of the present invention;
图3为根据本发明又一实施例的安全跨域登录方法的流程示意图;FIG. 3 is a schematic flowchart of a secure cross-domain login method according to yet another embodiment of the present invention;
图4为根据本发明又一实施例的安全跨域登录方法的流程示意图;4 is a schematic flowchart of a secure cross-domain login method according to yet another embodiment of the present invention;
图5为根据本发明一实施例的安全跨域登录系统的结构示意图。FIG. 5 is a schematic structural diagram of a secure cross-domain login system according to an embodiment of the present invention.
在附图中,相同或对应的标号表示相同或对应的部分。In the drawings, the same or corresponding reference numerals denote the same or corresponding parts.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
在本发明中,应理解,诸如“包括”或“具有”等术语旨在指示本说明书中所公开的特征、数字、步骤、行为、部件、部分或其组合的存在,并且不旨在排除一个或多个其他特征、数字、步骤、行为、部件、部分或其组合存在的可能性。In the present invention, it should be understood that terms such as "comprising" or "having" are intended to indicate the presence of features, numbers, steps, acts, components, parts or combinations thereof disclosed in the specification, and are not intended to exclude one or multiple other features, numbers, steps, acts, parts, parts or combinations thereof.
另外还需要说明的是,在不冲突的情况下,本发明中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本发明。In addition, it should be noted that, in the case of no conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and examples.
本发明实施例提供一种安全跨域登录方法,下面,首先对所述方法的发明构思进行介绍。An embodiment of the present invention provides a secure cross-domain login method. In the following, the inventive concept of the method is firstly introduced.
用户除了可以通过在系统A上注册的账号和密码登录到系统A上,也可以通过在系统A上注册的账号和密码登录到信任系统A的系统B上,这种登录方式被称之为信任登录。系统A上的用户信任登录到系统B上后,系统A的用户可可以对系统B提供的相应业务进行访问及操作。比如,系统A可以是购物应用系统,系统B可以是支付应用系统,当用户使用购物应用时,经常需要跳转登录到支付应用系统进行支付操作,本发明实施例提供一种安全跨域登录方法,例如,用户在购物应用的客户端(也即第一应用客户端)的界面点击“支付”按钮,从而向购物应用的服务器(也即第一应用服务器)发送用于请求登录支付应用的服务器(也即第二应用服务器)提供的支付H5页面(也即目标网页页面)的登录请求。购物应用的服务器根据该登录请求获取该用户的用户身份信息,比如用户的手机号、银行卡号、身份证号码等,进而根据该用户身份信息生成请求报文并发送至该支付应用的服务器。然后支付应用的服务器基于请求报文中的手机号、银行卡号、身份证号码等用户身份信息生成全局唯一的临时信任令牌并通过购物应用的服务器发送至购物应用的客户端,该临时信任令牌在一段时间后失效,进而该购物应用的客户端能够在令牌的有效期限内携带临时信任令牌向支付应用的服务器提供的支付H5页面发送跳转请求,此时支付应用的服务器对该跳转请求携带的临时信任令牌进行验证,并在验证通过后对购物应用的客户端进行登录授信,该用户得以安全跳转登录至该支付H5页面进行支付。无须用户二次登录即可实现无感跨站访问,给用户提供更好的互联网体验。后台服务器生成具有有效期限的临时信任令牌以保护跳转链接,安全性能更高。In addition to logging in to system A through the account and password registered on system A, users can also log in to system B that trusts system A through the account and password registered on system A. This login method is called trust Log in. After the user on system A trusts to log in to system B, the user of system A can access and operate the corresponding services provided by system B. For example, system A can be a shopping application system, and system B can be a payment application system. When users use shopping applications, they often need to jump to log in to the payment application system for payment operations. Embodiments of the present invention provide a secure cross-domain login method For example, the user clicks the "Payment" button on the interface of the client of the shopping application (ie, the first application client), thereby sending a server request for logging in to the payment application to the server of the shopping application (ie, the first application server). (that is, the second application server) provides a login request for the payment H5 page (that is, the target web page). The server of the shopping application obtains the user's user identity information according to the login request, such as the user's mobile phone number, bank card number, ID number, etc., and then generates a request message according to the user's identity information and sends it to the payment application server. Then the server of the payment application generates a globally unique temporary trust token based on the user identity information such as the mobile phone number, bank card number, and ID number in the request message, and sends it to the client of the shopping application through the server of the shopping application. The card expires after a period of time, and then the client of the shopping application can send a jump request to the payment H5 page provided by the payment application server with the temporary trust token within the validity period of the token. The temporary trust token carried in the jump request is verified, and after the verification is passed, the client of the shopping application is granted login credit, and the user can safely jump and log in to the payment H5 page to make payment. No sense of cross-site access can be realized without the need for users to log in again, providing users with a better Internet experience. The background server generates a temporary trust token with a valid period to protect the jump link, which has higher security performance.
本领域技术人员可以理解,所描述的应用场景仅是本发明的实施方式可以在其中得以实现的一个示例。本发明实施方式的适用范围不受任何限制。在介绍了本发明的基本原理之后,下面具体介绍本发明的各种非限制性实施方式。Those skilled in the art may understand that the described application scenario is only an example in which the embodiments of the present invention may be implemented. The scope of application of the embodiments of the present invention is not limited in any way. After introducing the basic principles of the present invention, various non-limiting embodiments of the present invention are described in detail below.
图1为根据本申请一实施例的安全跨域登录方法100的流程示意图,在该流程中,从设备角度而言,执行主体可以是一个或者多个电子设备;从程序角度而言,执行主体相应地可以是搭载于这些电子设备上的程序。Fig. 1 is a schematic flow diagram of a secure cross-domain login method 100 according to an embodiment of the present application. In this flow, from the perspective of equipment, the execution subject may be one or more electronic devices; from the perspective of program, the execution subject Correspondingly, it may be a program carried on these electronic devices.
如图1所示,该方法100可以包括:As shown in Figure 1, the method 100 may include:
步骤101、第一应用服务器接收对应第一应用客户端发送的登录请求;Step 101, the first application server receives a login request sent by the corresponding first application client;
其中,该登录请求可以包括第一应用客户端的设备地址信息、也可以包括该第一应用客户端对应的用户身份信息,如用户名等信息。该登录请求用于请求登录第二应用服务器提供的目标网页页面。Wherein, the login request may include device address information of the first application client, and may also include user identity information corresponding to the first application client, such as user name and other information. The login request is used to request to log in to the target web page provided by the second application server.
比如,第一应用服务器可以是购物应用的后台服务器,第一应用客户端可以是购物应用的客户端,第二应用服务器可以是支付应用的服务器,目标网页页面可以是支付平台提供的支付H5页面,该H5页面可以用于执行该购物应用的支付任务。用户可以在购物应用的第一应用客户端界面点击诸如“支付”之类的按钮,从而触发由第一应用客户端向第一应用服务器发起的登录请求,该登录请求用于请求登录第二应用服务器提供的目标网页页面。For example, the first application server can be the background server of the shopping application, the first application client can be the client of the shopping application, the second application server can be the server of the payment application, and the target web page can be the payment H5 page provided by the payment platform , the H5 page can be used to execute the payment task of the shopping application. The user can click a button such as "pay" on the first application client interface of the shopping application, thereby triggering a login request initiated by the first application client to the first application server, and the login request is used to request to log in to the second application The landing page page served by the server.
在具体实现中,用户可以从任何一种终端设备访问第一应用服务器,例如手机、智能穿戴设备、笔记本电脑、平板电脑、电脑等等。只要这些终端设备上运行通过互联网访问网页的浏览器或内置微型浏览器的第一应用客户端。In a specific implementation, the user can access the first application server from any terminal device, such as a mobile phone, a smart wearable device, a notebook computer, a tablet computer, a computer, and the like. As long as these terminal devices run the first application client that accesses web pages through the Internet or the first application client with a built-in micro-browser.
步骤102、第一应用服务器根据登录请求获取对应于第一应用客户端的用户身份信息,根据用户身份信息生成请求报文。Step 102, the first application server obtains user identity information corresponding to the first application client according to the login request, and generates a request message according to the user identity information.
其中,用户可以根据用户身份信息预先在第一应用服务器注册,并基于注册信息在该第一应用服务器对应的第一应用客户端登陆,此时,用户仅需触发第一应用客户端界面的指定按钮即可向第一应用服务器发送登录请求,之后第一应用服务器可以获取该第一应用客户端对应用户在注册时提供的用户身份信息。另一种情况下,用户也可以直接在第一应用客户端界面输入该用户身份信息,并向第一应用服务器发送的登录请求中携带该用户身份信息。Wherein, the user can register in the first application server in advance according to the user identity information, and log in the first application client corresponding to the first application server based on the registration information. At this time, the user only needs to trigger the designation of the first application client interface. button to send a login request to the first application server, and then the first application server can obtain the user identity information provided by the corresponding user of the first application client during registration. In another case, the user may also directly input the user identity information on the first application client interface, and carry the user identity information in the login request sent to the first application server.
其中,用户身份信息可以包括手机号码、银行卡号、身份证号、设备地址信息、生物识别信息(指纹信息、人脸照片等)中的一种或多种。Wherein, the user identity information may include one or more of mobile phone number, bank card number, ID card number, device address information, and biometric information (fingerprint information, face photo, etc.).
在一些实施方式中,登录请求可以包含第一应用客户端的设备地址信息,步骤102中的第一应用服务器根据登录请求获取对应于第一应用客户端的用户身份信息,还可以包括:第一应用服务器根据第一应用客户端的设备地址信息进行本地查询,以获得对应于第一应用客户端的用户身份信息。换言之,用户可以根据用户身份信息预先注册于第一应用服务器,第一应用服务器在接收到登录请求之后,可以根据登录请求中的设备地址信息在本地进行查找,从而获取该第一应用客户端对应用户在注册时提供的用户身份信息。由此可以通过一个触发动作而发出该登录请求,避免了重复的信息录入动作。In some implementations, the login request may include the device address information of the first application client, and the first application server in step 102 obtains the user identity information corresponding to the first application client according to the login request, and may also include: the first application server A local query is performed according to the device address information of the first application client to obtain user identity information corresponding to the first application client. In other words, the user can pre-register with the first application server according to the user identity information, and after the first application server receives the login request, it can search locally according to the device address information in the login request, so as to obtain the corresponding information of the first application client. User identity information provided by the user during registration. In this way, the login request can be issued through a trigger action, avoiding repeated information input actions.
在一些实施方式中,步骤102中的第一应用服务器根据用户身份信息生成请求报文,还包括:第一应用服务器基于预设报文规范生成请求报文。由于在实际应用中,第二应用服务器中接收的请求报文可能数据量相对较大,因此可以预先要求第一应用服务器按照统一的预设报文规范生成该请求报文,从而便于第二应用服务器后续使用该请求报文。In some implementations, the first application server in step 102 generates the request message according to the user identity information, and further includes: the first application server generates the request message based on a preset message specification. In practical applications, the request message received by the second application server may have a relatively large amount of data, so the first application server may be required in advance to generate the request message according to a unified preset message specification, thereby facilitating the second application server to generate the request message. The server subsequently uses the request message.
其中,请求报文可以包括以下中的一项或多项信息:第一应用服务器的身份标识、第一应用客户端对应的设备地址信息和用户身份信息。举例来说,其中一种预设报文规范可以要求请求报文包括:时间戳字段、第一应用服务器的身份标识字段、第一应用客户端的设备地址信息字段、手机号码字段、身份证字段、银行卡号字段。其中,时间戳字段可以是请求报文的生成时间和/或发出时间。又比如,预设报文规范可以要求其中的某些字段可以是报文必填域、其他一些字段可以是非报文必填域。可以依据实际应用场景设置预设报文规范,不同应用场景所对应的报文规范可能不同。Wherein, the request message may include one or more of the following information: the identity of the first application server, the device address information corresponding to the first application client, and user identity information. For example, one of the preset message specifications may require that the request message include: a timestamp field, an identity field of the first application server, a device address information field of the first application client, a mobile phone number field, an ID card field, Bank card number field. Wherein, the timestamp field may be the generation time and/or sending time of the request message. For another example, the preset message specification may require that some of the fields may be mandatory fields for the message, and some other fields may be non-mandatory fields for the message. Preset message specifications can be set according to actual application scenarios, and message specifications corresponding to different application scenarios may be different.
步骤103、第一应用服务器将请求报文发送至第二应用服务器。Step 103, the first application server sends the request packet to the second application server.
在一些实施方式中,若任意一个服务器均可以向第二应用服务器发送请求报文,则第二应用服务器根据接收到的大量的请求报文执行生成临时信任令牌时则可能产生过载。因此,可以在第二应用服务器处预先配置服务器白名单,进而根据该服务器白名单进行服务器身份校验,进而预先对收到的请求报文进行筛选。In some implementations, if any server can send a request message to the second application server, then the second application server may be overloaded when generating a temporary trust token based on a large number of received request messages. Therefore, the server whitelist can be pre-configured at the second application server, and then the server identity verification is performed according to the server whitelist, and then the received request message is screened in advance.
例如,参见图2,在步骤104之前,还可以执行:For example, referring to FIG. 2, before step 104, it is also possible to execute:
步骤21、第二应用服务器获取第一应用服务器的身份标识,根据第一应用服务器10的身份标识查找预先配置的服务器白名单,以进行服务器身份校验。Step 21, the second application server obtains the identity of the first application server, and searches the pre-configured server whitelist according to the identity of the first application server 10 to perform server identity verification.
其中,若服务器身份校验不通过,则第二应用服务器拒绝生成临时信任令牌,并可以向第一应用服务器返回第一报错信息。相反,若服务器身份校验通过,则第二应用服务器可以继续基于请求报文执行后续的其他验证步骤,或者可以生成临时信任令牌。Wherein, if the server identity verification fails, the second application server refuses to generate the temporary trust token, and may return the first error message to the first application server. On the contrary, if the server identity verification passes, the second application server may continue to perform other subsequent verification steps based on the request message, or may generate a temporary trust token.
一种情况下,第一应用服务器可以预先将服务器标识发送给第二应用服务器以进行上述服务器身份校验,并在上述服务器身份校验通过之后再建立第一应用服务器和第二应用服务器之间的通信连接,第一应用服务器才能够基于该通信连接向第二应用服务器发送请求报文,可以理解,这种情况下的步骤21在步骤103之前执行。另一种情况下,第一应用服务器向第二应用服务器发送的请求报文的请求头中可以同样包含该第一应用服务器的身份标识,进而也可以在第二应用服务器接收到该请求报文之后,再根据请求报文中包含的第一应用服务器的身份标识进行服务器身份校验,可以理解,这种情况下的步骤21在步骤103之后执行。In one case, the first application server may send the server identification to the second application server in advance to perform the above server identity verification, and establish a connection between the first application server and the second application server after the above server identity verification is passed. Only through the communication connection, the first application server can send the request message to the second application server based on the communication connection. It can be understood that step 21 in this case is executed before step 103 . In another case, the request header of the request message sent by the first application server to the second application server may also contain the identity of the first application server, and then the request message may also be received by the second application server Afterwards, server identity verification is performed according to the identity of the first application server contained in the request message. It can be understood that step 21 in this case is executed after step 103 .
在一些实施方式中,由于第一应用服务器是按照预设报文规范设置的请求报文,因此可以预先以预设报文规范进行报文校验,进而将不符合预设报文规范的请求报文过滤掉。In some embodiments, since the first application server is a request message set according to the preset message specification, the message verification can be performed in advance with the preset message specification, and then the request that does not meet the preset message specification Packets are filtered out.
例如,参见图2,在步骤103之后,还可以执行:For example, referring to Fig. 2, after step 103, it is also possible to execute:
步骤22、第二应用服务器根据预设报文规范对请求报文进行报文校验。Step 22, the second application server performs message verification on the request message according to the preset message specification.
其中,若报文校验通过,则第二应用服务器可以继续执行后续的其他验证步骤,或者可以生成临时信任令牌。相反,若报文校验不通过,则第二应用服务器拒绝生成临时信任令牌,并向第一应用服务器返回第二报错信息。Wherein, if the message verification passes, the second application server may continue to perform other subsequent verification steps, or may generate a temporary trust token. On the contrary, if the message verification fails, the second application server refuses to generate the temporary trust token, and returns a second error message to the first application server.
在一些实施方式中,预设报文规范可以指示请求报文包括至少一个报文必填域,基于此,步骤22可以具体包括:第二应用服务器判断请求报文中的报文必填域是否非空和/或是否按预设格式填写。比如,在上文中给出一种预设报文规范,其要求请求报文包括:时间戳字段、第一应用服务器的身份标识字段、第一应用客户端的设备地址信息字段、手机号码字段、身份证字段和银行卡号字段。其中,预设报文规范可以要求其中的某些字段可以是报文必填域,比如时间戳字段和银行卡号字段,此时,若第二应用服务器接收到的请求报文中不包含这些字段则可以认为该报文校验未通过。In some implementations, the preset message specification may indicate that the request message includes at least one message mandatory field. Based on this, step 22 may specifically include: the second application server judging whether the message mandatory field in the request message is Is not empty and/or is filled in according to the preset format. For example, a preset message specification is given above, which requires that the request message include: a timestamp field, an identity field of the first application server, a device address information field of the first application client, a mobile phone number field, an identity Certificate field and bank card number field. Among them, the preset message specification may require that some of the fields may be mandatory fields of the message, such as the timestamp field and the bank card number field. At this time, if the request message received by the second application server does not contain these fields Then it can be considered that the message verification fails.
在一些实施方式中,由于在从第一应用服务器到第二应用服务器的传输过程中,请求报文可能被篡改,因此可以采用签名的加密传输方式传输该请求报文。具体而言,第一应用服务器可以预先基于加密算法生成第一密钥对,包括第一公钥和第一私钥。进一步地,第一应用服务器预先向第二应用服务器提供该第一公钥,且在第一应用服务器在生成该请求报文之后,可以根据第一私钥对请求报文进行签名,并将签名后的请求报文发送给所述第二应用服务器从而实现加密传输,第二应用服务器接收到该签名后的请求报文之后可以基于该第一公钥进行签名验证。In some implementation manners, since the request message may be tampered with during transmission from the first application server to the second application server, the request message may be transmitted in a signed encrypted transmission manner. Specifically, the first application server may generate a first key pair in advance based on an encryption algorithm, including a first public key and a first private key. Further, the first application server provides the first public key to the second application server in advance, and after the first application server generates the request message, it can sign the request message according to the first private key, and the signed The signed request message is sent to the second application server to implement encrypted transmission, and the second application server may perform signature verification based on the first public key after receiving the signed request message.
例如,参见图2,在步骤103之后,还可以执行:For example, referring to Fig. 2, after step 103, it is also possible to execute:
步骤23、第二应用服务器根据第一应用服务器预先提供的第一公钥对接收的请求报文进行签名验证。Step 23: The second application server performs signature verification on the received request message according to the first public key pre-provided by the first application server.
其中,若签名验证通过,则第二应用服务器可以继续生成临时信任令牌,或者可以继续执行后续其他的验证步骤。相反,若签名验证不通过,则可以认为该请求报文在传输过程中已经被篡改,因此第二应用服务器可以拒绝生成临时信任令牌,并在这种情况下可以向第一应用服务器返回第三报错信息,以提醒用户和系统存在报文篡改风险。Wherein, if the signature verification passes, the second application server may continue to generate the temporary trust token, or may continue to perform other subsequent verification steps. On the contrary, if the signature verification fails, it can be considered that the request message has been tampered with during transmission, so the second application server can refuse to generate a temporary trust token, and in this case can return the first application server to the first application server. 3. Report an error message to remind users and the system that there is a risk of message tampering.
可以理解,签名是指发送方使用私钥对需要传输的文本的摘要进行加密后得到的密文。签名验证是指接收方在接收到传输文本之后拿持有的公钥对签名进行解密(密钥对中的一种密钥加密的数据必定能使用另一种密钥解密),进而获得文本摘要,然后使用与发送方同样的哈希算法计算摘要值,再与解密得到的摘要进行对比,如发现二者完全一致,则说明文本没有被篡改过。如发现二者不一致,则说明文本存在被篡改的风险。It can be understood that the signature refers to the ciphertext obtained after the sender uses the private key to encrypt the digest of the text to be transmitted. Signature verification means that the recipient decrypts the signature with the public key it holds after receiving the transmitted text (the data encrypted by one key in the key pair must be decrypted by another key), and then obtain the text digest , and then use the same hash algorithm as the sender to calculate the digest value, and then compare it with the decrypted digest. If the two are found to be exactly the same, it means that the text has not been tampered with. If the two are found to be inconsistent, it means that the text is at risk of being tampered with.
可选地,该加密算法可以是对称加密算法或者非对称加密算法,本申请对此不作具体限制。此外,为了追求更高的安全性可以使用加密机保存算法的密钥。Optionally, the encryption algorithm may be a symmetric encryption algorithm or an asymmetric encryption algorithm, which is not specifically limited in this application. In addition, in order to pursue higher security, an encryption machine can be used to save the key of the algorithm.
在一些实施方式中,用户身份信息中可能包含用户的电话号码、银行卡号、身份证号码等安全要求较高的敏感信息,在传输过程中如采用明文传输的方式则可能会造成用户隐私信息泄露,因此上述方法还可包括:第一应用服务器对用户身份信息的一项或多项进行敏感信息加密,以获得敏感身份信息段。基于此,请求报文还包括敏感身份信息段,第二应用服务器可以预先获取第一应用服务器提供的敏感信息密钥,并在接收到该请求报文之后对该敏感身份信息端进行敏感解密。In some implementations, the user identity information may contain sensitive information with high security requirements such as the user's phone number, bank card number, and ID card number. If the transmission process is carried out in plain text, the user's private information may be leaked. , therefore, the above method may further include: the first application server encrypts sensitive information on one or more pieces of user identity information to obtain sensitive identity information segments. Based on this, the request message also includes the sensitive identity information segment, and the second application server can obtain the sensitive information key provided by the first application server in advance, and perform sensitive decryption on the sensitive identity information end after receiving the request message.
例如,参见图2,在步骤103之后,还可以执行:For example, referring to Fig. 2, after step 103, it is also possible to execute:
步骤24、第二应用服务器根据敏感信息密钥对请求报文中的敏感身份信息段进行敏感解密。Step 24, the second application server performs sensitive decryption on the sensitive identity information segment in the request message according to the sensitive information key.
其中,若成功实现敏感解密,也即获得用户身份信息的明文信息,则可以继续跟进该用户身份信息的明文信息生成临时信任令牌。相反,若未成功实现敏感解密,则第二应用服务器拒绝生成临时信任令牌,并向第一应用服务器返回第四报错信息。Among them, if the sensitive decryption is successfully implemented, that is, the plaintext information of the user identity information is obtained, then the plaintext information of the user identity information can be followed up to generate a temporary trust token. On the contrary, if the sensitive decryption is not successfully implemented, the second application server refuses to generate the temporary trust token, and returns a fourth error message to the first application server.
本公开的实施方式中,在第二应用服务器生成临时信任令牌之前,可以执行步骤21、步骤22、步骤23和步骤24中的任一个或多个,也可以不执行上述各个步骤。此外,可以按照任何的执行顺序执行上述步骤21、步骤22、步骤23和步骤24,图2所示出的执行顺序仅是一种示例,本申请对此不作具体限制。In the embodiments of the present disclosure, before the second application server generates the temporary trust token, any one or more of steps 21, 22, 23 and 24 may be performed, or the above steps may not be performed. In addition, the above step 21, step 22, step 23 and step 24 may be performed in any execution sequence, and the execution sequence shown in FIG. 2 is only an example, and the present application does not make specific limitations on this.
步骤104、第二应用服务器基于请求报文生成临时信任令牌。Step 104, the second application server generates a temporary trust token based on the request message.
在一些实施方式中,步骤104还可以进一步包括:第二应用服务器根据请求报文中包含的用户身份信息生成全局唯一的临时信任令牌;第二应用服务器将临时信任令牌和对应的用户身份信息以键值对形式缓存至内存数据库,并为临时信任令牌设置预定有效期限。比如可以设置临时信任令牌的预定有效时间为5-10秒,在预定有效期限到达之后将临时信任令牌对应的键值对从内存数据库删除。In some implementations, step 104 may further include: the second application server generates a globally unique temporary trust token according to the user identity information contained in the request message; the second application server uses the temporary trust token and the corresponding user identity Information is cached to an in-memory database as key-value pairs, with a predetermined expiration date set for temporary trust tokens. For example, the predetermined valid time of the temporary trust token can be set to 5-10 seconds, and the key-value pair corresponding to the temporary trust token is deleted from the memory database after the predetermined valid period is reached.
可选地,在第二应用服务器生成全局唯一的临时信任令牌的过程中,若产生系统错误,导致未能成功生成临时信任令牌,则第二应用服务器拒绝向第一应用服务器发送该临时信任令牌,并向第一应用服务器发送第五报错信息。Optionally, in the process of generating the globally unique temporary trust token by the second application server, if a system error occurs and the temporary trust token cannot be successfully generated, the second application server refuses to send the temporary trust token to the first application server. Trust the token, and send the fifth error message to the first application server.
可选地,在第二应用服务器将临时信任令牌和对应的用户身份信息以键值对形式缓存至内存数据库的过程中,若产生设备错误,导致未能成功缓存,则第二应用服务器拒绝向第一应用服务器发送该临时信任令牌,并向第一应用服务器发送第六报错信息。Optionally, during the process of the second application server caching the temporary trust token and corresponding user identity information into the memory database in the form of key-value pairs, if a device error occurs, resulting in failure to cache successfully, the second application server rejects Send the temporary trust token to the first application server, and send the sixth error message to the first application server.
在一些实施方式中,第二应用服务器根据用户身份信息生成全局唯一的临时信任令牌,还可以包括:第二应用服务器利用SnowFlake算法生成临时信任令牌。SnowFlake算法主要包含时间序列、机器标识、计数顺序号三部分。可选地,在并发程度不高的系统中也可以使用uuid(通用唯一识别码Universally Unique Identifier)替代该临时信任令牌,简单快速生成序列号。In some implementations, the second application server generates a globally unique temporary trust token according to the user identity information, and may further include: the second application server generates the temporary trust token by using a SnowFlake algorithm. The SnowFlake algorithm mainly includes three parts: time series, machine identification, and counting sequence number. Optionally, a uuid (Universally Unique Identifier) can also be used in a system with a low degree of concurrency instead of the temporary trust token to generate a serial number simply and quickly.
在一些实施方式中,在步骤104之后,还可以包括:第二应用服务器根据请求报文中包含的用户身份信息进行用户注册或用户绑定。其中,当第二应用服务器根据用户身份信息进行新用户注册时,第二应用服务器需要通过第一应用服务器向第一应用客户端发送注册请求,并在获得用户的许可之后进行该用户注册。In some implementations, after step 104, it may further include: the second application server performs user registration or user binding according to the user identity information contained in the request message. Wherein, when the second application server registers a new user according to the user identity information, the second application server needs to send a registration request to the first application client through the first application server, and perform the user registration after obtaining the user's permission.
可选地,在上述用户注册的过程中,若未能获得用户许可,则第二应用服务器可以拒绝向第一应用服务器发送该临时信任令牌,并向第一应用服务器发送第七报错信息。Optionally, during the above user registration process, if the user's permission is not obtained, the second application server may refuse to send the temporary trust token to the first application server, and send a seventh error message to the first application server.
步骤105、第二应用服务器将临时信任令牌发送给第一应用服务器。Step 105, the second application server sends the temporary trust token to the first application server.
在一些实施方式中,步骤105还可以具体包括:第二应用服务器根据临时信任令牌生成应答报文并发送给第一应用服务器,应答报文携带第二应用服务器根据第二私钥生成的第二加密签名;第一应用服务器预先获取第二应用服务器提供的第二公钥,并根据第二公钥对接收的应答报文中的第二加密签名进行签名解密;其中,第二公钥和第二私钥是第二应用服务器基于加密算法预先生成的密钥对。In some implementations, step 105 may also specifically include: the second application server generates a response message according to the temporary trust token and sends it to the first application server, and the response message carries the second private key generated by the second application server according to the second private key. Two encrypted signatures; the first application server pre-acquires the second public key provided by the second application server, and performs signature decryption on the second encrypted signature in the received response message according to the second public key; wherein, the second public key and The second private key is a key pair pre-generated by the second application server based on an encryption algorithm.
具体地,在从第二应用服务器到第一应用服务器的传输过程中,应答报文同样可能被篡改,因此可以采用签名的加密传输方式传输该应答报文。具体而言,第二应用服务器可以预先基于加密算法生成第二密钥对,包括第二公钥和第二私钥。进一步地,第二应用服务器预先向第一应用服务器提供该第二公钥,且在第二应用服务器在生成该应答报文之后,可以根据第二私钥对应答报文进行签名,并将签名后的了应答报文发送给所述第一应用服务器从而实现加密传输,第一应用服务器接收到该签名后的应答报文之后可以基于该第二公钥进行签名验证。可以理解,若该签名验证不通过,则可以认为该应答报文在传输过程中已经被篡改,因此第一应用服务器可以停止向第一应用客户端传送该应答报文中包含的临时信任令牌,并在这种情况下可以发出告警信息,以提醒用户和系统存在报文篡改风险。相反,若该签名验证通过,则可以认为该应答报文没有被篡改,可以进一步执行步骤106。Specifically, during transmission from the second application server to the first application server, the response message may also be tampered with, so the response message may be transmitted in a signed encrypted transmission manner. Specifically, the second application server may generate a second key pair in advance based on an encryption algorithm, including a second public key and a second private key. Further, the second application server provides the second public key to the first application server in advance, and after the second application server generates the response message, it can sign the response message according to the second private key, and the signed After receiving the signed response message, the first application server may perform signature verification based on the second public key. It can be understood that if the signature verification fails, it can be considered that the response message has been tampered with during transmission, so the first application server can stop transmitting the temporary trust token contained in the response message to the first application client , and in this case, an alarm message can be issued to remind the user and the system that there is a risk of packet tampering. On the contrary, if the signature verification passes, it can be considered that the response message has not been tampered with, and step 106 can be further performed.
步骤106、第一应用服务器将临时信任令牌转发至第一应用客户端。Step 106, the first application server forwards the temporary trust token to the first application client.
步骤107、所述第一应用客户端向所述目标网页页面发送跳转请求,该跳转请求至少携带所述临时信任令牌请求。Step 107, the first application client sends a redirection request to the target web page, and the redirection request carries at least the temporary trust token request.
举例来说,当临时信任令牌下发至第一应用客户端之后,用户通过点击第一应用客户端界面的指定按钮,如“支付”按钮,就可以携带该临时信任令牌向该第二应用服务器提供的目标网页页面发送跳转请求,该跳转请求可以是URL请求。For example, after the temporary trust token is issued to the first application client, the user can bring the temporary trust token to the second application client by clicking the designated button on the interface of the first application client, such as the "Payment" button. The target web page provided by the application server sends a jump request, where the jump request may be a URL request.
步骤108、目标网页页面向第二应用服务器发送调用请求,以请求对该跳转请求进行验证。Step 108, the target web page sends a call request to the second application server to request verification of the jump request.
步骤109、第二应用服务器对该跳转请求携带的临时信任令牌进行验证。Step 109, the second application server verifies the temporary trust token carried in the jump request.
其中,第二应用服务器向目标网页页面提供用于对该跳转请求进行验证的调用接口。Wherein, the second application server provides a calling interface for verifying the jump request to the target web page.
在一些实施方式中,步骤109具体可以包括:若第二应用服务器验证确定跳转请求中包含临时信任令牌,且在内存数据库中包含对应于临时信任令牌的值,则对第一应用客户端进行登录授信;否则,第二应用服务器拒绝对第一应用客户端进行登录授信。In some implementations, step 109 may specifically include: if the second application server verifies that the jump request contains a temporary trust token and contains a value corresponding to the temporary trust token in the memory database, the first application client The terminal performs login authorization; otherwise, the second application server refuses to perform login authorization for the first application client.
在一些实施方式中,步骤109还可以包括:第二应用服务器获取跳转请求包含的源域名,根据源域名查找预设域名白名单,以对跳转请求以进行源域名校验;若源域名校验不通过,则第二应用服务器拒绝对第一应用客户端进行登录授信。In some implementations, step 109 may also include: the second application server obtains the source domain name included in the redirect request, searches the preset domain name whitelist according to the source domain name, and verifies the source domain name for the redirect request; if the source domain name If the verification fails, the second application server refuses to perform login authorization for the first application client.
举例来说,若该跳转请求是URL请求,第二应用服务器首先检查该URL请求中是否存在临时信任令牌,并检查URL请求中请求头以校验其中包含的源域名是否在系统配置的预设域名白名单中。其中,若该URL请求中不包含该临时信任令牌或者其请求头中包含的源域名不在系统配置的预设域名白名单中,可认为该URL请求是非法请求,第二应用服务器可拒绝对该第一应用客户端进行登录授信,并可以通过该目标网页页面告知用户。其次,若该URL请求中包含该临时信任令牌,以及其请求头中包含的源域名在系统配置的预设域名白名单中,则可根据收到临时信任令牌作为键(key)查找内存数据库redis是否存在值(value),如存在说明该临时信任令牌为第二应用服务器在预设有效期限内生成,是合法的,则可以进行登录授信。For example, if the redirection request is a URL request, the second application server first checks whether there is a temporary trust token in the URL request, and checks the request header in the URL request to check whether the source domain name contained therein is in the system configuration The default domain name whitelist. Wherein, if the URL request does not contain the temporary trust token or the source domain name contained in the request header is not in the preset domain name whitelist configured by the system, the URL request can be considered as an illegal request, and the second application server can reject the request. The first application client performs login credentialing, and can notify the user through the target web page. Secondly, if the URL request contains the temporary trust token, and the source domain name contained in the request header is in the preset domain name whitelist configured by the system, the memory can be searched based on the received temporary trust token as the key. Whether there is a value (value) in the database redis, if it exists, it means that the temporary trust token is generated by the second application server within the preset validity period and is legal, and the login credit can be performed.
步骤110、第二应用服务器在上述验证通过后对该跳转请求进行登录授信。Step 110, the second application server performs login authorization for the jump request after the above verification is passed.
则第一应用客户端得以成功跳转至第二应用服务器提供的目标网页页面,且得到登录授信。Then the first application client can successfully jump to the target web page provided by the second application server, and obtain login authorization.
在一些实施方式中,对第一应用客户端进行登录授信之后,方法还包括:第二应用服务器提取内存数据库中对应于临时信任令牌的用户身份信息,根据用户身份信息获取对应的历史交易信息,以及基于预设权益规则、历史交易信息和用户身份信息为第一应用客户端提供对应的权益信息。In some implementations, after performing login authorization on the first application client, the method further includes: the second application server extracts the user identity information corresponding to the temporary trust token in the memory database, and obtains the corresponding historical transaction information according to the user identity information , and provide corresponding equity information to the first application client based on preset equity rules, historical transaction information, and user identity information.
举例来说,第二应用服务器可以查询交易数据,根据预先配置的规则(如卡等级为白金卡及以上,交易笔数每月大于2笔,单笔交易金额不小于10元等)判断用户是否达标,如达标发放权益(如商超抵扣券、洗车券等),用户在目标网页页面可以看到每张卡发放的权益,后续到线下门店消费使用。For example, the second application server can query the transaction data, and judge whether the user is If the standard is met, the benefits (such as discount coupons for supermarkets, car wash coupons, etc.) are issued, and users can see the benefits issued by each card on the target webpage, and then go to offline stores for consumption and use.
基于相同的技术构思,本发明实施例还提供一种安全跨域登录方法,应用于第一应用服务器,参见图3,包括步骤301-305:Based on the same technical concept, the embodiment of the present invention also provides a secure cross-domain login method, which is applied to the first application server, see Figure 3, including steps 301-305:
步骤301、接收第一应用客户端发送的登录请求。其中,登录请求用于请求登录第二应用服务器提供的目标网页页面。Step 301. Receive a login request sent by a first application client. Wherein, the login request is used to request to log in to the target web page provided by the second application server.
步骤302、根据登录请求获取对应于第一应用客户端的用户身份信息;Step 302, acquiring user identity information corresponding to the first application client according to the login request;
步骤303、根据用户身份信息生成请求报文,并将请求报文发送至第二应用服务器;Step 303, generating a request message according to the user identity information, and sending the request message to the second application server;
步骤304、接收第二应用服务器发送的临时信任令牌,临时信任令牌基于请求报文生成;Step 304, receiving the temporary trust token sent by the second application server, where the temporary trust token is generated based on the request message;
步骤305、将临时信任令牌发送至第一应用客户端,使第一应用客户端向第二应用服务器提供的目标网页页面发送跳转请求,跳转请求至少携带临时信任令牌。Step 305: Send the temporary trust token to the first application client, so that the first application client sends a redirect request to the target web page provided by the second application server, and the redirect request carries at least the temporary trust token.
在一些实施方式中,登录请求包含第一应用客户端的设备地址信息,根据登录请求获取对应于第一应用客户端的用户身份信息,还包括:根据第一应用客户端的设备地址信息进行本地查询,以获得对应于第一应用客户端的用户身份信息;其中,第一应用客户端基于用户身份信息预先注册于第一应用服务器。In some implementations, the login request includes the device address information of the first application client, and obtaining the user identity information corresponding to the first application client according to the login request further includes: performing a local query according to the device address information of the first application client to obtain Obtaining user identity information corresponding to the first application client; wherein, the first application client is pre-registered with the first application server based on the user identity information.
基于相同的技术构思,本发明实施例还提供一种安全跨域登录方法,应用于第二应用服务器,参见图4,包括步骤401-403:Based on the same technical concept, the embodiment of the present invention also provides a secure cross-domain login method, which is applied to the second application server, see Figure 4, including steps 401-403:
步骤401、接收第一应用服务器发送的请求报文,请求报文包含与第一应用服务器通信连接的第一应用客户端对应的用户身份信息。Step 401: Receive a request message sent by a first application server, where the request message includes user identity information corresponding to a first application client communicatively connected to the first application server.
步骤402、基于请求报文生成临时信任令牌,并通过第一应用服务器发送至第一应用客户端,以使第一应用客户端向第二应用服务器提供的目标网页页面发送跳转请求,跳转请求至少携带临时信任令牌;Step 402, generate a temporary trust token based on the request message, and send it to the first application client through the first application server, so that the first application client sends a jump request to the target web page provided by the second application server, and jumps to The transfer request carries at least a temporary trust token;
步骤403、对跳转请求携带的临时信任令牌进行验证,并在验证通过后对第一应用客户端进行登录授信。Step 403: Verify the temporary trust token carried in the jump request, and perform login authorization for the first application client after the verification is passed.
在一些实施方式中,请求报文包括以下中的一项或多项:第一应用服务器的身份标识、第一应用客户端对应的设备地址信息和用户身份信息。In some implementations, the request message includes one or more of the following: the identity of the first application server, device address information corresponding to the first application client, and user identity information.
在一些实施方式中,方法还包括:根据第一应用服务器的身份标识查找预先配置的服务器白名单,以进行服务器身份校验;其中,若服务器身份校验不通过,则拒绝生成临时信任令牌,并向第一应用服务器返回第一报错信息。In some implementations, the method further includes: searching a pre-configured server whitelist according to the identity of the first application server to perform server identity verification; wherein, if the server identity verification fails, refusing to generate a temporary trust token , and return the first error message to the first application server.
在一些实施方式中,方法还包括:根据预设报文规范对请求报文进行报文校验;其中,若报文校验不通过,则拒绝生成临时信任令牌,并向第一应用服务器返回第二报错信息。In some implementations, the method further includes: performing message verification on the request message according to the preset message specification; wherein, if the message verification fails, refusing to generate a temporary trust token, and sending the request to the first application server Return the second error message.
在一些实施方式中,预设报文规范指示请求报文包括至少一个报文必填域,以及,根据预设报文规范对请求报文进行报文校验,包括:判断请求报文中的报文必填域是否非空和/或是否按预设格式填写。In some implementations, the preset message specification indicates that the request message includes at least one message mandatory field, and performing message verification on the request message according to the preset message specification includes: judging the Whether the mandatory field of the message is not empty and/or whether it is filled in according to the preset format.
在一些实施方式中,请求报文携带根据第一私钥生成的第一加密签名,方法还包括:预先获取第一应用服务器提供的第一公钥,其中第一公钥和第一私钥是第一应用服务器基于加密算法生成的密钥对;根据第一公钥对接收的请求报文中的第一加密签名进行签名验证;其中,若签名验证不通过,则拒绝生成临时信任令牌,并向第一应用服务器返回第三报错信息。In some implementations, the request message carries the first encrypted signature generated according to the first private key, and the method further includes: obtaining in advance the first public key provided by the first application server, where the first public key and the first private key are The first application server generates a key pair based on an encryption algorithm; performs signature verification on the first encrypted signature in the received request message according to the first public key; wherein, if the signature verification fails, then refuses to generate a temporary trust token, And return the third error message to the first application server.
在一些实施方式中,请求报文还包括对用户身份信息的一项或多项进行敏感信息加密后获得的敏感身份信息段,方法还包括:预先获取第一应用服务器提供的敏感信息密钥,并根据敏感信息密钥对请求报文中的敏感身份信息段进行敏感解密,以获得用户身份信息的明文信息;其中,若未成功实现敏感解密,则拒绝生成临时信任令牌,并向第一应用服务器返回第四报错信息。In some embodiments, the request message further includes a sensitive identity information segment obtained by encrypting sensitive information on one or more pieces of user identity information, and the method further includes: obtaining in advance the sensitive information key provided by the first application server, And according to the sensitive information key, sensitively decrypt the sensitive identity information segment in the request message to obtain the plaintext information of the user identity information; if the sensitive decryption is not successfully realized, then refuse to generate a temporary trust token, and submit to the first The application server returns the fourth error message.
在一些实施方式中,基于请求报文生成临时信任令牌,还包括:根据请求报文中包含的用户身份信息生成全局唯一的临时信任令牌;将临时信任令牌和对应的用户身份信息以键值对形式缓存至内存数据库,并为临时信任令牌设置预定有效期限,其中,在预定有效期限到达之后将临时信任令牌对应的键值对从内存数据库删除。In some implementations, generating a temporary trust token based on the request message further includes: generating a globally unique temporary trust token according to the user identity information contained in the request message; combining the temporary trust token and the corresponding user identity information with The key-value pair is cached in the memory database, and a predetermined validity period is set for the temporary trust token, wherein, after the predetermined validity period is reached, the key-value pair corresponding to the temporary trust token is deleted from the memory database.
在一些实施方式中,根据用户身份信息生成全局唯一的临时信任令牌,还包括:利用SnowFlake算法生成临时信任令牌。In some implementation manners, generating a globally unique temporary trust token according to user identity information further includes: generating the temporary trust token by using a SnowFlake algorithm.
在一些实施方式中,基于请求报文生成临时信任令牌之后,方法还包括:根据请求报文中包含的用户身份信息进行用户注册或用户绑定。In some embodiments, after the temporary trust token is generated based on the request message, the method further includes: performing user registration or user binding according to the user identity information contained in the request message.
在一些实施方式中,基于请求报文生成临时信任令牌之后,方法还包括:基于加密算法预先生成第二密钥,包括第二公钥和第二私钥;根据临时信任令牌生成应答报文,并根据第二私钥对应答报文进行签名,并将签名后的应答报文发送给第一应用服务器,以使第一应用服务器基于第二应用服务器提供的第二公钥对接收的应答报文进行签名解密。In some implementations, after the temporary trust token is generated based on the request message, the method further includes: pre-generating a second key based on an encryption algorithm, including a second public key and a second private key; generating a response message based on the temporary trust token The response message is signed according to the second private key, and the signed response message is sent to the first application server, so that the first application server pairs the received information based on the second public key provided by the second application server. The response message is signed and decrypted.
在一些实施方式中,对跳转请求携带的临时信任令牌进行验证,包括:若验证确定跳转请求中包含临时信任令牌,且在内存数据库中包含对应于临时信任令牌的值,则对第一应用客户端进行登录授信;否则,拒绝对第一应用客户端进行登录授信。In some implementations, verifying the temporary trust token carried in the redirect request includes: if the verification determines that the redirect request contains the temporary trust token and contains a value corresponding to the temporary trust token in the memory database, then Perform login authorization for the first application client; otherwise, refuse to perform login authorization for the first application client.
在一些实施方式中,对跳转请求携带的临时信任令牌进行验证,还包括:获取跳转请求包含的源域名,根据源域名查找预设域名白名单,以对跳转请求以进行源域名校验;若源域名校验不通过,拒绝对第一应用客户端进行登录授信。In some embodiments, verifying the temporary trust token carried in the redirection request further includes: obtaining the source domain name included in the redirection request, and searching the preset domain name whitelist according to the source domain name, so as to verify the source domain name in the redirection request. verification; if the verification of the source domain name fails, the login credit authorization for the first application client is refused.
在一些实施方式中,对第一应用客户端进行登录授信之后,方法还包括:提取内存数据库中对应于临时信任令牌的用户身份信息;根据用户身份信息获取对应的历史交易信息;以及,基于预设权益规则、历史交易信息和用户身份信息为第一应用客户端提供对应的权益信息。In some implementations, after performing login authorization on the first application client, the method further includes: extracting user identity information corresponding to the temporary trust token in the memory database; obtaining corresponding historical transaction information according to the user identity information; and, based on The preset equity rules, historical transaction information and user identity information provide corresponding equity information for the first application client.
基于相同的技术构思,本发明实施例还提供一种安全跨域登录系统,参见图5,该系统包括:第一应用服务器、第二应用服务器以及用户终端;Based on the same technical concept, the embodiment of the present invention also provides a secure cross-domain login system, see Figure 5, the system includes: a first application server, a second application server, and a user terminal;
其中,用户终端搭载有第一应用客户端,第一应用客户端用于向第一应用服务器发送用于请求登录第二应用服务器提供的目标网页页面的登录请求,还用于在接收到临时信任令牌之后,向第二应用服务器提供的目标网页页面发送跳转请求,跳转请求至少携带临时信任令牌;第一应用服务器用于执行如图3所示出的方法;第二应用服务器用于执行如图4所示出的方法。用户终端还用于显示第二应用服务器提供的目标网页页面。Wherein, the user terminal is equipped with a first application client, and the first application client is used to send a login request to the first application server for requesting to log in to the target web page provided by the second application server, and is also used to After the token, send a jump request to the target web page provided by the second application server, the jump request at least carries a temporary trust token; the first application server is used to execute the method shown in Figure 3; the second application server uses to perform the method shown in FIG. 4 . The user terminal is also used to display the target web page provided by the second application server.
基于相同的技术构思,本发明实施例还提供用于执行如图3所示出方法的第一应用服务器,还提供用于执行如图4所示出方法的第二应用服务器。Based on the same technical concept, the embodiment of the present invention further provides a first application server for executing the method shown in FIG. 3 and a second application server for executing the method shown in FIG. 4 .
需要说明的是,本申请实施例中的上述方法、系统和服务器可以实现前述图1所示出方法的实施例的各个过程,并达到相同的效果和功能,这里不再赘述。It should be noted that the above-mentioned method, system, and server in the embodiment of the present application can realize each process of the embodiment of the method shown in FIG. 1 above, and achieve the same effect and function, which will not be repeated here.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read only memory (ROM) or flash RAM. Memory is an example of computer readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。此外,尽管在附图中以特定顺序描述了本发明方法的操作,但是,这并非要求或者暗示必须按照该特定顺序来执行这些操作,或是必须执行全部所示的操作才能实现期望的结果。附加地或备选地,可以省略某些步骤,将多个步骤合并为一个步骤执行,和/或将一个步骤分解为多个步骤执行。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device. In addition, while operations of the methods of the present invention are depicted in the figures in a particular order, there is no requirement or implication that these operations must be performed in that particular order, or that all illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step for execution, and/or one step may be decomposed into multiple steps for execution.
虽然已经参考若干具体实施方式描述了本发明的精神和原理,但是应该理解,本发明并不限于所公开的具体实施方式,对各方面的划分也不意味着这些方面中的特征不能组合以进行受益,这种划分仅是为了表述的方便。本发明旨在涵盖所附权利要求的精神和范围内所包括的各种修改和等同布置。Although the spirit and principles of the invention have been described with reference to a number of specific embodiments, it should be understood that the invention is not limited to the specific embodiments disclosed, nor does division of aspects imply that features in these aspects cannot be combined to achieve optimal performance. Benefit, this division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims (32)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011284833.7A CN112333198B (en) | 2020-11-17 | 2020-11-17 | Secure cross-domain login method, system and server |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202011284833.7A CN112333198B (en) | 2020-11-17 | 2020-11-17 | Secure cross-domain login method, system and server |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN112333198A CN112333198A (en) | 2021-02-05 |
| CN112333198B true CN112333198B (en) | 2023-09-05 |
Family
ID=74320810
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202011284833.7A Active CN112333198B (en) | 2020-11-17 | 2020-11-17 | Secure cross-domain login method, system and server |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN112333198B (en) |
Families Citing this family (25)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112953965B (en) * | 2021-03-18 | 2022-11-01 | 杭州网易云音乐科技有限公司 | Client login method and system, client, medium and computing device |
| CN113179254B (en) * | 2021-04-01 | 2023-03-24 | 杭州数跑科技有限公司 | System login method and device, electronic equipment and storage medium |
| CN113065160A (en) * | 2021-04-12 | 2021-07-02 | 浙江环玛信息科技有限公司 | Intelligent court data transmission method and system |
| CN113079175A (en) * | 2021-04-14 | 2021-07-06 | 上海浦东发展银行股份有限公司 | Authorization system and method based on oauth2 protocol enhancement |
| CN113342543B (en) * | 2021-05-24 | 2025-03-25 | 杭州数梦工场科技有限公司 | Authentication center connection method, device, system and storage medium |
| CN113190724B (en) * | 2021-05-31 | 2024-02-27 | 中国银行股份有限公司 | User bank information query method, mobile terminal and server |
| CN113347190B (en) * | 2021-06-10 | 2022-10-21 | 北京字节跳动网络技术有限公司 | Authentication method, system, slave station server, client, device and medium |
| CN114124430B (en) * | 2021-08-31 | 2024-03-01 | 青岛海尔科技有限公司 | Token replacement method, device and storage medium |
| CN113965352B (en) * | 2021-09-18 | 2023-12-01 | 网宿科技股份有限公司 | Third-party website login methods, devices, electronic equipment and storage media |
| CN113569229B (en) * | 2021-09-18 | 2021-12-24 | 北京金堤科技有限公司 | Synchronous login method and device, storage medium and electronic equipment |
| CN114218550B (en) * | 2021-11-09 | 2025-06-27 | 中国建设银行股份有限公司 | Single sign-on method, device, electronic device and storage medium |
| CN114285815B (en) * | 2021-12-21 | 2024-05-14 | 中国农业银行股份有限公司 | Application jump method and application jump device |
| CN114282240A (en) * | 2021-12-24 | 2022-04-05 | 北京天融信网络安全技术有限公司 | Control method, electronic device and storage medium for cross-domain access |
| CN114553480B (en) * | 2022-01-13 | 2023-05-26 | 中国科学院信息工程研究所 | Cross-domain single sign-on method and device, electronic equipment and readable storage medium |
| CN114363088B (en) * | 2022-02-18 | 2024-04-16 | 京东科技信息技术有限公司 | Method and device for requesting data |
| CN115102724B (en) * | 2022-06-06 | 2023-12-08 | 珠海格力电器股份有限公司 | Login method and system of double Token cross-end jump system |
| CN115242403A (en) * | 2022-07-19 | 2022-10-25 | 达而观科技(北京)有限公司 | Unified login system and method for intelligent application warehouse |
| CN115423484A (en) * | 2022-09-20 | 2022-12-02 | 上海壹佰米网络科技有限公司 | Method and device for sending user interface information |
| CN115941267A (en) * | 2022-11-02 | 2023-04-07 | 北京京东拓先科技有限公司 | Method and device for cross-platform login |
| CN116232754A (en) * | 2023-03-24 | 2023-06-06 | 中国建设银行股份有限公司 | Method and device for maintaining login state |
| CN116962092B (en) * | 2023-09-21 | 2023-12-26 | 畅捷通信息技术股份有限公司 | Ecological integrated login method, system, electronic equipment and storage medium |
| CN118381626B (en) * | 2024-03-27 | 2024-12-20 | 诚通数字科技有限责任公司 | Inter-application authentication method, device and readable storage medium |
| WO2025055465A1 (en) * | 2024-06-26 | 2025-03-20 | 抖音视界有限公司 | Request processing method and apparatus, device, and storage medium |
| CN119583103A (en) * | 2024-10-25 | 2025-03-07 | 北京市大数据中心 | A cross-platform identity authentication method, device, electronic device and storage medium |
| CN119788358B (en) * | 2024-12-19 | 2025-09-09 | 福州微联达传媒有限公司 | A control method, device, equipment and storage medium for receiving virtual rights |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2002039237A2 (en) * | 2000-11-09 | 2002-05-16 | International Business Machines Corporation | Method and system for web-based cross-domain single-sign-on authentication |
| CN102098158A (en) * | 2009-12-10 | 2011-06-15 | 北大方正集团有限公司 | Cross-domain name single sign on and off method and system as well as corresponding equipment |
| CN104378376A (en) * | 2014-11-18 | 2015-02-25 | 深圳中兴网信科技有限公司 | SOA-based single-point login method, authentication server and browser |
| CN105472052A (en) * | 2014-09-03 | 2016-04-06 | 阿里巴巴集团控股有限公司 | Login method and system of cross-domain server |
| CN107026847A (en) * | 2017-02-09 | 2017-08-08 | 阿里巴巴集团控股有限公司 | A trust login method, server and system |
| CN110781482A (en) * | 2019-10-12 | 2020-02-11 | 广州酷旅旅行社有限公司 | Login method, login device, computer equipment and storage medium |
| CN111241555A (en) * | 2019-12-30 | 2020-06-05 | 北京顺达同行科技有限公司 | Access method and device for simulating user login, computer equipment and storage medium |
-
2020
- 2020-11-17 CN CN202011284833.7A patent/CN112333198B/en active Active
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2002039237A2 (en) * | 2000-11-09 | 2002-05-16 | International Business Machines Corporation | Method and system for web-based cross-domain single-sign-on authentication |
| CN102098158A (en) * | 2009-12-10 | 2011-06-15 | 北大方正集团有限公司 | Cross-domain name single sign on and off method and system as well as corresponding equipment |
| CN105472052A (en) * | 2014-09-03 | 2016-04-06 | 阿里巴巴集团控股有限公司 | Login method and system of cross-domain server |
| CN104378376A (en) * | 2014-11-18 | 2015-02-25 | 深圳中兴网信科技有限公司 | SOA-based single-point login method, authentication server and browser |
| CN107026847A (en) * | 2017-02-09 | 2017-08-08 | 阿里巴巴集团控股有限公司 | A trust login method, server and system |
| CN110781482A (en) * | 2019-10-12 | 2020-02-11 | 广州酷旅旅行社有限公司 | Login method, login device, computer equipment and storage medium |
| CN111241555A (en) * | 2019-12-30 | 2020-06-05 | 北京顺达同行科技有限公司 | Access method and device for simulating user login, computer equipment and storage medium |
Non-Patent Citations (1)
| Title |
|---|
| A Fine-Grained Cross-Domain Access Control Mechanism for Social Internet of Things;Jun Wu等;IEEE;全文 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112333198A (en) | 2021-02-05 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112333198B (en) | Secure cross-domain login method, system and server | |
| US12323526B2 (en) | Decentralized data authentication | |
| CN111316303B (en) | Systems and methods for blockchain-based cross-entity authentication | |
| US10516662B2 (en) | System and method for authenticating the legitimacy of a request for a resource by a user | |
| US20200084045A1 (en) | Establishing provenance of digital assets using blockchain system | |
| CN108259438B (en) | Authentication method and device based on block chain technology | |
| CN114679293A (en) | Access control method, device and storage medium based on zero trust security | |
| JP7282982B2 (en) | Anonymous event proof by group signature | |
| CN111373400A (en) | System and method for implementing a resolver service for decentralized identity | |
| WO2021169107A1 (en) | Internet identity protection method and apparatus, electronic device, and storage medium | |
| CN115811412B (en) | Communication method and device, SIM card, electronic equipment and terminal equipment | |
| US11405196B2 (en) | Authenticate transactions of secured file in blockchain | |
| CN111355726A (en) | Identity authorization login method and device, electronic equipment and storage medium | |
| CN111460457A (en) | Real estate property registration supervision method, device, electronic equipment and storage medium | |
| CN114553570B (en) | Method, device, electronic equipment and storage medium for generating token | |
| KR20220042192A (en) | Anonymous Event Attestation | |
| Wang et al. | A framework for formal analysis of privacy on SSO protocols | |
| JP2022533874A (en) | Prevent data manipulation and protect user privacy in telecom network measurements | |
| Fietkau et al. | Secure authentication for everyone! Enabling 2nd-factor authentication under real-world constraints | |
| CN114826616B (en) | Data processing method, device, electronic equipment and medium | |
| US12445455B2 (en) | Securing browser cookies | |
| Bolgouras et al. | Enabling qualified anonymity for enhanced user privacy in the digital era | |
| HK40073367A (en) | Access control method, device based on zero trust security, and storage medium | |
| HK40066642A (en) | System, method, and computer-readable medium for decentralized data authentication | |
| JP2015515700A (en) | Method and computer communication system for authenticating a client system |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |