WO2015096569A1 - 一种资源网关、及资源访问授权方法 - Google Patents

一种资源网关、及资源访问授权方法 Download PDF

Info

Publication number
WO2015096569A1
WO2015096569A1 PCT/CN2014/091649 CN2014091649W WO2015096569A1 WO 2015096569 A1 WO2015096569 A1 WO 2015096569A1 CN 2014091649 W CN2014091649 W CN 2014091649W WO 2015096569 A1 WO2015096569 A1 WO 2015096569A1
Authority
WO
WIPO (PCT)
Prior art keywords
resource
code
request
gateway
owner
Prior art date
Application number
PCT/CN2014/091649
Other languages
English (en)
French (fr)
Inventor
孙立军
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2015096569A1 publication Critical patent/WO2015096569A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6209Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/468Specific access rights for resources, e.g. using capability register
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/64Hybrid switching systems
    • H04L12/6418Hybrid transport
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources

Definitions

  • the present invention relates to the field of network technologies, and in particular, to a resource gateway and a resource access authorization method.
  • a social application eg, Weibo
  • a resource owner opens its own specific API (Application Programming Interface) to enable other applications that are resource consumers to call that particular API.
  • API Application Programming Interface
  • resource owners are based on the OAUTH protocol. After confirming that the resource user is a legitimate user, the resource user is provided with the resource access code to enable the resource user to use the resource owner based on the access code. Resources provided.
  • the resource user When the resource user obtains the access code of the resource from the resource owner based on the OAUTH protocol, the resource user needs to make two API calls to the resource owner (the first call to the API for obtaining the authorization code of the resource, the second call) The API for obtaining access codes for resources, which brings inconvenience to resource users.
  • the embodiment of the present application solves the technical problem that the resource user needs to perform two API calls when acquiring the access code of the resource in the prior art by providing a resource gateway and a resource access authorization method.
  • a resource gateway including:
  • a memory for storing program code
  • a processor configured to interface with the memory, the first network interface, and the second network, to read the program code in the memory, and execute:
  • the processor is further configured to:
  • the processor is further configured to:
  • the processor Also used for:
  • the first format of the access code of the resource is converted from the first format to a first predetermined format, wherein the first format is any format different from the first predetermined format.
  • the processor is further configured to:
  • the second network interface After obtaining the authorization code of the first resource from the resource owner of the first resource according to the first request, according to the authorization code of the first resource provided by the resource owner, and passing The second network interface acquires a refresh code of the first resource from a resource owner of the first resource, and returns a refresh code of the first resource to the resource user by using the first network interface.
  • the processor is further configured to:
  • the first The format of the refresh code of the resource is converted from the second format to a second predetermined format, wherein the second format is any format different from the second predetermined format.
  • the processor is further configured to:
  • Receiving, by the first network interface, the refresh code of the first resource to the resource user receiving, by the resource user, a fourth request for refreshing an access code of the first resource a request, the fourth request is generated by the resource user according to the refresh code of the first resource, and a fourth API provided by the resource gateway, where the fourth request includes the first resource Refreshing code; after determining that the resource owner supports refreshing the access code of the first resource, acquiring, according to the fourth request, the first resource that is refreshed from the resource owner by using the second network interface And accessing the updated access code of the first resource to the resource user by using the first network interface.
  • the processor is further configured to:
  • the processor is further configured to:
  • the format of the refresh code of the first resource is converted into the second format by the second predetermined format.
  • the second aspect provides a resource access authorization method, including:
  • the resource gateway acquires an access code of the first resource from a resource owner of the first resource according to an authorization code of the first resource provided by the resource owner;
  • the resource gateway returns an access code of the first resource to the resource user.
  • the resource gateway acquires an authorization code of the first resource from a resource owner of the first resource according to the first request, include:
  • the resource gateway generates a second request for requesting to acquire an authorization code of the first resource according to the first request and a second API provided by a resource owner of the first resource;
  • the resource gateway receives an authorization code of the first resource returned by the resource owner.
  • the resource gateway is configured according to the first resource provided by the resource owner
  • the authorization code, the access code of the first resource is obtained from the resource owner of the first resource, and includes:
  • the resource gateway generates a third request for requesting to acquire an access code of the first resource, according to the authorization code of the first resource and the third API provided by the resource owner of the first resource, where The third request includes an authorization code of the first resource;
  • the resource gateway receives an access code of the first resource returned by the resource owner.
  • the method further includes:
  • the resource gateway converts the format of the access code of the first resource from the first format to a first predetermined format, where the One format is any format that is different from the first predetermined format.
  • the method further includes:
  • the resource gateway acquires a refresh code of the first resource from a resource owner of the first resource according to an authorization code of the first resource provided by the resource owner;
  • the resource gateway returns a refresh code of the first resource to the resource user.
  • the method before the resource gateway returns the refresh code of the first resource to the resource user, the method also includes:
  • the resource gateway converts the format of the refresh code of the first resource from the second format to a second predetermined format, where the The second format is any format different from the second predetermined format.
  • the method further includes:
  • the resource gateway After the resource gateway determines that the resource owner supports the refresh of the access code of the first resource, the resource gateway acquires the access code of the first resource after the refresh from the resource owner according to the fourth request;
  • the resource gateway returns an access code of the refreshed first resource to the resource user.
  • the resource gateway obtains a refresh from the resource owner of the first resource according to the fourth request After the access code of the first resource, including:
  • the resource gateway generates a fifth request for requesting to refresh an access code of the first resource according to the refresh code of the first resource and the fifth API provided by the resource owner of the first resource, where The fifth request includes a refresh code of the first resource;
  • the resource gateway receives the refreshed access code of the first resource returned by the resource owner.
  • the resource gateway is configured according to the refresh code of the first resource, and the resource of the first resource
  • the fifth API provided by the owner, before generating the fifth request for requesting to refresh the access code of the first resource the method further includes:
  • the resource gateway converts a format of a refresh code of the first resource from the second predetermined format to the second format.
  • a resource gateway including: a first network interface and a second network interface; a memory for storing program code; a processor, a memory, a first network interface, and a second network interface
  • the connection is used to read the program code in the memory, and execute: receiving, by the first network interface, a first request sent by the resource user for requesting to acquire an access code of the first resource, where the first request is a resource user according to the resource And generating, by the first API provided by the gateway, the authorization code of the first resource from the resource owner of the first resource by using the second network interface; and the authorization code of the first resource provided by the resource owner, and Acquiring an access code of the first resource from the resource owner of the first resource by using the second network interface; and returning the access code of the first resource to the resource user by using the first network interface.
  • the resource gateway opens its first API to the resource user, when the resource user needs to obtain the access code of the first resource, the resource user only needs to generate the first request based on the first API and send it to the resource gateway (ie, only the An API call) implements the access code for the first resource. Therefore, the technical problem that the resource user needs to perform two API calls when acquiring the access code of the resource in the prior art is effectively solved, and the resource user only needs to target the resource network. By performing an API call, the access code of the resource can be obtained through the resource gateway, thereby reducing the number of times the resource user makes API calls, and bringing a convenient technical effect to the resource user.
  • FIG. 1 is a schematic structural diagram of a resource gateway in an embodiment of the present application.
  • 2 to 7 are flowcharts of a resource access authorization method in an embodiment of the present application.
  • the embodiment of the present application solves the technical problem that the resource user needs to make two API calls to the resource owner when acquiring the access code of the resource in the prior art by providing a resource gateway and a resource access authorization method.
  • a resource gateway includes: a first network interface and a second network interface; a memory for storing program code; a processor, connected to the memory, the first network interface, and the second network interface, for reading in the memory
  • the program code is configured to: receive, by using the first network interface, a first request for requesting to acquire an access code of the first resource, where the first request is generated by the resource user according to the first API provided by the resource gateway.
  • the authorization code of the first resource from the resource owner of the first resource through the second network interface; according to the authorization code of the first resource provided by the resource owner, and from the first through the second network interface
  • the resource owner of the resource obtains the access code of the first resource; and returns the access code of the first resource to the resource user through the first network interface.
  • the resource gateway opens its first API to the resource user, when the resource user needs to obtain the access code of the first resource, the resource user only needs to generate the first request based on the first API and send it to the resource gateway (ie, only the An API call) implements the access code for the first resource. Therefore, the technical problem that the resource user needs to perform two API calls when acquiring the access code of the resource in the prior art is effectively solved, and the resource user only needs to make an API call to the resource gateway, and then the resource gateway can be used. Obtain the access code of the resource, thereby reducing the number of times the resource user makes API calls, and bringing convenient technical effects to the resource user.
  • first resource or “resource” as used herein refers to a specific API capable of implementing a specific service, and when the specific API is called, an application providing the specific API can implement the specific service. .
  • resource owner refers to an application that can provide the specific API, such as a social application, a shopping application, etc., and what kind of application is specific to the resource owner, The embodiments of the present application are not specifically limited.
  • resource consumer refers to other applications that call that particular API.
  • this embodiment provides a resource gateway, including:
  • a memory 130 configured to store program code
  • One or more processors 140 are coupled to the memory 130, the first network interface 110, and the second network interface 120 for reading program code in the memory 130, and executing:
  • the first resource is a specific API provided by the resource owner for the resource user and capable of implementing a specific service.
  • the resource consumer can call this particular API to implement that particular service through the resource owner.
  • the resource owner is a Weibo-like application
  • the first resource may be an API for publishing information through a Weibo-like application.
  • the resource gateway since the resource gateway opens its first API to the resource user, the resource enables When the user needs to obtain the access code of the first resource, the user only needs to generate the first request based on the first API and send it to the resource gateway (ie, only one API call is made), thereby realizing the access code for acquiring the first resource. Therefore, the technical problem that the resource user needs to perform two API calls when acquiring the access code of the resource in the prior art is effectively solved, and the resource user can pass the resource by only making an API call to the resource gateway.
  • the gateway obtains the access code of the resource, thereby reducing the number of times the resource user makes the API call, and brings a convenient technical effect to the resource user.
  • the resource gateway may be connected to multiple resource users through the first network interface, and connected to multiple resource owners through the second network interface.
  • the first request sent by the resource owner should include the label of the resource owner of the first resource.
  • the processor 140 is further configured to: determine, by using the label, the resource owner of the first resource, thereby The resource owner obtains the access code of the first resource.
  • one resource user needs to connect multiple resource owners to obtain different resources provided by different resource owners, but this brings a large number of interfaces to resource users. maintenance work.
  • the resource user only needs to connect with the resource gateway, thereby reducing the interface maintenance work of the resource user, reducing the access difficulty, and reducing the technical effect of the docking risk.
  • a resource owner needs to connect multiple resource users to provide resources to different resource users, but this brings a lot of interface maintenance work to resource owners.
  • the resource owner only needs to connect with the resource gateway, thereby reducing the technical maintenance effect of reducing the resource owner's interface maintenance work and reducing the docking risk.
  • the memory 130 is further configured with different protocols that the resource owners respectively follow.
  • the processor 140 is further configured to: after receiving the first request sent by the resource user, based on the resources in the first request.
  • the owner's tag retrieves the protocol followed by the resource owner from the memory 130 and, based on the protocol, obtains the access code of the resource from the resource owner.
  • the resource user only needs to send the first request to the resource gateway based on the first API provided by the resource gateway when acquiring the access code of the resource, and does not need the resource user to understand different resource owners.
  • the protocols followed provide convenience to resource users.
  • the processor 140 is further configured to:
  • the resource owner after receiving the second request, the resource owner obtains an authentication information (for example, a user name and a corresponding user password) from the resource user, and verifies whether the authentication information is stored with the resource owner. The authentication information is consistent. If they are consistent, the resource user is determined to be a legitimate user, and the authorization code of the first resource is returned to the resource gateway.
  • an authentication information for example, a user name and a corresponding user password
  • the processor 140 is further configured to:
  • the resource user directly communicates with the resource owner, and the resource user first sends a request for acquiring the authorization code of the first resource to the resource owner based on the second API provided by the resource user (ie, : performing the first API call), after the resource user obtains the authorization code of the first resource, the resource user sends the resource identifier to the resource owner based on the authorization code of the first resource and the third API provided by the resource owner.
  • a request for acquiring an access code of the first resource ie, making a second API call), thereby obtaining an access code of the first resource.
  • the resource gateway generates a second request for requesting to acquire the authorization code of the first resource based on the second API provided by the resource owner (ie, calling the second API by the resource gateway to obtain).
  • the resource gateway sends the resource identifier to the resource owner based on the authorization code of the first resource and the third API provided by the resource owner.
  • the request for the access code of the first resource ie, the third API is invoked by the resource gateway to obtain the access code of the first resource
  • the obtained access code of the first resource is returned to the resource user, thereby reducing resources.
  • the number of times the user makes API calls brings convenience to resource users.
  • the processor 140 is further configured to:
  • the format of the access code of the first resource is the first format
  • the access codes of the resources provided by the resource owners may have multiple different formats, which brings inconvenience to the resource users in resolving the access codes of the resources.
  • the resource gateway converts the format of the access code of the first resource returned by the resource owner into the first predetermined format, thereby unifying the format of the access code of the resource, and realizing that the resource user can be different.
  • the resource owner obtains the access code of the resource with the same format, thereby facilitating the technical effect of the resource user analyzing the access code of the resource.
  • the processor 140 is further configured to:
  • the method After obtaining the authorization code of the first resource from the resource owner of the first resource according to the first request, according to the authorization code of the first resource provided by the resource owner, and from the resource of the first resource through the second network interface 120 The method obtains a refresh code of the first resource, and returns a refresh code of the first resource to the resource user through the first network interface 110.
  • the access of the first resource may have an expiration date (for example: 24 hours, or 48 hours, etc.), so that the resource user must access the resource owner based on the access code of the first resource during the validity period. And use the first resource. If the access code of the first resource exceeds the validity period, the access code of the first resource needs to be refreshed according to the refresh code of the first resource to obtain an access code of the first resource after the refresh.
  • an expiration date for example: 24 hours, or 48 hours, etc.
  • the resource gateway when the resource gateway receives the access code of the first resource returned by the resource owner, the resource gateway also receives the refresh code of the first resource provided by the resource owner, and the resource gateway will use the first resource.
  • the refresh code is sent to the resource user along with the access code of the first resource, thereby implementing the technical effect that the resource user can refresh the access code of the first resource according to the refresh code of the first resource.
  • the processor 140 is further configured to:
  • the format of the refresh code of the first resource is the second format
  • converting the format of the refresh code of the first resource by the second format Is a second predetermined format, wherein the second format is any format different from the second predetermined format.
  • the refresh code of the resources provided by each resource owner may have multiple types. The same format, which brings inconvenience to the resource user in resolving the refresh code of the resource.
  • the resource gateway converts the format of the refresh code of the first resource returned by the resource owner into a second predetermined format, thereby unifying the format of the refresh code of the first resource, thereby realizing that the resource user can
  • the refresh code of the first resource with the same format is obtained from different resource owners, thereby facilitating the technical effect of the resource user analyzing the refresh code of the first resource.
  • the processor 140 is further configured to:
  • the fourth request After returning the refresh code of the first resource to the resource user through the first network interface 110, receiving a fourth request sent by the resource user for requesting to refresh the access code of the first resource, where the fourth request is a resource user And generating, according to the refresh code of the first resource, and the fourth API provided by the resource gateway, where the fourth request includes a refresh code of the first resource; after determining that the resource owner supports updating the access code of the first resource, And requesting, by using the second network interface 120, the access code of the refreshed first resource from the resource owner; and returning, by the first network interface 110, the updated access code of the first resource to the resource user.
  • the resource gateway further opens its fourth API to the resource user, and the fourth API is used to control the resource gateway to refresh the access code of the first resource, thereby realizing that the resource user can rely on the first resource.
  • the technical effect of refreshing the access code of the first resource by the refresh code is used to control the resource gateway to refresh the access code of the first resource, thereby realizing that the resource user can rely on the first resource.
  • the processor 140 is further configured to:
  • the processor 140 is further configured to:
  • the format of the refresh code of the first resource is determined by The second predetermined format is converted to the second format.
  • the format of the refresh code of the first resource that the resource owner can identify is the second format
  • the format of the refresh code of the first resource of the resource gateway is converted from the second predetermined format to the second format. And generating, according to the refresh code of the first resource and the fifth API provided by the resource owner of the first resource, a fifth request for requesting to refresh the access code of the first resource.
  • the present application provides a resource access authorization method, as shown in FIG. 2, including:
  • Step 101 The resource gateway receives a first request for requesting to acquire an access code of the first resource, where the first request is generated by the resource user according to the first API provided by the resource gateway.
  • Step 102 The resource gateway acquires an authorization code of the first resource from a resource owner of the first resource according to the first request.
  • Step 103a The resource gateway acquires an access code of the first resource from a resource owner of the first resource according to an authorization code of the first resource provided by the resource owner.
  • Step 104b The resource gateway returns the access code of the first resource to the resource user.
  • step 102 includes:
  • Step 201 The resource gateway generates a second request for requesting to acquire an authorization code of the first resource according to the first request and the second API provided by the resource owner of the first resource.
  • Step 202 The resource gateway sends the second request to the resource owner.
  • Step 203 The resource gateway receives an authorization code of the first resource returned by the resource owner.
  • step 103a includes:
  • Step 301 The resource gateway generates a third request for requesting to acquire an access code of the first resource according to the authorization code of the first resource and the third API provided by the resource owner of the first resource, where the third request includes The authorization code of the first resource;
  • Step 302 The resource gateway sends the third request to the resource owner.
  • Step 303 The resource gateway receives an access code of the first resource returned by the resource owner.
  • the method before step 104a, the method further includes:
  • the resource gateway converts the format of the access code of the first resource from the first format to the first predetermined format, where the first format is different from the first predetermined format. Any format.
  • the method further includes:
  • Step 103b The resource gateway acquires a refresh code of the first resource from the resource owner of the first resource according to the authorization code of the first resource provided by the resource owner.
  • Step 104b The resource gateway returns the refresh code of the first resource to the resource user.
  • the method before step 104b, the method further includes:
  • the resource gateway converts the format of the refresh code of the first resource from the second format to the second predetermined format, where the second format is different from the second predetermined format. Any format.
  • the method further includes:
  • Step 105 The resource gateway receives a fourth request sent by the resource user for requesting to refresh the access code of the first resource, where the fourth request is a refresh code of the resource resource according to the first resource, and a fourth API provided by the resource gateway. The generated, wherein the fourth request includes a refresh code of the first resource;
  • Step 106 After the resource gateway determines that the resource owner supports the refreshing of the access code of the first resource, the resource gateway acquires the access code of the refreshed first resource from the resource owner according to the fourth request.
  • Step 107 The resource gateway returns the refreshed access code of the first resource to the resource user.
  • step 106 includes:
  • Step 401 The resource gateway generates a fifth request for requesting to refresh the access code of the first resource according to the refresh code of the first resource and the fifth API provided by the resource owner of the first resource, where the fifth request includes The refresh code of the first resource;
  • Step 402 The resource gateway sends the fifth request to the resource owner.
  • Step 403 The resource gateway receives the access code of the refreshed first resource returned by the resource owner.
  • the method before step 401, the method further includes:
  • the resource gateway converts the format of the refresh code of the first resource from the second predetermined format to the second format.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can 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.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Signal Processing (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

一种资源网关,包括:第一网络接口、以及第二网络接口;存储器,用于存储程序代码;处理器,与存储器、第一网络接口、以及第二网络接口连接,用于读取存储器中的程序代码,执行:通过第一网络接口接收资源使用者发来的用于请求获取第一资源的访问码的第一请求,第一请求是资源使用者根据资源网关提供的第一API生成的;根据第一请求,并通过第二网络接口从第一资源的资源拥有者获取第一资源的授权码;根据资源拥有者提供的第一资源的授权码,并通过第二网络接口从第一资源的资源拥有者获取第一资源的访问码;通过第一网络接口将第一资源的访问码返回给资源使用者。同时,本发明还公开了一种资源访问授权方法。

Description

一种资源网关、及资源访问授权方法 技术领域
本发明涉及网络技术领域,尤其涉及一种资源网关、及资源访问授权方法。
背景技术
现今,很多资源拥有者都将自身的资源对外开放,以提供给资源使用者使用。例如,作为资源拥有者的社交类应用程序(例如:微博)将自身的特定API(Application Programming Interface,应用程序编程接口)对外开放,以使作为资源使用者的其他应用程序能够调用该特定API,从而通过社交类应用程序来发布信息。
出于信息安全的考虑,很多资源拥有者都基于OAUTH协议,在确认资源使用者为合法用户后,向资源使用者提供资源的访问码,以使资源使用者能够基于该访问码使用资源拥有者提供的资源。
在资源使用者基于OAUTH协议从资源拥有者获取资源的访问码时,资源使用者需要对资源拥有者进行两次API调用(第一次调用用于获取资源的授权码的API,第二次调用用于获取资源的访问码的API),这给资源使用者带来了不便。
发明内容
本申请实施例通过提供一种资源网关、及资源访问授权方法,解决了现有技术中资源使用者在获取资源的访问码时,需要进行两次API调用的技术问题。
第一方面,提供了一种资源网关,包括:
第一网络接口、以及第二网络接口;
存储器,用于存储程序代码;
处理器,与所述存储器、所述第一网络接口、以及所述第二网络接口连接,用于读取所述存储器中的所述程序代码,执行:
通过所述第一网络接口接收资源使用者发来的用于请求获取第一资源的访问码的第一请求,所述第一请求是所述资源使用者根据所述资源网关提供的第一API生成的;根据所述第一请求,并通过所述第二网络接口从所述第一资源的资源拥有者获取所述第一资源的授权码;根据所述资源拥有者提供的所述第一资源的授权码,并通过所述第二网络接口从所述第一资源的资源拥有者获取所述第一资源的访问码;通过所述第一网络接口将所述第一资源的访问码返回给所述资源使用者。
结合第一方面,在第一方面的第一种可能的实施方式中,所述处理器,还用于:
根据所述第一请求、以及所述第一资源的资源拥有者提供的第二API,生成用于请求获取所述第一资源的授权码的第二请求;通过所述第二网络接口将所述第二请求发送给所述资源拥有者;通过所述第二网络接口接收所述资源拥有者返回的所述第一资源的授权码。
结合第一方面、或第一方面的第一种可能的实施方式,在第一方面的第二种可能的实施方式中,所述处理器,还用于:
根据所述第一资源的授权码、以及所述第一资源的资源拥有者提供的第三API,生成用于请求获取所述第一资源的访问码的第三请求,其中,所述第三请求中包含所述第一资源的授权码;通过所述第二网络接口将所述第三请求发送给所述资源拥有者;通过所述第二网络接口接收所述资源拥有者返回的所述第一资源的访问码。
结合第一方面、或第一方面的第一种可能的实施方式、或第一方面的第二种可能的实施方式,在第一方面的第三种可能的实施方式中,所述处理器,还用于:
在所述通过所述第一网络接口将所述第一资源的访问码返回给所述资源使用者之前,在所述第一资源的访问码的格式为第一格式时,将所述第一资源的访问码的格式由所述第一格式转换为第一预定格式,其中,所述第一格式为与所述第一预定格式不同的任一格式。
结合第一方面、或第一方面的第一种可能的实施方式、或第一方面的第二种可能的实施方式、或第一方面的第三种可能的实施方式,在第一方面的第四种可能的实施方式中,所述处理器,还用于:
在所述根据所述第一请求,从所述第一资源的资源拥有者获取所述第一资源的授权码之后,根据所述资源拥有者提供的所述第一资源的授权码,并通过所述第二网络接口从所述第一资源的资源拥有者获取所述第一资源的刷新码;通过所述第一网络接口将所述第一资源的刷新码返回给所述资源使用者。
结合一方面的第四种可能的实施方式,在第一方面的第五种可能的实施方式中,所述处理器,还用于:
在所述通过所述第一网络接口将所述第一资源的刷新码返回给所述资源使用者之前,在所述第一资源的刷新码的格式为第二格式时,将所述第一资源的刷新码的格式由所述第二格式转换为第二预定格式,其中,所述第二格式为与所述第二预定格式不同的任一格式。
结合第一方面的第四种可能的实施方式、或第一方面的第五种可能的实施方式,在第一方面的第六种可能的实施方式中,所述处理器,还用于:
在所述通过所述第一网络接口将所述第一资源的刷新码返回给所述资源使用者之后,接收所述资源使用者发来的用于请求刷新第一资源的访问码的第四请求,所述第四请求是所述资源使用者根据所述第一资源的刷新码、以及所述资源网关提供的第四API生成的,其中,所述第四请求中包含所述第一资源的刷新码;在确定所述资源拥有者支持刷新第一资源的访问码后,根据所述第四请求,并通过所述第二网络接口从所述资源拥有者获取刷新后的第一资源的访问码;通过所述第一网络接口将所述刷新后的第一资源的访问码返回给所述资源使用者。
结合第一方面的第六种可能的实施方式,在第一方面的第七种可能的实施方式中,所述处理器,还用于:
根据所述第一资源的刷新码、以及所述第一资源的资源拥有者提供的第五API,生成用于请求刷新所述第一资源的访问码的第五请求,其中,所述第五请求中包含所述第一资源的刷新码;通过所述第二网络接口将所述第五请求发送给所述资源拥有者;通过所述第二网络接口接收所述资源拥有者返回的刷新后的所述第一资源的访问码。
结合第一方面的第七种可能的实施方式,在第一方面的第八种可能的实施方式中,所述处理器,还用于:
在所述根据所述第一资源的刷新码、以及所述第一资源的资源拥有者提供的第五API,生成用于请求刷新所述第一资源的访问码的第五请求之前,将所述第一资源的刷新码的格式由所述第二预定格式转换为所述第二格式。
基于同一发明构思,第二方面,提供了一种资源访问授权方法,包括:
资源网关接收资源使用者发来的用于请求获取第一资源的访问码的第一请求,所述第一请求是所述资源使用者根据所述资源网关提供的第一API生成的;
所述资源网关根据所述第一请求,从所述第一资源的资源拥有者获取所述第一资源的授权码;
所述资源网关根据所述资源拥有者提供的所述第一资源的授权码,从所述第一资源的资源拥有者获取所述第一资源的访问码;
所述资源网关将所述第一资源的访问码返回给所述资源使用者。
结合第二方面,在第二方面的第一种可能的实施方式中,所述资源网关根据所述第一请求,从所述第一资源的资源拥有者获取所述第一资源的授权码,包括:
所述资源网关根据所述第一请求、以及所述第一资源的资源拥有者提供的第二API,生成用于请求获取所述第一资源的授权码的第二请求;
所述资源网关将所述第二请求发送给所述资源拥有者;
所述资源网关接收所述资源拥有者返回的所述第一资源的授权码。
结合第二方面、或第二方面的第一种可能的实施方式,在第二方面的第二种可能的实施方式中,所述资源网关根据所述资源拥有者提供的所述第一资源的授权码,从所述第一资源的资源拥有者获取所述第一资源的访问码,包括:
所述资源网关根据所述第一资源的授权码、以及所述第一资源的资源拥有者提供的第三API,生成用于请求获取所述第一资源的访问码的第三请求,其中,所述第三请求中包含所述第一资源的授权码;
所述资源网关将所述第三请求发送给所述资源拥有者;
所述资源网关接收所述资源拥有者返回的所述第一资源的访问码。
结合第二方面、或第二方面的第一种可能的实施方式、或第二方面的第二种可能的实施方式,在第二方面的第三种可能的实施方式中,在所述资源 网关将所述第一资源的访问码返回给所述资源使用者之前,所述方法还包括:
在所述第一资源的访问码的格式为第一格式时,所述资源网关将所述第一资源的访问码的格式由所述第一格式转换为第一预定格式,其中,所述第一格式为与所述第一预定格式不同的任一格式。
结合第二方面、或第二方面的第一种可能的实施方式、或第二方面的第二种可能的实施方式、或第二方面的第三种可能的实施方式,在第二方面的第四种可能的实施方式中,在所述资源网关根据所述第一请求,从所述第一资源的资源拥有者获取所述第一资源的授权码之后,所述方法还包括:
所述资源网关根据所述资源拥有者提供的所述第一资源的授权码,从所述第一资源的资源拥有者获取所述第一资源的刷新码;
所述资源网关将所述第一资源的刷新码返回给所述资源使用者。
结合二方面的第四种可能的实施方式,在第二方面的第五种可能的实施方式中,在所述资源网关将所述第一资源的刷新码返回给所述资源使用者之前,所述方法还包括:
在所述第一资源的刷新码的格式为第二格式时,所述资源网关将所述第一资源的刷新码的格式由所述第二格式转换为第二预定格式,其中,所述第二格式为与所述第二预定格式不同的任一格式。
结合第二方面的第四种可能的实施方式、或第二方面的第五种可能的实施方式,在第二方面的第六种可能的实施方式中,在所述资源网关将所述第一资源的刷新码返回给所述资源使用者之后,所述方法还包括:
所述资源网关接收所述资源使用者发来的用于请求刷新第一资源的访问码的第四请求,所述第四请求是所述资源使用者根据所述第一资源的刷新码、以及所述资源网关提供的第四API生成的,其中,所述第四请求中包含所述第一资源的刷新码;
在所述资源网关确定所述资源拥有者支持刷新第一资源的访问码后,所述资源网关根据所述第四请求,从所述资源拥有者获取刷新后的第一资源的访问码;
所述资源网关将所述刷新后的第一资源的访问码返回给所述资源使用者。
结合第二方面的第六种可能的实施方式,在第二方面的第七种可能的实施方式中,所述资源网关根据所述第四请求,从所述第一资源的资源拥有者获取刷新后的第一资源的访问码,包括:
所述资源网关根据所述第一资源的刷新码、以及所述第一资源的资源拥有者提供的第五API,生成用于请求刷新所述第一资源的访问码的第五请求,其中,所述第五请求中包含所述第一资源的刷新码;
所述资源网关将所述第五请求发送给所述资源拥有者;
所述资源网关接收所述资源拥有者返回的刷新后的所述第一资源的访问码。
结合第二方面的第七种可能的实施方式,在第二方面的第八种可能的实施方式中,在所述资源网关根据所述第一资源的刷新码、以及所述第一资源的资源拥有者提供的第五API,生成用于请求刷新所述第一资源的访问码的第五请求之前,所述方法还包括:
所述资源网关将所述第一资源的刷新码的格式由所述第二预定格式转换为所述第二格式。
本申请实施例中技术方案的有益效果如下:
本申请实施例中,公开了一种资源网关,包括:第一网络接口、以及第二网络接口;存储器,用于存储程序代码;处理器,与存储器、第一网络接口、以及第二网络接口连接,用于读取存储器中的程序代码,执行:通过第一网络接口接收资源使用者发来的用于请求获取第一资源的访问码的第一请求,第一请求是资源使用者根据资源网关提供的第一API生成的;根据第一请求,并通过第二网络接口从第一资源的资源拥有者获取第一资源的授权码;根据资源拥有者提供的第一资源的授权码,并通过第二网络接口从第一资源的资源拥有者获取第一资源的访问码;通过第一网络接口将第一资源的访问码返回给资源使用者。由于,资源网关将其第一API开放给资源使用者,资源使用者在需要获取第一资源的访问码时,只需基于第一API生成第一请求并发送给资源网关(即:只进行了一次API调用),便实现了获取第一资源的访问码。所以,有效解决了现有技术中资源使用者在获取资源的访问码时,需要进行两次API调用的技术问题,实现了资源使用者只需针对资源网 关进行一次API调用,就可以通过资源网关获取资源的访问码,从而减少了资源使用者进行API调用的次数,给资源使用者带来了便利的技术效果。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例中资源网关的结构示意图;
图2~图7为本申请实施例中资源访问授权方法的流程图。
具体实施方式
本申请实施例通过提供一种资源网关、及资源访问授权方法,解决了现有技术中资源使用者在获取资源的访问码时,需要对资源拥有者进行两次API调用的技术问题。
本申请实施例的技术方案为解决上述技术问题,总体思路如下:
一种资源网关,包括:第一网络接口、以及第二网络接口;存储器,用于存储程序代码;处理器,与存储器、第一网络接口、以及第二网络接口连接,用于读取存储器中的程序代码,执行:通过第一网络接口接收资源使用者发来的用于请求获取第一资源的访问码的第一请求,第一请求是资源使用者根据资源网关提供的第一API生成的;根据第一请求,并通过第二网络接口从第一资源的资源拥有者获取第一资源的授权码;根据资源拥有者提供的第一资源的授权码,并通过第二网络接口从第一资源的资源拥有者获取第一资源的访问码;通过第一网络接口将第一资源的访问码返回给资源使用者。
由于,资源网关将其第一API开放给资源使用者,资源使用者在需要获取第一资源的访问码时,只需基于第一API生成第一请求并发送给资源网关(即:只进行了一次API调用),便实现了获取第一资源的访问码。所以,有效解决了现有技术中资源使用者在获取资源的访问码时,需要进行两次API调用的技术问题,实现了资源使用者只需针对资源网关进行一次API调用,就可以通过资源网关获取资源的访问码,从而减少了资源使用者进行API调用的次数,给资源使用者带来了便利的技术效果。
为使本申请一实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
首先说明,本文中出现的术语“第一资源”或“资源”,是指能够实现某一特定业务的特定API,在该特定API被调用时,提供该特定API的应用程序能够实现该特定业务。
其次说明,本文中出现的术语“资源拥有者”,是指能够提供该特定API的应用程序,例如:社交类应用程序、购物类应用程序等等,对于资源拥有者具体是何种应用程序,本申请实施例不做具体限制。
再次说明,本文中出现的术语“资源使用者”,是指调用该特定API的其他应用程序。
实施例一
如图1所示,本实施例提供一种资源网关,包括:
第一网络接口110、以及第二网络接口120;
存储器130,用于存储程序代码;
一个或多个处理器140,与存储器130、第一网络接口110、以及第二网络接口120连接,用于读取存储器130中的程序代码,执行:
通过第一网络接口110接收资源使用者发来的用于请求获取第一资源的访问码的第一请求,第一请求是资源使用者根据资源网关提供的第一API生成的;根据第一请求,并通过第二网络接口120从第一资源的资源拥有者获取第一资源的授权码;根据资源拥有者提供的第一资源的授权码,并通过第二网络接口120从第一资源的资源拥有者获取第一资源的访问码;通过第一网络接口110将第一资源的访问码返回给资源使用者。
在具体实施过程中,第一资源为资源拥有者为资源使用者提供的,且能够实现某一特定业务的特定API。资源使用者可以调用该特定API,从而通过资源拥有者实现该特定业务。例如,在资源拥有者为微博类应用程序时,第一资源可以是通过微博类应用程序进行信息发布的API。
在本实施例中,由于资源网关将其第一API开放给资源使用者,资源使 用者在需要获取第一资源的访问码时,只需基于第一API生成第一请求并发送给资源网关(即:只进行了一次API调用),便实现了获取第一资源的访问码。所以,有效解决了现有技术中资源使用者在获取资源的访问码时,需要进行两次API调用的技术问题,实现了资源使用者只需针对资源网关进行一次API调用,就可以通过该资源网关获取资源的访问码,从而减少了资源使用者进行API调用的次数,给资源使用者带来了便利的技术效果。
在具体实施过程中,资源网关可以通过第一网络接口与多个资源使用者连接,通过第二网络接口与多个资源拥有者连接。且,在资源拥有者发送的第一请求中应包含第一资源的资源拥有者的标签,此时,处理器140还用于:通过该标签,确定第一资源的资源拥有者,从而从该资源拥有者处获取第一资源的访问码。
对于资源使用者来讲,在现有技术中,一个资源使用者需要对接多个资源拥有者,以获取不同的资源拥有者提供的不同的资源,但这给资源使用者带来了大量的接口维护工作。而,在本实施例中,资源使用者只需和资源网关对接即可,实现了减少资源使用者的接口维护工作,降低接入难度,同时降低对接风险的技术效果。
对于资源拥有者来讲,在现有技术中,一个资源拥有者需要对接多个资源使用者,以向不同的资源使用者提供资源,但这给资源拥有者带来了大量的接口维护工作。而,在本实施例中,资源拥有者只需和资源网关对接即可,实现了减少资源拥有者的接口维护工作,同时降低对接风险的技术效果。
在具体实施过程中,不同的资源拥者在向资源使用者提供资源的访问码时,所遵循协议可能不同(例如:有些资源拥有者遵循OAUTH 1.0协议,而有些资源拥有者遵循OAUTH 2.0协议)。所以,在存储器130中还存储有不同的资源拥有者分别遵循的协议,此时,处理器140还用于:在收到资源使用者发来的第一请求后,基于第一请求中的资源拥有者的标签,从存储器130中获取该资源拥有者遵循的协议,并基于该协议,从该资源拥有者处获取资源的访问码。
在本实施例中,资源使用者在获取资源的访问码时,只需基于资源网关所提供的第一API,向资源网关放发送第一请求即可,不需要资源使用者了解不同资源拥有者所遵循的协议,给资源使用者带来了便利。
可选地,在本实施例中,处理器140,还用于:
根据第一请求、以及第一资源的资源拥有者提供的第二API,生成用于请求获取第一资源的授权码的第二请求;通过第二网络接口120将第二请求发送给资源拥有者;通过第二网络接口120接收资源拥有者返回的第一资源的授权码。
在具体实施过程中,资源拥有者在接收到第二请求后,会向资源使用者获取一认证信息(例如:用户名称、以及对应的用户密码),并验证该认证信息是否与资源拥有者存储的认证信息一致,若一致,则确定资源使用者为合法用户,并向资源网关返回第一资源的授权码。
可选地,在本实施例中,处理器140,还用于:
根据第一资源的授权码、以及第一资源的资源拥有者提供的第三API,生成用于请求获取第一资源的访问码的第三请求,其中,第三请求中包含第一资源的授权码;通过第二网络接口120将第三请求发送给资源拥有者;通过第二网络接口120接收资源拥有者返回的第一资源的访问码。
在现有技术中,资源使用者与资源拥有者直接进行通信,资源使用者首先要基于资源使用者提供的第二API,向资源拥有者发送用于获取第一资源的授权码的请求(即:进行第一次API调用),在资源使用者获取到第一资源的授权码后,资源使用者再基于第一资源的授权码、以及资源拥有者提供的第三API,向资源拥有者发送用于获取第一资源的访问码的请求(即:进行第二次API调用),从而获得第一资源的访问码。
而,在本实施例中,由资源网关基于资源拥有者提供的第二API,生成用于请求获取第一资源的授权码的第二请求(即:由资源网关进行调用第二API,以获取第一资源的授权码),在资源网关获取到第一资源的授权码后,资源网关再基于第一资源的授权码、以及资源拥有者提供的第三API,向资源拥有者发送用于获取第一资源的访问码的请求(即:由资源网关进行调用第三API,以获取第一资源的访问码),并将获得的第一资源的访问码返回给资源使用者,进而减少了资源使用者进行API调用的次数,为资源使用者带来了便利。
可选地,在本实施例中,处理器140,还用于:
在通过第一网络接口110将第一资源的访问码返回给资源使用者之前, 在第一资源的访问码的格式为第一格式时,将第一资源的访问码的格式由第一格式转换为第一预定格式,其中,第一格式为与第一预定格式不同的任一格式。
在现有技术中,各个资源拥有者所提供的资源的访问码可能有多种不同的格式,这给资源使用者在解析资源的访问码时带来了不便利。而,在本实施例中,资源网关将资源拥有者返回的第一资源的访问码的格式转化为第一预定格式,从而统一了资源的访问码的格式,实现了资源使用者可以从不同的资源拥有者获得格式一致的资源的访问码,从而方便了资源使用者对资源的访问码进行解析的技术效果。
可选地,在本实施例中,处理器140,还用于:
在根据第一请求,从第一资源的资源拥有者获取第一资源的授权码之后,根据资源拥有者提供的第一资源的授权码,并通过第二网络接口120从第一资源的资源拥有者获取第一资源的刷新码;通过第一网络接口110将第一资源的刷新码返回给资源使用者。
在具体实施过程中,第一资源的访问可能具有有效期(例如:24小时、或48小时等等),这就使得资源使用者必须在该有效期内,基于第一资源的访问码访问资源拥有者,并对第一资源进行使用。若第一资源的访问码超过了有效期,则需要根据第一资源的刷新码对第一资源的访问码进行刷新,以获得刷新后的第一资源的访问码。
在具体实施过程中,在资源网关接收资源拥有者返回的第一资源的访问码的同时,资源网关还会接收到资源拥有者提供的第一资源的刷新码,资源网关会将第一资源的刷新码连同第一资源的访问码一起发给了资源使用者,从而实现了资源使用者能够根据第一资源的刷新码对第一资源的访问码进行刷新的技术效果。
可选地,在本实施例中,处理器140,还用于:
在通过第一网络接口110将第一资源的刷新码返回给资源使用者之前,在第一资源的刷新码的格式为第二格式时,将第一资源的刷新码的格式由第二格式转换为第二预定格式,其中,第二格式为与第二预定格式不同的任一格式。
在现有技术中,各个资源拥有者所提供的资源的刷新码可能会有多种不 同的格式,这给资源使用者在解析资源的刷新码时带来了不便利。而,在本申请实施例中,资源网关将资源拥有者返回的第一资源的刷新码的格式转化为第二预定格式,从而统一了第一资源的刷新码的格式,实现了资源使用者可以从不同的资源拥有者获得格式一致的第一资源的刷新码,从而方便了资源使用者对第一资源的刷新码进行解析的技术效果。
可选地,在本实施例中,处理器140,还用于:
在通过第一网络接口110将第一资源的刷新码返回给资源使用者之后,接收资源使用者发来的用于请求刷新第一资源的访问码的第四请求,第四请求是资源使用者根据第一资源的刷新码、以及资源网关提供的第四API生成的,其中,第四请求中包含第一资源的刷新码;在确定资源拥有者支持刷新第一资源的访问码后,根据第四请求,并通过第二网络接口120从资源拥有者获取刷新后的第一资源的访问码;通过第一网络接口110将刷新后的第一资源的访问码返回给资源使用者。
在具体实施过程中,资源网关还将其第四API对资源使用者开放,第四API用于控制资源网关对第一资源的访问码进行刷新,从而实现了资源使用者能够凭借第一资源的刷新码对第一资源的访问码进行刷新的技术效果。
可选地,在本实施例中,处理器140,还用于:
根据第一资源的刷新码、以及第一资源的资源拥有者提供的第五API,生成用于请求刷新第一资源的访问码的第五请求,其中,第五请求中包含第一资源的刷新码;通过第二网络接口120将第五请求发送给资源拥有者;通过第二网络接口120接收资源拥有者返回的刷新后的第一资源的访问码。
可选地,在本实施例中,处理器140,还用于:
在根据第一资源的刷新码、以及第一资源的资源拥有者提供的第五API,生成用于请求刷新第一资源的访问码的第五请求之前,将第一资源的刷新码的格式由第二预定格式转换为第二格式。
在具体实施过程中,由于资源拥有者所能够识别的第一资源的刷新码的格式为第二格式,所以,资源网关先第一资源的刷新码的格式由第二预定格式转换为第二格式,再根据第一资源的刷新码、以及第一资源的资源拥有者提供的第五API,生成用于请求刷新第一资源的访问码的第五请求。
实施例二
基于同一发明构思,本申请提供一种资源访问授权方法,如图2所示,包括:
步骤101:资源网关接收资源使用者发来的用于请求获取第一资源的访问码的第一请求,第一请求是资源使用者根据资源网关提供的第一API生成的;
步骤102:资源网关根据第一请求,从第一资源的资源拥有者获取第一资源的授权码;
步骤103a:资源网关根据资源拥有者提供的第一资源的授权码,从第一资源的资源拥有者获取第一资源的访问码;
步骤104b:资源网关将第一资源的访问码返回给资源使用者。
可选地,在本实施例中,如图3所示,步骤102,包括:
步骤201:资源网关根据第一请求、以及第一资源的资源拥有者提供的第二API,生成用于请求获取第一资源的授权码的第二请求;
步骤202:资源网关将第二请求发送给资源拥有者;
步骤203:资源网关接收资源拥有者返回的第一资源的授权码。
可选地,在本实施例中,如图4所示,步骤103a,包括:
步骤301:资源网关根据第一资源的授权码、以及第一资源的资源拥有者提供的第三API,生成用于请求获取第一资源的访问码的第三请求,其中,第三请求中包含第一资源的授权码;
步骤302:资源网关将第三请求发送给资源拥有者;
步骤303:资源网关接收资源拥有者返回的第一资源的访问码。
可选地,在本实施例中,在步骤104a之前,该方法还包括:
在第一资源的访问码的格式为第一格式时,资源网关将第一资源的访问码的格式由第一格式转换为第一预定格式,其中,第一格式为与第一预定格式不同的任一格式。
可选地,在本实施例中,如图5所示,在步骤102之后,该方法还包括:
步骤103b:资源网关根据资源拥有者提供的第一资源的授权码,从第一资源的资源拥有者获取第一资源的刷新码;
步骤104b:资源网关将第一资源的刷新码返回给资源使用者。
可选地,在本实施例中,在步骤104b之前,该方法还包括:
在第一资源的刷新码的格式为第二格式时,资源网关将第一资源的刷新码的格式由第二格式转换为第二预定格式,其中,第二格式为与第二预定格式不同的任一格式。
可选地,在本实施例中,如图6所示,在步骤104b之后,该方法还包括:
步骤105:资源网关接收资源使用者发来的用于请求刷新第一资源的访问码的第四请求,第四请求是资源使用者根据第一资源的刷新码、以及资源网关提供的第四API生成的,其中,第四请求中包含第一资源的刷新码;
步骤106:在资源网关确定资源拥有者支持刷新第一资源的访问码后,资源网关根据第四请求,从资源拥有者获取刷新后的第一资源的访问码;
步骤107:资源网关将刷新后的第一资源的访问码返回给资源使用者。
可选地,在本实施例中,如图7所示,步骤106,包括:
步骤401:资源网关根据第一资源的刷新码、以及第一资源的资源拥有者提供的第五API,生成用于请求刷新第一资源的访问码的第五请求,其中,第五请求中包含第一资源的刷新码;
步骤402:资源网关将第五请求发送给资源拥有者;
步骤403:资源网关接收资源拥有者返回的刷新后的第一资源的访问码。
可选地,在本实施例中,在步骤401之前,该方法还包括:
资源网关将第一资源的刷新码的格式由第二预定格式转换为第二格式。
本领域内的技术人员应明白,本发明的实施例可提供为方法、***、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(***)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实 现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (18)

  1. 一种资源网关,其特征在于,包括:
    第一网络接口、以及第二网络接口;
    存储器,用于存储程序代码;
    处理器,与所述存储器、所述第一网络接口、以及所述第二网络接口连接,用于读取所述存储器中的所述程序代码,执行:
    通过所述第一网络接口接收资源使用者发来的用于请求获取第一资源的访问码的第一请求,所述第一请求是所述资源使用者根据所述资源网关提供的第一API生成的;根据所述第一请求,并通过所述第二网络接口从所述第一资源的资源拥有者获取所述第一资源的授权码;根据所述资源拥有者提供的所述第一资源的授权码,并通过所述第二网络接口从所述第一资源的资源拥有者获取所述第一资源的访问码;通过所述第一网络接口将所述第一资源的访问码返回给所述资源使用者。
  2. 如权利要求1所述的资源网关,其特征在于,所述处理器,还用于:
    根据所述第一请求、以及所述第一资源的资源拥有者提供的第二API,生成用于请求获取所述第一资源的授权码的第二请求;通过所述第二网络接口将所述第二请求发送给所述资源拥有者;通过所述第二网络接口接收所述资源拥有者返回的所述第一资源的授权码。
  3. 如权利要求1~2任一所述的资源网关,其特征在于,所述处理器,还用于:
    根据所述第一资源的授权码、以及所述第一资源的资源拥有者提供的第三API,生成用于请求获取所述第一资源的访问码的第三请求,其中,所述第三请求中包含所述第一资源的授权码;通过所述第二网络接口将所述第三请求发送给所述资源拥有者;通过所述第二网络接口接收所述资源拥有者返回的所述第一资源的访问码。
  4. 如权利要求1~3任一所述的资源网关,其特征在于,所述处理器,还用于:
    在所述通过所述第一网络接口将所述第一资源的访问码返回给所述资源使用者之前,在所述第一资源的访问码的格式为第一格式时,将所述第一资源的访问码的格式由所述第一格式转换为第一预定格式,其中,所述第一 格式为与所述第一预定格式不同的任一格式。
  5. 如权利要求1~4任一所述的资源网关,其特征在于,所述处理器,还用于:
    在所述根据所述第一请求,从所述第一资源的资源拥有者获取所述第一资源的授权码之后,根据所述资源拥有者提供的所述第一资源的授权码,并通过所述第二网络接口从所述第一资源的资源拥有者获取所述第一资源的刷新码;通过所述第一网络接口将所述第一资源的刷新码返回给所述资源使用者。
  6. 如权利要求5所述的资源网关,其特征在于,所述处理器,还用于:
    在所述通过所述第一网络接口将所述第一资源的刷新码返回给所述资源使用者之前,在所述第一资源的刷新码的格式为第二格式时,将所述第一资源的刷新码的格式由所述第二格式转换为第二预定格式,其中,所述第二格式为与所述第二预定格式不同的任一格式。
  7. 如权利要求5~6任一所述的资源网关,其特征在于,所述处理器,还用于:
    在所述通过所述第一网络接口将所述第一资源的刷新码返回给所述资源使用者之后,接收所述资源使用者发来的用于请求刷新第一资源的访问码的第四请求,所述第四请求是所述资源使用者根据所述第一资源的刷新码、以及所述资源网关提供的第四API生成的,其中,所述第四请求中包含所述第一资源的刷新码;在确定所述资源拥有者支持刷新第一资源的访问码后,根据所述第四请求,并通过所述第二网络接口从所述资源拥有者获取刷新后的第一资源的访问码;通过所述第一网络接口将所述刷新后的第一资源的访问码返回给所述资源使用者。
  8. 如权利要求7所述的资源网关,其特征在于,所述处理器,还用于:
    根据所述第一资源的刷新码、以及所述第一资源的资源拥有者提供的第五API,生成用于请求刷新所述第一资源的访问码的第五请求,其中,所述第五请求中包含所述第一资源的刷新码;通过所述第二网络接口将所述第五请求发送给所述资源拥有者;通过所述第二网络接口接收所述资源拥有者返回的刷新后的所述第一资源的访问码。
  9. 如权利要求8所述的资源网关,其特征在于,所述处理器,还用于:
    在所述根据所述第一资源的刷新码、以及所述第一资源的资源拥有者提供的第五API,生成用于请求刷新所述第一资源的访问码的第五请求之前,将所述第一资源的刷新码的格式由所述第二预定格式转换为所述第二格式。
  10. 一种资源访问授权方法,其特征在于,包括:
    资源网关接收资源使用者发来的用于请求获取第一资源的访问码的第一请求,所述第一请求是所述资源使用者根据所述资源网关提供的第一API生成的;
    所述资源网关根据所述第一请求,从所述第一资源的资源拥有者获取所述第一资源的授权码;
    所述资源网关根据所述资源拥有者提供的所述第一资源的授权码,从所述第一资源的资源拥有者获取所述第一资源的访问码;
    所述资源网关将所述第一资源的访问码返回给所述资源使用者。
  11. 如权利要求10所述的方法,其特征在于,所述资源网关根据所述第一请求,从所述第一资源的资源拥有者获取所述第一资源的授权码,包括:
    所述资源网关根据所述第一请求、以及所述第一资源的资源拥有者提供的第二API,生成用于请求获取所述第一资源的授权码的第二请求;
    所述资源网关将所述第二请求发送给所述资源拥有者;
    所述资源网关接收所述资源拥有者返回的所述第一资源的授权码。
  12. 如权利要求10~11任一所述的方法,其特征在于,所述资源网关根据所述资源拥有者提供的所述第一资源的授权码,从所述第一资源的资源拥有者获取所述第一资源的访问码,包括:
    所述资源网关根据所述第一资源的授权码、以及所述第一资源的资源拥有者提供的第三API,生成用于请求获取所述第一资源的访问码的第三请求,其中,所述第三请求中包含所述第一资源的授权码;
    所述资源网关将所述第三请求发送给所述资源拥有者;
    所述资源网关接收所述资源拥有者返回的所述第一资源的访问码。
  13. 如权利要求10~12任一所述的方法,其特征在于,在所述资源网关将所述第一资源的访问码返回给所述资源使用者之前,所述方法还包括:
    在所述第一资源的访问码的格式为第一格式时,所述资源网关将所述第一资源的访问码的格式由所述第一格式转换为第一预定格式,其中,所述第 一格式为与所述第一预定格式不同的任一格式。
  14. 如权利要求10~13任一所述的方法,其特征在于,在所述资源网关根据所述第一请求,从所述第一资源的资源拥有者获取所述第一资源的授权码之后,所述方法还包括:
    所述资源网关根据所述资源拥有者提供的所述第一资源的授权码,从所述第一资源的资源拥有者获取所述第一资源的刷新码;
    所述资源网关将所述第一资源的刷新码返回给所述资源使用者。
  15. 如权利要求14所述的方法,其特征在于,在所述资源网关将所述第一资源的刷新码返回给所述资源使用者之前,所述方法还包括:
    在所述第一资源的刷新码的格式为第二格式时,所述资源网关将所述第一资源的刷新码的格式由所述第二格式转换为第二预定格式,其中,所述第二格式为与所述第二预定格式不同的任一格式。
  16. 如权利要求14~15任一所述的方法,其特征在于,在所述资源网关将所述第一资源的刷新码返回给所述资源使用者之后,所述方法还包括:
    所述资源网关接收所述资源使用者发来的用于请求刷新第一资源的访问码的第四请求,所述第四请求是所述资源使用者根据所述第一资源的刷新码、以及所述资源网关提供的第四API生成的,其中,所述第四请求中包含所述第一资源的刷新码;
    在所述资源网关确定所述资源拥有者支持刷新第一资源的访问码后,所述资源网关根据所述第四请求,从所述资源拥有者获取刷新后的第一资源的访问码;
    所述资源网关将所述刷新后的第一资源的访问码返回给所述资源使用者。
  17. 如权利要求16所述的方法,其特征在于,所述资源网关根据所述第四请求,从所述第一资源的资源拥有者获取刷新后的第一资源的访问码,包括:
    所述资源网关根据所述第一资源的刷新码、以及所述第一资源的资源拥有者提供的第五API,生成用于请求刷新所述第一资源的访问码的第五请求,其中,所述第五请求中包含所述第一资源的刷新码;
    所述资源网关将所述第五请求发送给所述资源拥有者;
    所述资源网关接收所述资源拥有者返回的刷新后的所述第一资源的访问码。
  18. 如权利要求17所述的方法,其特征在于,在所述资源网关根据所述第一资源的刷新码、以及所述第一资源的资源拥有者提供的第五API,生成用于请求刷新所述第一资源的访问码的第五请求之前,所述方法还包括:
    所述资源网关将所述第一资源的刷新码的格式由所述第二预定格式转换为所述第二格式。
PCT/CN2014/091649 2013-12-25 2014-11-19 一种资源网关、及资源访问授权方法 WO2015096569A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310728568.0A CN103716317A (zh) 2013-12-25 2013-12-25 一种资源网关、及资源访问授权方法
CN201310728568.0 2013-12-25

Publications (1)

Publication Number Publication Date
WO2015096569A1 true WO2015096569A1 (zh) 2015-07-02

Family

ID=50408900

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/091649 WO2015096569A1 (zh) 2013-12-25 2014-11-19 一种资源网关、及资源访问授权方法

Country Status (2)

Country Link
CN (1) CN103716317A (zh)
WO (1) WO2015096569A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114915555A (zh) * 2022-04-27 2022-08-16 广州河东科技有限公司 网关驱动通信方法、装置、设备及存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103716317A (zh) * 2013-12-25 2014-04-09 华为技术有限公司 一种资源网关、及资源访问授权方法
CN110661817B (zh) * 2019-10-25 2022-08-26 新华三大数据技术有限公司 资源访问方法、装置及服务网关
CN111832055A (zh) * 2020-07-22 2020-10-27 政采云有限公司 权限校验***及方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102710640A (zh) * 2012-05-31 2012-10-03 中国联合网络通信集团有限公司 请求授权的方法、装置和***
CN103179099A (zh) * 2011-12-23 2013-06-26 北京新媒传信科技有限公司 一种接入开放网站平台的统一认证方法和一种网站平台
CN103716317A (zh) * 2013-12-25 2014-04-09 华为技术有限公司 一种资源网关、及资源访问授权方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103023933B (zh) * 2011-09-22 2015-09-16 北京尚良楷诚网络技术有限公司 一种登录信息集成处理***及方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103179099A (zh) * 2011-12-23 2013-06-26 北京新媒传信科技有限公司 一种接入开放网站平台的统一认证方法和一种网站平台
CN102710640A (zh) * 2012-05-31 2012-10-03 中国联合网络通信集团有限公司 请求授权的方法、装置和***
CN103716317A (zh) * 2013-12-25 2014-04-09 华为技术有限公司 一种资源网关、及资源访问授权方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114915555A (zh) * 2022-04-27 2022-08-16 广州河东科技有限公司 网关驱动通信方法、装置、设备及存储介质
CN114915555B (zh) * 2022-04-27 2024-03-12 广州河东科技有限公司 网关驱动通信方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN103716317A (zh) 2014-04-09

Similar Documents

Publication Publication Date Title
TWI688253B (zh) 授權方法、請求授權的方法及裝置
TWI679550B (zh) 帳號登入方法及裝置
EP3103238B1 (en) Mobile cloud service architecture
JP6600156B2 (ja) 動的な提示およびデータの構成を使用するセキュリティ保護されたモバイル共同アプリケーションを構築するためのプラットフォーム
TWI692990B (zh) 智能設備的綁定方法、裝置和系統、通訊系統
WO2018068631A1 (zh) 账户登录方法、设备和服务器
WO2016074574A1 (zh) 一种二维码扫码交互方法和装置
WO2016107466A1 (zh) 一种标识用户身份的方法及装置
US9299075B2 (en) Method and system for activating a software application while provisioning services for the application
US10162952B2 (en) Security model for network information service
US9342667B2 (en) Extended OAuth architecture
CN111047321A (zh) 业务处理方法及装置、电子设备、存储介质
WO2015096569A1 (zh) 一种资源网关、及资源访问授权方法
EP3272093B1 (en) Method and system for anti-phishing using smart images
WO2015101320A1 (zh) 一种账号的生成方法、终端及后台服务器
JP2016533595A (ja) クライアントのダウンロード及びインストール方法及び装置
CN110717171B (zh) 用于状态保存和重用的访问令牌管理
AU2014357362A1 (en) Multi-factor authentication system and method
EP2901660A1 (en) Termininal interaction methods and related devices and systems
WO2016127791A1 (zh) 链接处理方法、装置和***
JP6929883B2 (ja) データ伝送方法、データ送信機、データ受信機、及びシステム
CN111178840A (zh) 业务处理方法及装置、***、电子设备、存储介质
US11206699B2 (en) Registering network devices using known host devices
CN111598544B (zh) 用于处理信息的方法和装置
US20120101829A1 (en) Wholesale device registration system, method, and program product

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14875667

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14875667

Country of ref document: EP

Kind code of ref document: A1