作为许多其他服务的网关的服务。提供发现,注册表,安全性,断路器,容错等功能。
如何更改 AbstractGatewayFilterFactory 中的响应正文 - Spring Cloud Api Gateway
我的目标是检查授权令牌的每个入站查询,如果检查失败,则将其重定向到另一个具有可理解描述的 URL(即 HTTP 401:“...中没有身份验证令牌”
我想将我的无服务器应用程序扩展到第二个 aws 区域,以便它在主动-主动模型中工作。 目前我有一个使用 WAF 保护的公共 api 网关。 我想添加一个云前端
面临错误 securityFilterChain 方法的参数 0 需要类型为“org.springframework.security”的 bean。找不到那个
我正在使用Spring Boot微服务(Spring Boot版本-3)。我正在使用oauth2。当我在安全配置文件上使用安全性时,我遇到错误。它在网关服务器上。 我的 Pom 文件是: 我正在使用 Spring Boot 微服务(Spring Boot 版本-3)。我正在使用oauth2。当我在安全配置文件上使用安全性时,我遇到错误。它在网关服务器上。 我的 Pom 文件是: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.1.1</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.tnpay</groupId> <artifactId>gateway-service</artifactId> <version>0.0.1-SNAPSHOT</version> <name>api-gateway</name> <description>api-gateway</description> <properties> <java.version>17</java.version> <spring-cloud.version>2022.0.4</spring-cloud.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> <version>3.1.0</version> </dependency> <!-- <dependency>--> <!-- <groupId>org.springframework.boot</groupId>--> <!-- <artifactId>spring-boot-starter-webflux</artifactId>--> <!-- </dependency>--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-gateway</artifactId> <version>4.0.3</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <version>4.0.0</version> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt-api</artifactId> <version>0.11.5</version> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt-impl</artifactId> <version>0.11.5</version> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt-jackson</artifactId> <version>0.11.5</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <version>3.1.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-oauth2-resource-server</artifactId> <version>3.1.1</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-resource-server</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-oauth2-resource-server</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-circuitbreaker-reactor-resilience4j</artifactId> <version>3.0.0</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <version>3.1.1</version> <scope>test</scope> </dependency> <dependency> <groupId>io.projectreactor</groupId> <artifactId>reactor-test</artifactId> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> 我的安全配置文件是: import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; import org.springframework.security.web.SecurityFilterChain; @Configuration public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http.oauth2ResourceServer( c -> c.jwt( j -> j.jwkSetUri("http://localhost:8080/oauth2/jwks") ) ); http.authorizeHttpRequests(auth -> { auth.requestMatchers("/user/auth").permitAll() .requestMatchers("/**").authenticated(); }); return http.build(); } } 我的错误是: 上下文初始化期间遇到异常 - 取消刷新尝试:org.springframework.beans.factory.UnsatisfiedDependencyException:创建类路径资源 [com/tnpay/gatewayservice/config/SecurityConfig.class] 中定义的名为“securityFilterChain”的 bean 时出错:表达了不满足的依赖关系通过方法“securityFilterChain”参数0:没有可用的“org.springframework.security.config.annotation.web.builders.HttpSecurity”类型的合格bean:预计至少有1个符合自动装配候选资格的bean。依赖注释:{} com.tnpay.gatewayservice.config.SecurityConfig 中的 securityFilterChain 方法的参数 0 需要一个类型为“org.springframework.security.config.annotation.web.builders.HttpSecurity”的 bean,但无法找到。 行动: 考虑在配置中定义“org.springframework.security.config.annotation.web.builders.HttpSecurity”类型的 bean。 我想解决这个问题。 在您的 @EnableWebSecurity 班级级别添加 SecurityConfig 注释,这是必需的,因为: @EnableWebSecurity是标记注释。它允许 Spring 找到(它是一个 @Configuration,因此是 @Component)并自动将该类应用到全局 WebSecurity。 你会得到这样的东西: @Configuration @EnableWebSecurity public class SecurityConfig {...}
Spring API Gateway:将入站请求重定向到不同的 URL
我的目标是检查授权令牌的每个入站查询,如果检查失败,则将其重定向到另一个具有可理解描述的 URL(即 HTTP 401:“...中没有身份验证令牌”
我应该在api网关级别还是在资源服务器(受保护的微服务)上进行授权(权限检查)?
存在具有单体架构的遗留应用程序,主要目标是使用微服务架构风格重构该应用程序。遗留应用程序具有复杂的安全模型,实际上我们...
我们有一个基于微服务架构的应用程序,具有以下组件 客户端应用程序:asp.net core mvc API网关:Ocelot 服务A:asp.net core web api 客户端发送
问题在于,由于我们必须在微服务之间使用内部授权,因此请求太多。 关于 Krakend 的信息很少,也没有艺术......
我已经部署了我的遗留应用程序,该应用程序几乎没有 HTTP Rest API,可以在 1 分钟(或更长时间)内响应。到目前为止,还没有办法改变这个 REST 应用程序的性能。 前面我有API
使用自定义身份微服务通过 Microsoft YARP 进行身份验证?
我无法理解如何使用外部身份服务来验证请求。 这是我的架构图: 客户端还可以通过
如何发送HTTP REQUEST到Spring Cloud API GATEWAY
当我在项目中手动向 URL 发出网关请求时,它会为我提供正确的数据,但是当我尝试使用前端发送 http 请求时,API 不起作用。这是为什么? JavaScri...
Spring Cloud API GATEWAY 路由不起作用
我使用 Spring Cloud Gateway 和微服务开发新项目。当我使用微服务自己的端口运行该方法时,该方法有效。但是当我用网关的端口调用它时,...
无法将 aws-amplify 与 NextJS 13.4 api 路由一起使用
我在之前版本的NextJS中成功使用pages/api路由连接到AWS API Gateway。我正在尝试使用新的应用路由器在 app/api/route 中做同样的事情。但是我无法得到...
我有两个微服务 ms1 和 ms2,每次使用 Apollo GraphQL 构建的 API 网关通过解析器发送请求时,它们都会输出不同类型的数据。 具体来说,第一个解析器 getC...
mtls 和 jwt 身份验证流程场景 NGINX 作为 API 网关?
我有一个场景,在身份验证流程的一侧需要 B2B(客户端)和 NGINX API 网关之间的 mTLS 身份验证,以从 API 端点访问资源(在 nginx api gat 后面......
Firebase 托管重写路径以使用 GCP API 网关作为 SPA 的后端
我正在尝试找到一种方法将后端(GCP API 网关)连接到我们在 firebase 上托管的 Angular 应用程序。 目标是将 myapp.com/api 上的请求路由到 API 网关。所有其他路线应该......
我想使用 Kong 作为 API 网关。我正在使用香港形象。 这是我的撰写文件: 服务: api_gateway: 容器名称:api_gateway 图片:香港 卷: - 。/:/应用程序 环境...
我想使用 FORMDATA 通过 api 网关将邮递员的图像放入我的 S3 存储桶中。 但是,每当我尝试在 s3 上打开图像时,它都会下载图像并且无法打开图像。 图片
使用 Spring Security 6 保护 Swagger 端点
我一直坚持使用新的 spring security 6 为我的网关微服务保护我的 swagger 端点,我已经检查了很多解决方案但没有一个有效,我打算保护以下...
Spring 云网关 ServerHttpResponseDecorator writeWith 在接收响应时不调用
我有一个 Spring Cloud Gateway 应用程序,我想实现一个过滤器,它在将响应主体传递给客户端之前读取响应主体。下面是自定义过滤器的代码: @成分 公开
在我的微服务项目中,我需要一个新层作为 API 网关来更改/添加/检查几乎所有从前端(客户端)到我的后端 API 的请求的一些数据。大多数情况下我会...