CN106209727B - Session access method and device - Google Patents
Session access method and device Download PDFInfo
- Publication number
- CN106209727B CN106209727B CN201510214169.1A CN201510214169A CN106209727B CN 106209727 B CN106209727 B CN 106209727B CN 201510214169 A CN201510214169 A CN 201510214169A CN 106209727 B CN106209727 B CN 106209727B
- Authority
- CN
- China
- Prior art keywords
- client
- session
- terminal information
- terminal
- access
- 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
Images
Landscapes
- Computer And Data Communications (AREA)
Abstract
本申请提供一种会话访问方法和装置,其中方法包括:接收客户端发送的服务访问请求,所述服务访问请求中包括客户端所在终端的第一终端信息、以及用于标识客户端访问服务会话的会话标识;获取预先存储的与所述会话标识对应的第二终端信息,在确定所述第一终端信息与第二终端信息相同时,向所述客户端返回服务访问内容。本申请提高了应用访问的安全性。
The present application provides a session access method and device, wherein the method includes: receiving a service access request sent by a client, wherein the service access request includes first terminal information of the terminal where the client is located, and a service session used to identify the client to access the service. The session identifier is obtained; the pre-stored second terminal information corresponding to the session identifier is obtained, and when it is determined that the first terminal information is the same as the second terminal information, the service access content is returned to the client. The present application improves the security of application access.
Description
技术领域technical field
本申请涉及网络技术,特别涉及一种会话访问方法和装置。The present application relates to network technology, and in particular, to a session access method and apparatus.
背景技术Background technique
基于B/S(Browser/Server,浏览器/服务器)模式的互联网应用,在服务器为浏览器对应的客户端提供应用数据时,出于数据访问的安全考虑,通常只将应用数据授权给具有登录权限的用户。并且,该互联网应用的访问是短链接的方式,客户端每次向服务器发送数据请求时都要与服务器建立会话,并且携带会话标识来保持对同一个应用的访问状态。但是,由于会话标识是存储在客户端,容易被随意复制,一旦被其他终端复制该会话标识并用以向服务器请求会话,将使应用访问存在安全隐患。For Internet applications based on B/S (Browser/Server, browser/server) mode, when the server provides application data to the client corresponding to the browser, for the security of data access, the application data is usually only authorized to users who have logged in privileged user. Moreover, the access to the Internet application is in the form of a short link, and each time the client sends a data request to the server, it must establish a session with the server and carry the session identifier to maintain the access state to the same application. However, since the session ID is stored in the client and is easily copied at will, once the session ID is copied by other terminals and used to request a session from the server, there will be a security risk in application access.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本申请提供一种会话访问方法和装置,以提高应用访问的安全性。In view of this, the present application provides a session access method and apparatus to improve the security of application access.
具体地,本申请是通过如下技术方案实现的:Specifically, the application is achieved through the following technical solutions:
第一方面,提供一种会话访问方法,包括:In a first aspect, a session access method is provided, including:
接收客户端发送的服务访问请求,所述服务访问请求中包括客户端所在终端的第一终端信息、以及用于标识客户端访问服务会话的会话标识;receiving a service access request sent by the client, where the service access request includes first terminal information of the terminal where the client is located, and a session identifier used to identify the client's access service session;
获取预先存储的与所述会话标识对应的第二终端信息,在确定所述第一终端信息与第二终端信息相同时,向所述客户端返回服务访问内容。Acquire pre-stored second terminal information corresponding to the session identifier, and return service access content to the client when it is determined that the first terminal information is the same as the second terminal information.
第二方面,提供一种会话访问装置,包括:In a second aspect, a session access device is provided, including:
请求接收模块,用于接收客户端发送的服务访问请求,所述服务访问请求中包括客户端所在终端的第一终端信息、以及用于标识客户端访问服务会话的会话标识;a request receiving module, configured to receive a service access request sent by the client, where the service access request includes first terminal information of the terminal where the client is located and a session identifier used to identify the client access service session;
内容反馈模块,用于获取预先存储的与所述会话标识对应的第二终端信息,在确定所述第一终端信息与第二终端信息相同时,向所述客户端返回服务访问内容。A content feedback module, configured to acquire pre-stored second terminal information corresponding to the session identifier, and return service access content to the client when it is determined that the first terminal information is the same as the second terminal information.
本申请提供的会话访问方法和装置,通过在确定发送服务访问请求的终端与存储的终端相同时,才向客户端返回服务访问内容,可以避免终端不同时的会话访问,从而提高了应用访问的安全性。The session access method and device provided by the present application, by returning the service access content to the client only when it is determined that the terminal sending the service access request is the same as the stored terminal, can avoid session accesses of different terminals at the same time, thereby improving application access reliability. safety.
附图说明Description of drawings
图1是本申请一示例性实施例示出的一种互联网应用的访问系统;FIG. 1 is an access system for an Internet application shown in an exemplary embodiment of the present application;
图2是本申请一示例性实施例示出的一种会话访问方法的流程图;FIG. 2 is a flowchart of a session access method according to an exemplary embodiment of the present application;
图3是本申请一示例性实施例示出的另一种会话访问方法的流程图;FIG. 3 is a flowchart of another session access method shown in an exemplary embodiment of the present application;
图4是本申请一示例性实施例示出的一种会话访问装置的结构图。FIG. 4 is a structural diagram of a session access apparatus according to an exemplary embodiment of the present application.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. Where the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as recited in the appended claims.
图1示例了B/S模式下的互联网应用的访问系统,该系统可以包括客户端11和服务器12,例如,客户端是通过终端13上运行的浏览器打开的天猫网站,而服务器12是天猫网站对应的天猫服务器。本申请实施例的会话访问方法和装置,应用于客户端和服务器之间的通信,如下首先简单说明上述客户端11与服务器12之间的通信特点:FIG. 1 illustrates an Internet application access system in B/S mode. The system may include a
仍以上述的天猫客户端对天猫服务器的访问为例,在浏览器上显示的天猫网站中的内容可以是服务器12提供的,并且通常服务器12只将内容提供给具有登录权限的用户,因此用户会在天猫网站注册得到账号和密码。Still taking the access of the above-mentioned Tmall client to the Tmall server as an example, the content in the Tmall website displayed on the browser can be provided by the
在得到账号和密码后,客户端和浏览器之间的访问采用短链接方式,具体的,例如,天猫网站上可以包括多个网络资源的链接,比如服饰详情链接、商家信息链接等,短链接方式的特点是,每次当用户点击一个链接时(相当于发起一次数据请求),都要与服务器建立一次会话,当本次链接对应的数据请求结束,则会话释放;下一次再在天猫网站点击下一个链接时(相当于又发起一次数据请求),则又要建立一次会话。这多次的会话建立都是用户在登录天猫以后对天猫网站的访问操作,也就是说,从用户登录天猫到退出对天猫的访问,中间可能会向服务器发起多次数据请求,建立多次会话。After obtaining the account number and password, the access between the client and the browser adopts the short link method. Specifically, for example, the Tmall website may include links to multiple network resources, such as clothing details links, business information links, etc. The characteristic of the link method is that every time the user clicks a link (equivalent to initiating a data request), a session must be established with the server, and when the data request corresponding to this link ends, the session will be released; When the cat website clicks on the next link (equivalent to initiating another data request), another session needs to be established. These multiple session establishments are all the user's access operations to the Tmall website after logging in to Tmall. That is to say, from the time the user logs in to Tmall to exiting the access to Tmall, multiple data requests may be made to the server in the middle. Establish multiple sessions.
对于上述的访问过程,服务器侧会对该访问进行记录,记录方式是,对于用户登录天猫到退出对天猫的整个访问过程,分配一个会话ID,在整个访问中的多次会话,都携带该相同的会话ID,这样服务器就可以据此确定该多次会话访问都是对应于同一个用户对天猫的一次访问。即某用户在登录天猫时,服务器为其分配会话ID,在用户访问天猫的过程中,每次数据请求创建会话时都携带该会话ID,服务器根据该会话ID将用户本次登录的访问过程关联记录,属于同一个用户对天猫的一次访问。For the above access process, the server side will record the access. The recording method is to assign a session ID for the entire access process from logging in to Tmall to logging out of Tmall. The same session ID, so that the server can determine accordingly that the multiple session accesses correspond to one access to Tmall by the same user. That is, when a user logs in to Tmall, the server assigns a session ID to it. During the process of accessing Tmall, the session ID is carried with each data request to create a session. The process association record belongs to a visit to Tmall by the same user.
本申请实施例的会话访问方法,应用于在用户登录天猫之后,每次创建会话时,服务器侧根据本实施例的会话访问方法确定用户是否有访问权限。图2示例了服务器执行的会话访问方法,包括:The session access method in this embodiment of the present application is applied to the server side determining whether the user has access rights according to the session access method in this embodiment every time a session is created after the user logs in to Tmall. Figure 2 illustrates the session access method performed by the server, including:
201、接收客户端发送的服务访问请求,所述服务访问请求中包括客户端所在终端的第一终端信息、以及用于标识客户端访问服务会话的会话标识;201. Receive a service access request sent by the client, where the service access request includes first terminal information of the terminal where the client is located, and a session identifier used to identify the client access service session;
202、获取预先存储的与所述会话标识对应的第二终端信息,在确定所述第一终端信息与第二终端信息相同时,向所述客户端返回服务访问内容。202. Acquire pre-stored second terminal information corresponding to the session identifier, and when it is determined that the first terminal information is the same as the second terminal information, return service access content to the client.
其中,在201中的服务访问请求,例如是用户在登录天猫之后点击网站上的一个资源链接,向服务器12发送所述的服务访问请求。客户端可以在该请求中携带所在终端的终端信息,该客户端所在终端例如是图1中所示的终端13,客户端天猫网站是运行在该终端13的浏览器上;所述的终端信息例如是IP地址、MAC地址这类网络连接属性信息,这种信息具有较难复制的特点。客户端还在服务访问请求中携带会话标识,该会话标识可以是用户首次登录天猫网站时,服务器为用户的本次访问分配的会话ID。The service access request in 201, for example, is that the user clicks a resource link on the website after logging in to Tmall, and sends the service access request to the
在202中,服务器12可以将服务访问请求中携带的终端信息,与本次预先存储的与会话ID对应的终端信息进行比较,可以将服务访问请求中携带的终端信息称为第一终端信息,本地存储的终端信息称为第二终端信息,该第二终端信息可以是服务器在为用户分配会话ID时记录的。如果第一终端信息与第二终端信息相同,则可以确定是同一个终端发起的访问,则可以向客户端返回服务访问内容,比如对应网站链接的数据资源。In 202, the
通过图2所示的会话访问方法,服务器就可以确保访问应用的终端的一致性,防止不同终端之间复制会话ID的情况发生。比如,用户在终端13上登录天猫时服务器分配了访问会话的会话ID,如果用户在另一个终端上访问天猫,即使仍然是同一账号密码对应的同一用户,但是更换终端后通常服务器侧将终止本次访问的授权,而如果上述另一个终端也携带了会话ID,服务器侧只根据会话ID判断用户是否有访问权限,则容易造成在更换终端后仍然能够访问,这种随意访问增加了安全隐患。本实施例的服务器不仅根据会话ID,还根据终端信息,只有发起当前会话的终端与授权会话时的终端相同时,才允许继续访问,从而确保了访问安全性。Through the session access method shown in FIG. 2 , the server can ensure the consistency of the terminals accessing the application, and prevent the occurrence of duplication of session IDs between different terminals. For example, when the user logs in to Tmall on the
图3示例了服务器侧处理会话访问的另一流程图,如图3所示,包括:Fig. 3 illustrates another flowchart of processing session access on the server side, as shown in Fig. 3, including:
301、接收所述客户端发送的会话授权请求;301. Receive a session authorization request sent by the client;
例如,用户可以在天猫网站输入账号和密码,携带在会话授权请求中提交到服务器进行验证。该会话授权请求还可以包括客户端所在的终端的终端信息,可以称为第二终端信息,比如是终端的IP地址。For example, the user can enter the account number and password on the Tmall website, and submit it to the server for verification in the session authorization request. The session authorization request may further include terminal information of the terminal where the client is located, which may be referred to as second terminal information, such as the IP address of the terminal.
302、存储会话标识与第二终端信息的对应关系;302. Store the correspondence between the session identifier and the second terminal information;
例如,服务器接收到301中的会话授权请求后,对账号和密码进行验证,在验证通过后,为用户的本次访问分配会话标识,并存储该会话标识与会话授权请求中携带的第二终端信息的对应关系。For example, after receiving the session authorization request in 301, the server verifies the account and password, and after the verification is passed, assigns a session identifier to the user's current access, and stores the session identifier and the second terminal carried in the session authorization request. Correspondence of information.
303、向所述客户端返回授权的所述会话标识;303. Return the authorized session identifier to the client;
例如,服务器在本步骤将为用户分配的会话ID返回至客户端。For example, the server returns the session ID assigned to the user to the client in this step.
304、接收客户端发送的服务访问请求;304. Receive a service access request sent by the client;
例如,在用户登录天猫之后,点击网站的资源链接发起服务访问请求,该请求中携带上述303中分配的会话ID,还携带客户端所在终端的终端信息,可以称为第一终端信息。For example, after logging in to Tmall, the user clicks the resource link of the website to initiate a service access request. The request carries the session ID allocated in 303 above, and also carries the terminal information of the terminal where the client is located, which may be referred to as the first terminal information.
305、获取预先存储的与所述会话标识对应的第二终端信息,在确定所述第一终端信息与第二终端信息相同;305. Obtain pre-stored second terminal information corresponding to the session identifier, and determine that the first terminal information is the same as the second terminal information;
例如,服务器根据304中的会话ID,获取与该会话ID对应的第二终端信息,并判断第二终端信息与第一终端信息是否相同。如果不同,则表明本次访问的终端不是服务器授权会话ID时的终端,则拒绝访问;否则,继续306,向用户返回访问内容。For example, the server obtains the second terminal information corresponding to the session ID according to the session ID in 304, and determines whether the second terminal information is the same as the first terminal information. If it is different, it indicates that the terminal accessed this time is not the terminal when the server authorizes the session ID, and the access is rejected; otherwise, the process continues to 306, and the access content is returned to the user.
306、向所述客户端返回服务访问内容。306. Return the service access content to the client.
为实现上述的会话访问方法,本申请实施例还提供一种会话访问装置,该装置应用于服务器侧,如图4所示,该装置可以包括:请求接收模块41和内容反馈模块42;其中,In order to implement the above session access method, an embodiment of the present application further provides a session access device, which is applied to the server side. As shown in FIG. 4 , the device may include: a
请求接收模块41,用于接收客户端发送的服务访问请求,所述服务访问请求中包括客户端所在终端的第一终端信息、以及用于标识客户端访问服务会话的会话标识;The
例如,终端信息可以包括:终端的网络连接属性信息。所述网络连接属性信息,例如包括:终端的IP地址或者MAC地址。For example, the terminal information may include: network connection attribute information of the terminal. The network connection attribute information includes, for example, an IP address or a MAC address of the terminal.
内容反馈模块42,用于获取预先存储的与所述会话标识对应的第二终端信息,在确定所述第一终端信息与第二终端信息相同时,向所述客户端返回服务访问内容。The
进一步的,所述请求接收模块41,还用于在接收客户端发送的服务访问请求之前,接收客户端发送的会话授权请求,所述会话授权请求中包括所述第二终端信息;Further, the
所述内容反馈模块42,还用于向所述客户端返回授权的所述会话标识,并存储所述会话标识与所述第二终端信息的对应关系。The
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the present application. within the scope of protection.
Claims (4)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510214169.1A CN106209727B (en) | 2015-04-29 | 2015-04-29 | Session access method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510214169.1A CN106209727B (en) | 2015-04-29 | 2015-04-29 | Session access method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN106209727A CN106209727A (en) | 2016-12-07 |
| CN106209727B true CN106209727B (en) | 2020-09-01 |
Family
ID=57457572
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510214169.1A Active CN106209727B (en) | 2015-04-29 | 2015-04-29 | Session access method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106209727B (en) |
Families Citing this family (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108390892B (en) * | 2018-03-31 | 2020-10-09 | 深圳忆联信息系统有限公司 | Control method and device for security access of remote storage system |
| CN112398783B (en) * | 2019-08-15 | 2023-01-06 | 奇安信安全技术(珠海)有限公司 | A security protection method and device for a network sharing session |
| CN112948225B (en) * | 2019-12-24 | 2023-02-17 | 深圳市明源云科技有限公司 | Link monitoring method and device, monitoring equipment and storage medium |
| CN111478909A (en) * | 2020-04-09 | 2020-07-31 | 浪潮软件科技有限公司 | Access processing method, server access method, server and self-service terminal |
| CN111552675A (en) * | 2020-04-24 | 2020-08-18 | 北京达佳互联信息技术有限公司 | Information query method and device, computer equipment and storage medium |
| CN113127307A (en) * | 2021-04-25 | 2021-07-16 | 北京大米科技有限公司 | Method for processing tracing request, related device, system and storage medium |
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104135494A (en) * | 2014-08-22 | 2014-11-05 | 北京京东尚科信息技术有限公司 | Same-account incredible terminal login method and system based on credible terminal |
Family Cites Families (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP1618697A2 (en) * | 2003-03-10 | 2006-01-25 | THOMSON Licensing | An identity mapping mechanism in wlan access control with public authentication servers |
| CN101754215B (en) * | 2008-12-01 | 2012-08-08 | 华为技术有限公司 | Authentication method and system |
| US8869258B2 (en) * | 2010-03-12 | 2014-10-21 | Microsoft Corporation | Facilitating token request troubleshooting |
| CN101873331B (en) * | 2010-07-07 | 2013-11-06 | 中国工商银行股份有限公司 | Safety authentication method and system |
| CN103051647B (en) * | 2011-10-13 | 2016-03-30 | 阿里巴巴集团控股有限公司 | Method, equipment and system that a kind of session realizes |
| CN102523271B (en) * | 2011-12-08 | 2015-04-08 | 华为技术有限公司 | Terminal and communication method and system thereof |
| WO2013119244A1 (en) * | 2012-02-10 | 2013-08-15 | Empire Technology Development Llc | Providing session identifiers |
| CN104468464B (en) * | 2013-09-12 | 2018-07-06 | 深圳市腾讯计算机系统有限公司 | verification method, device and system |
-
2015
- 2015-04-29 CN CN201510214169.1A patent/CN106209727B/en active Active
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104135494A (en) * | 2014-08-22 | 2014-11-05 | 北京京东尚科信息技术有限公司 | Same-account incredible terminal login method and system based on credible terminal |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106209727A (en) | 2016-12-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN101771532B (en) | Method, device and system for realizing resource sharing | |
| CN106209727B (en) | Session access method and device | |
| CN110381031B (en) | Single sign-on method, device, equipment and computer readable storage medium | |
| JP6574168B2 (en) | Terminal identification method, and method, system, and apparatus for registering machine identification code | |
| US20100100950A1 (en) | Context-based adaptive authentication for data and services access in a network | |
| CN104158818B (en) | A kind of single-point logging method and system | |
| CN105991614B (en) | A method, device and server for open authorization and resource access | |
| CN102710640A (en) | Authorization requesting method, device and system | |
| CN105337990A (en) | User identity verification method and device | |
| WO2016180171A1 (en) | Trusted login method and device | |
| CN105337949A (en) | SSO (Single Sign On) authentication method, web server, authentication center and token check center | |
| CN104580553B (en) | Method and device for identifying network address translation equipment | |
| CN103384198A (en) | User identity identification service method and system on basis of mailbox | |
| CN105162802B (en) | Portal authentication method and certificate server | |
| CN102217280A (en) | Method, system, and server for user service authentication | |
| CN103634399A (en) | Method and device for realizing cross-domain data transmission | |
| CN106789858A (en) | A kind of access control method and device and server | |
| CN112929388A (en) | Network identity cross-device application rapid authentication method and system, and user agent device | |
| CN102946396B (en) | User agent's device, host web server and user authen method | |
| CN111935151B (en) | Cross-domain unified login method and device, electronic equipment and storage medium | |
| CN115913690A (en) | Intranet Internet surfing configuration method, device, equipment and medium | |
| CN103118025B (en) | Based on the single-point logging method of networking certification, device and certificate server | |
| CN103621039A (en) | Server, system, method, computer program and computer program product for accessing a server in a computer network | |
| CN102946397B (en) | User authen method and system | |
| CN112291255A (en) | Method, device and server for pushing messages of gateway |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 1231271 Country of ref document: HK |
|
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| TR01 | Transfer of patent right |
Effective date of registration: 20200922 Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands Patentee after: Innovative advanced technology Co.,Ltd. Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands Patentee before: Advanced innovation technology Co.,Ltd. Effective date of registration: 20200922 Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands Patentee after: Advanced innovation technology Co.,Ltd. Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands Patentee before: Alibaba Group Holding Ltd. |
|
| TR01 | Transfer of patent right |
