当前位置:网站首页>Chapter IX rest Service Security
Chapter IX rest Service Security
2022-07-28 12:51:00 【yaoxin521123】
List of articles
Chapter nine REST Service security
If REST The service is accessing confidential data , You should use authentication for services . If you need to provide different levels of access for different users , Also specify the permissions required by the endpoint .
by REST Service settings authentication
It can be done to IRIS REST The service uses any of the following forms of authentication :
HTTPAuthentication header — This is aRESTThe recommended form of authentication for the service .WebSession authentication — The user name and password are URL Specify after the question mark in .OAuth 2.0Authentication - Please refer to the following sections .
REST Applications and OAuth 2.0
To pass the OAuth 2.0 Yes REST Application for authentication , Please do all the following :
- Will include
RESTThe resource server of the application is configured asOAuth 2.0Resource server . - Allow for
%Service.CSPDelegate authentication . - Ensure that
WebApplications ( be used forRESTApplications ) Configured to use delegated authentication . - stay
%SYSCreate a namespace namedZAUTHENTICATERoutine for . A sample routine is providedREST.ZAUTHENTICATE.mac, You can copy and modify it . This routine is GitHub (https://github.com/intersystems/Samples-Security) On Samples-Security Part of the example . May, in accordance with the “ Download for IRIS An example of ” Download the entire example according to the instructions in , But inGitHubIt may be more convenient to open a routine on and copy its contents .
In routine , modify applicationName And make other changes as needed .
Specify the use of REST Permissions required by the service
To specify the permissions required to execute code or access data , Technology uses role-based access control (RBAC).
If you need to provide different levels of access for different users , Please do the following to specify permissions :
- Modify the specification class to specify the use
RESTService orRESTPermissions required for a specific endpoint in the service ; Then recompile . Permissions are permissions combined with resource names ( For example, read or write ). - Use the management portal :
- Define the resources referenced in the specification class .
- Define roles that provide permission sets . for example , Roles can provide read access to endpoints or write access to different endpoints . A role can contain multiple groups of permissions .
- Place users in all roles required for their tasks .
Besides , have access to %CSP.REST Class SECURITYRESOURCE Parameters to execute authorization .
Specify permissions
It can be for the whole REST Service specified permission list , You can also specify a permission list for each endpoint . So :
- To specify the permissions required to access the service , Please edit
OpenAPI XDatablock . aboutinfoobject , Add a namex-ISC_RequiredResourceNew properties of , Its value is a comma separated list of defined resources and their access patterns (resource:mode), This is a visitRESTNecessary for any endpoint of the service .
An example is shown below :
"swagger":"2.0",
"info":{
"version":"1.0.0",
"title":"Swagger Petstore",
"description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification",
"termsOfService":"http://swagger.io/terms/",
"x-ISC_RequiredResource":["resource1:read","resource2:read","resource3:read"],
"contact":{
"name":"Swagger API Team"
},
...
- To specify the permissions required to access a specific endpoint , Please put
x-ISC_RequiredResourceProperty is added to the operand that defines the endpoint , As shown in the following example :
"post":{
"description":"Creates a new pet in the store. Duplicates are allowed",
"operationId":"addPet",
"x-ISC_RequiredResource":["resource1:read","resource2:read","resource3:read"],
"produces":[
"application/json"
],
...
- Compile the specification class . This operation regenerates the scheduling class .
Use SECURITYRESOURC Parameters
As an additional authorization tool , Assignment %CSP.REST Subclass's class has SECURITYRESOURCE Parameters . SECURITYRESOURCE The value of is either the resource and its permissions , Or just resources ( under these circumstances , The relevant permission is to use ). The system checks whether the user is right with SECURITYRESOURCE The associated resource has the required permissions .
Be careful : If the scheduling class is SECURITYRESOURCE Specified a value , also CSPSystem The user does not have sufficient permissions , Then this may cause unexpected... When the login attempt fails HTTP Error code . To prevent this from happening , It is recommended that you grant permission to the specified resource CSPSystem user .
边栏推荐
- MarkDown简明语法手册
- Baidu map API adds information window circularly. The window only opens at the last window position and the window information content is the same solution
- leetcode:704二分查找
- Linear classifier (ccf20200901)
- 【Base】优化性能到底在优化啥?
- 新零售电商O2O模式解析
- SuperMap game engine license module division
- 单调栈Monotonic Stack
- Application and download of dart 3D radiative transfer model
- GMT installation and use
猜你喜欢

Leetcode 1518. wine change

Leetcode 42. rainwater connection

30 years of open source community | 2022 open atom global open source summit 30 years of special activities of open source community were successfully held

Introduction to resttemplate

一台电脑上 多个项目公用一个 公私钥对拉取gerrit服务器代码

03 pyechars 直角坐标系图表(示例代码+效果图)

Markdown concise grammar manual

MMA8452Q几种模式的初始化实例

SuperMap iclient3d for webgl to realize floating thermal map

LeetCode84 柱状图中最大的矩形
随机推荐
Fastjson parses multi-level JSON strings
Four authentic postures after suffering and trauma, Zizek
遭受痛苦和创伤后的四种本真姿态 齐泽克
洪九果品通过聆讯:5个月经营利润9亿 阿里与中国农垦是股东
苏黎世联邦理工学院 | 具有可变形注意Transformer 的基于参考的图像超分辨率(ECCV2022))
金山云冲刺港股拟双重主要上市:年营收90亿 为雷军力挺项目
LeetCode84 柱状图中最大的矩形
[cute new problem solving] climb stairs
第九章 REST 服务安全
HC-05蓝牙模块调试从模式和主模式经历
VS1003 debugging routine
LeetCode94. 二叉树的中序遍历
[half understood] zero value copy
30 years of open source community | 2022 open atom global open source summit 30 years of special activities of open source community were successfully held
Multi Chain and multi currency wallet system development cross chain technology
Distributed session solution
Pits encountered in MSP430 development (to be continued)
01 pyechars 特性、版本、安装介绍
上位机和三菱FN2x通信实例
MySQL limit paging optimization