swagger

ASP.NET Core3.1使用Identity Server4建立Authorization Server-2

↘锁芯ラ 提交于 2020-08-11 09:44:18
前言 建立Web Api项目 在同一个解决方案下建立一个Web Api项目 IdentityServer4.WebApi ,然后修改Web Api的launchSettings.json。参考第一节,当然可以不修改的,端口号为 5001 。 { "profiles": { "IdentityServer4.WebApi": { "commandName": "Project", "launchBrowser": true, "launchUrl": "weatherforecast", "applicationUrl": "http://localhost:5001", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } } } } 添加Swagger帮助页面 官方文档: https://docs.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger?tabs=visual-studio&view=aspnetcore-3.1 在 Startup.ConfigureServices 方法中将Swagger生成器添加到服务集合: public void ConfigureServices

Apache Dubbo 被曝出“高危”远程代码执行漏洞

自古美人都是妖i 提交于 2020-08-11 07:44:35
击上方“朱小厮的博客”,选择“ 设为星标” 后台回复" 加群 ",加入组织 来源:22j.co/brUT 0x01 漏洞背景 2020年06月23日, 360CERT监测发现 Apache Dubbo 官方 发布了 Apache Dubbo 远程代码执行 的风险通告,该漏洞编号为 CVE-2020-1948,漏洞等级:高危。 Apache Dubbo 是一款高性能、轻量级的开源Java RPC框架,它提供了三大核心能力:面向接口的远程方法调用,智能容错和负载均衡,以及服务自动注册和发现。 Apache Dubbo Provider 存在 反序列化漏洞,攻击者可以通过RPC请求发送无法识别的服务名称或方法名称以及一些恶意参数有效载荷,当恶意参数被反序列化时,可以造成远程代码执行。 该漏洞的相关技术细节已公开。 对此,360CERT建议广大用户及时安装最新补丁,做好资产自查以及预防工作,以免遭受黑客攻击。 0x02 风险等级 360CERT对该漏洞的评定结果如下: 威胁等级:高危 影响面:广泛 0x03 漏洞详情 Apache Dubbo Provider 存在 反序列化漏洞,攻击者可以通过RPC请求发送无法识别的服务名称或方法名称以及一些恶意参数有效载荷,当恶意参数被反序列化时,可以造成远程代码执行。 0x04 影响版本 Dubbo 2.7.0 – 2.7.6 Dubbo 2.6.0

为我开发的API添加华丽的外衣

你说的曾经没有我的故事 提交于 2020-08-11 06:59:12
在日常开发中,最容易被吐槽的就是代码写的烂,没有注释鬼知道你这个是什么意思啊? 另一个就是文档不齐全,这些接口是干嘛的?参数是什么意思?等等问题。 归根到底还是没有严格的开发规范,最重要的还是要有方便的工具来帮助我们落地这些规范。 今天给大家推荐一个开源的 API 管理工具,如果还没有用上的感觉看看吧。 YAPI YApi 是高效、易用、功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。可以帮助开发者轻松创建、发布、维护 API,YApi 还为用户提供了优秀的交互体验,开发人员只需利用平台提供的接口数据写入工具以及简单的点击操作就可以实现接口的管理。 主页: http://yapi.demo.qunar.com/[1 ] GitHub: https://github.com/YMFE/yapi[2 ] 特性 基于 Json5 和 Mockjs 定义接口返回数据的结构和文档,效率提升多倍 扁平化权限设计,即保证了大型企业级项目的管理,又保证了易用性 类似 postman 的接口调试 自动化测试, 支持对 Response 断言 MockServer 除支持普通的随机 mock 外,还增加了 Mock 期望功能,根据设置的请求过滤规则,返回期 望数据 支持 postman, har, swagger 数据导入 免费开源,内网部署,信息再也不怕泄露了

.NET WEB API关键过程 思维导图

南楼画角 提交于 2020-08-11 04:19:25
背景说明 近期在去面试的过程中,被问及有关WEB API的一些特性,一时竟不知该如何回答,故根据自己已知的知识,加上网上搜索的,详细列举了一下,期望对WEB API有一个比较开阔和全面的认知。 关键要素 在客户端发送一个请求,到服务端接收并处理请求,然后将数据返回,这样一个看似简单的过程中,究竟有哪些要素是我需要去留心的呢? 我在整理的过程当中,发现了这样一些基本要素,是需要去特别留心: 1. 接口规范 2. 鉴权方式 3. 关键对象 4. 生命周期 5. 接口工具 接口规范 接口规范定义了在API访问的过程中,数据交互约定以什么样的方式进行。下面是我所了解的几种接口规范: 1.1.RESTful 1.1.1.字义解释 ▣ REST(representational state transfer),直译过来是“表述性状态传输”,至于ful,百度翻译是“满满的”、“充满...的”。这里所说的“state”,就是HTTP请求当中的 GET、PUT、POST 、DELETE,表述了对资源的处理意向。 1.1.2.规范详情 ▣ 参考 RESTful 架构详解 1.2.OpenAPI 1.2.1.字义解释 ▣ OpenAPI从字义上解释,是开放API,也就是说是开放给别人看的,所以接口参数具有可阅读性,能够生成可阅读的文档。它也具体到了业务层面的参数定义规范。 1.2.2.广义解释 ▣

