spring-webflux

How REST endpoints are auto subscribed while calling from Browser/REST Client?

限于喜欢 提交于 2020-05-23 09:21:40
问题 In ProjectReactor or Reactive Streams, Nothing Happens Until You subscribe(). Reactive streams data flow will not happen unless until someone subscribe to it, but I see for all REST APIs like finds, save and inserts are not calling subscribe explicitly but data is flowing between producer and subscribers. @RestController class PersonController { private final PersonRepository repository; public PersonController(PersonRepository repository) { this.repository = repository; } @GetMapping("/all")

How to configure netty connection-timeout for Spring WebFlux

流过昼夜 提交于 2020-05-15 05:45:10
问题 I am running spring cloud gateway (which I understand to be built on Spring Webflux) behind an AWS loadbalancer and I am receiving intermittent 502 errors. Upon investigation, it appears the issue has to do with connection timeouts between the loadbalancer and my nodes. From some investigation it appears that the underlying netty server has a default timeout of 10 seconds. I determined this using the following command... time nc -vv 10.10.xx.xxx 5100 Connection to 10.10.xx.xxx 5100 port [tcp/

Is Spring Boot WebClient OAuth2 client_credentials supported?

≯℡__Kan透↙ 提交于 2020-05-14 12:06:59
问题 I'm trying to create a Spring Boot REST application that has to make a remote REST call to another Spring Boot application protected by OAuth2 (with grant type client_credentials). The first application is using the Reactive WebClient to make the call to the second OAuth2 REST application. I've configured the the WebClient with grant_type "client_credentials" (see code below) public WebClient messageWebClient( ClientRegistrationRepository clientRegistrations, OAuth2AuthorizedClientRepository

How can I detect a disconnected client with Spring 5 Reactive WebSocket

此生再无相见时 提交于 2020-05-13 11:48:52
问题 I managed to create a WebSocketHandler using the Spring 5 Reactive WebSocket support (Chapter 23.2.4). Receiving and sending all works fine. However, I can not figure out how to detect a client disconnect. When debugging a client disconnect it somewhere stops at the server side in the HttpServerWSOperations class ( netty.http.server package), where it does detect a CloseWebSocketFrame . Any suggestions how to deal with client disconnects? 回答1: I implemented a close event handler in a reactive

How can I detect a disconnected client with Spring 5 Reactive WebSocket

别说谁变了你拦得住时间么 提交于 2020-05-13 11:48:09
问题 I managed to create a WebSocketHandler using the Spring 5 Reactive WebSocket support (Chapter 23.2.4). Receiving and sending all works fine. However, I can not figure out how to detect a client disconnect. When debugging a client disconnect it somewhere stops at the server side in the HttpServerWSOperations class ( netty.http.server package), where it does detect a CloseWebSocketFrame . Any suggestions how to deal with client disconnects? 回答1: I implemented a close event handler in a reactive

Spring security oauth2 fails issuer validation after 30 seconds

£可爱£侵袭症+ 提交于 2020-05-13 11:48:05
问题 In a reactive spring webflux service, I have the endpoints configured to be protected by OAuth2 resource server. When I first launch the server, it validates the Bearer tokens properly but after about 30 seconds, the exact same requests begin failing with the following error: error="invalid_token" error_description="This iss claim is not equal to the configured issuer" error_uri="https://tools.ietf.org/html/rfc6750#section-3.1" I've verified that the token is valid and that the iss claim

Spring security oauth2 fails issuer validation after 30 seconds

限于喜欢 提交于 2020-05-13 11:48:04
问题 In a reactive spring webflux service, I have the endpoints configured to be protected by OAuth2 resource server. When I first launch the server, it validates the Bearer tokens properly but after about 30 seconds, the exact same requests begin failing with the following error: error="invalid_token" error_description="This iss claim is not equal to the configured issuer" error_uri="https://tools.ietf.org/html/rfc6750#section-3.1" I've verified that the token is valid and that the iss claim

Can I use SpringMvc and webflux together?

天大地大妈咪最大 提交于 2020-05-09 19:38:43
问题 I would like to use 2 approaches(reactive and standard) in one project. I tried to migrate one REST API endpoint to reactive webflux and test performance before migrate rest of them. But it didn't work. I added router and handler for him, but until I didn't remove spring-boot-starter-web from dependencies and disable @RestController I got http 404 code all the time. Is it possible or not? Or should I migrate all project to reactive approach? 回答1: As explained in the Spring Boot reference

How to make API Gateway Stateless for Authentication/Authorization Process Using Oauth2?

僤鯓⒐⒋嵵緔 提交于 2020-04-30 05:48:07
问题 In my design I have an API gateway (spring cloud api gateway), authorization server (Oauth2) and a resource server (microservice). (I have also a CAS server but now it can be ignored for simplicity) I just want to use API gateway to redirect client requests. If the user is not authenticated, request should be sent to authorization server and after authentication and authorization process is finished, authorization server should return JSESSION and JWT in access_token header. After that API

How to make API Gateway Stateless for Authentication/Authorization Process Using Oauth2?

北城以北 提交于 2020-04-30 05:48:05
问题 In my design I have an API gateway (spring cloud api gateway), authorization server (Oauth2) and a resource server (microservice). (I have also a CAS server but now it can be ignored for simplicity) I just want to use API gateway to redirect client requests. If the user is not authenticated, request should be sent to authorization server and after authentication and authorization process is finished, authorization server should return JSESSION and JWT in access_token header. After that API