一步步入门:NetCore WebApi (包含搭建Swagger)

本小妞迷上赌 提交于 2020-08-11 02:43:07
十年河东,十年河西,莫欺少年穷 学无止境,精益求精 首先,本篇教程为基础教程,大牛请翻过,小白值得一看 如下: 1、准备数据 create database StudentDB go use StudentDB go create table Student ( StudentId varchar ( 50 ) primary key , StudentSex nvarchar ( 2 ), StudentName nvarchar ( 50 ), StudentAge int , CreateDate datetime ) insert into Student values ( newid (), ' 女 ' , ' 王娜 ' , 18 , getdate ()) insert into Student values ( newid (), ' 女 ' , ' 李丽 ' , 19 , getdate ()) insert into Student values ( newid (), ' 女 ' , ' 阿卜杜拉 ' , 17 , getdate ()) insert into Student values ( newid (), ' 女 ' , ' 高骏花 ' , 20 , getdate ()) insert into Student values ( newid (),

Only first element of Enum list is displayed instead of Entire list in Swagger

孤者浪人 提交于 2020-08-10 23:15:48
问题 Below is the generated YAML from python execution requestBody: content: application/json: schema: properties: element_ids: items: type: string type: array element_type: items: enum: - NC - CELL type: string type: array expires_in: format: int32 type: integer group_id: type: string required: - element_ids - element_type - expires_in - group_id I have provided my enum values in the form of list. I see only NC in the swagger(3.0.0) shown below 回答1: Your spec is correct. "Example Value" displays

Only first element of Enum list is displayed instead of Entire list in Swagger

雨燕双飞 提交于 2020-08-10 23:13:12
问题 Below is the generated YAML from python execution requestBody: content: application/json: schema: properties: element_ids: items: type: string type: array element_type: items: enum: - NC - CELL type: string type: array expires_in: format: int32 type: integer group_id: type: string required: - element_ids - element_type - expires_in - group_id I have provided my enum values in the form of list. I see only NC in the swagger(3.0.0) shown below 回答1: Your spec is correct. "Example Value" displays

knife4j只用此插件的最简洁开发方式

跟風遠走 提交于 2020-08-10 22:27:44
一、POM添加 在pom文件里添加包 1 <!-- 引入knife4j以来 --> 2 < dependency > 3 < groupId > com.github.xiaoymin </ groupId > 4 < artifactId > knife4j-spring-boot-starter </ artifactId > < version > 1.9.6 </ version > 5 </ dependency > View Code 二、配置添加,相当于<bean>添加 1 package com.mrliu.undertow.conf; 2 3 import com.github.xiaoymin.knife4j.spring.annotations.EnableSwaggerBootstrapUi; 4 import org.springframework.context.annotation.Bean; 5 import org.springframework.context.annotation.Configuration; 6 import springfox.documentation.builders.ApiInfoBuilder; 7 import springfox.documentation.builders.PathSelectors; 8

404 error with swagger-ui and spring webflux

有些话、适合烂在心里 提交于 2020-08-10 22:09:26
问题 I am developping REST services with Spring Webflux and I want to produce documentation with Swagger2 for my API with. I discovered that Webflux is only supported with Swagger2 version 3.0.0 snapshot. Here's my configuration : java 11 maven 3 My SwaggerConfiguration bean looks like this import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders

尝鲜刚发布的 SpringFox 3.0.0,以前造的轮子可以不用了...

余生长醉 提交于 2020-08-10 21:56:02
最近 SpringFox 3.0.0 发布了,距离上一次大版本2.9.2足足有2年多时间了。可能看到这个名字,很多读者会有点陌生。但是,只要给大家看一下这两个依赖,你就知道了! <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>3.0.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>3.0.0</version> <scope>compile</scope> </dependency> 当我们在使用Spring MVC写接口的时候,为了生成API文档,为了方便整合Swagger,都是用这个SpringFox的这套封装。但是,自从2.9.2版本更新之后,就一直没有什么动静,也没有更上Spring Boot的大潮流,有一段时间还一直都是写个配置类来为项目添加文档配置的。为此,之前就造了这么个轮子: https://github.com/SpringForAll/spring-boot