How to use the Spring Cloud Gateway Filter for Authentication | Microservices 3

How to use the Spring Cloud Gateway Filter for Authentication | Microservices 3

The Dev World - by Sergio Lema

3 года назад

34,127 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@arnaudpoutieu1331
@arnaudpoutieu1331 - 04.04.2021 12:26

Thanks for the sharing Sergio. This content, as usually done on your channel, is more that valuable for anyone who has wished to learn programming in a professional manner

Ответить
@sargon7562
@sargon7562 - 02.11.2023 11:12

Cool! Thank you so much!❤
Do i have plans to have some examples for webflux + security+ gradle?

Ответить
@user-vn9fq9lv4g
@user-vn9fq9lv4g - 25.04.2023 01:31

Why did you pass the user ID at the request (when you were adding a new header in the Gateway filter)? Like, for what reason you are going to use this user ID?

Ответить
@Canarticho
@Canarticho - 06.04.2023 14:49

Re bonjour, j'ai également implémenté cette solution, toutefois, j'ai l'impression que mon filtre ne s'applique pas. J'utilise un service pour l'authentification , un gateway et un autre service sur lequel je souhaite appliquer le filtre. Ce dernier est censé me renvoyer un simple message cependant sans même préciser de header je reçois un message

Ответить
@drbulltrader9107
@drbulltrader9107 - 27.03.2023 19:25

Olá Sérgio, somente uma questão. E se caso do Gateway colocasses no yml o código abaixo, já seria compatível com o spring-boot-starter-web ?

spring:
main:
web-application-type: reactive

Ответить
@jhonatansalles
@jhonatansalles - 12.01.2023 13:54

Hello, congratulations for the video.
I would like some help in configuring the "routes" of the gateway, how do I create a personalized redirect. Like, I have 3 instances of the same "lb://service-books" but according to some header, url parameter something like that, the requests always fall in the same instance among the 3.

Ответить
@ivanrodriguezc
@ivanrodriguezc - 11.01.2023 04:34

Thank you! It was useful

Ответить
@rydmerlin
@rydmerlin - 02.01.2023 03:24

Why did you use constructor injection here and not requiredargsconstructor like in previous videos?

Ответить
@rydmerlin
@rydmerlin - 02.01.2023 03:17

Wondering how long it took for you to spot the typo on the prices predicate.

Ответить
@marypaul9627
@marypaul9627 - 22.12.2022 13:36

Hi Sergio,wonderful as usual tutorials but pls help me how do i implement login for this with react js front end?which api do i call to log my user in pls?am stuck on that

Ответить
@muzaffarrasulov7492
@muzaffarrasulov7492 - 02.12.2022 14:03

Thanks! but why didn't you handle the exception properly? for example, I always get an exception with code 405 or the like with the message {"timestamp":"","path":"","status":405,"error":"Method Not Allowed","requestId": ""}, but I don't know why...

Ответить
@rapasebastian5678
@rapasebastian5678 - 27.11.2022 11:55

Great content thank you!

Ответить
@AmirulIslam-oc7eq
@AmirulIslam-oc7eq - 08.11.2022 13:21

What about session based Authentication? Can we get session based Authentication object from the cookie in request header ? Previously in Zuul gateway we are using via SecurityContextHolder but in Spring cloud gateway its not working

Ответить
@victoralvarez474
@victoralvarez474 - 12.08.2022 19:55

Hi this does not work on my local machine

Ответить
@ximinpi686
@ximinpi686 - 29.07.2022 11:07

hi .. i have a question ...
where we should configure (& how) JWT configurations ... ideally i think in API Gateway only ..
but it does not include any code other than navigating to microservice ..
so how to handle cors issues

Ответить
@thirdpartyintegrationtest9117
@thirdpartyintegrationtest9117 - 07.07.2022 21:07

Help Required!!!! Can you tell How to read the body -> exchange.getRequest().getBody(), as it returns Flux<DataBuffer> .. Thanks in advance :-)

Ответить
@yogeshbombepim
@yogeshbombepim - 01.06.2022 15:23

I'm using spring version - 2.7.0 & cloud version - 2021.0.3 . Filter apply method code is not executed.

Ответить
@mars3142
@mars3142 - 14.05.2022 22:45

I like this tutorial for JWT filters in the gateway, but how can I send the 401 (not authorized) error to the client? My gateway will received an 401, but send a 500 to the client :(

Ответить
@chilchoful
@chilchoful - 28.02.2022 22:49

Sirvió de mucho. Bien!

Ответить
@04Anjan
@04Anjan - 26.02.2022 09:24

Hi Sergio,
If I remove spring web dependency my CORS configuration will get disturbed, I will be unable to use WebMVCConfigurer to configure the CORS. What is the alternative for WebMVCConfigurer or can we configure the CORS in application.yml using spring cloud gateway filters.

Ответить
@karthikraja5089
@karthikraja5089 - 11.01.2022 18:05

Hi Sergio,
Thanks for the tutorial!!
I have a question, can we filter the requests based on roles in JWT ? If yes where we can have that filter logic(in each microservice or in gateway service itself)?
Thanks in advance!!

Ответить
@libertyhmong6431
@libertyhmong6431 - 04.01.2022 20:12

Hello, thanks for the tutorial!!! I have a question, with this method, it seems that every request passing throught the API gateway filter call the validatetoken endpoint, is there any method to relay the token to all our microservice? Thanks in advance

Ответить
@zaobenhar9702
@zaobenhar9702 - 27.12.2021 01:25

I support you bro keep going good work!

Ответить
@uttarakhand_today
@uttarakhand_today - 16.12.2021 13:20

Hi..Is there a way to use token relay functionality of spring cloud gateway with password grant?

Ответить
@diegoacosta7079
@diegoacosta7079 - 08.11.2021 07:51

First, thank you very much for the sequence of videos. It is an excellent learning. Once I implement the AuthFilter and make a request with the correct token, it gives me a 200 response, but the empty content, maybe any ideas?

Ответить
@francocastro2185
@francocastro2185 - 15.09.2021 23:16

Que buena explicación, es justo lo que estaba buscando.

Ответить
@RonTheFlyingDutchman
@RonTheFlyingDutchman - 07.08.2021 12:55

Finally someone who explains how to apply a GatewayFilter in yaml configuration. Thanks!

Ответить
@cleenu
@cleenu - 24.07.2021 00:52

Why did you remove web dependency after adding gateway dependency in pom.xml?

Ответить
@dsdeg1
@dsdeg1 - 16.07.2021 17:30

una consulta espero que me contesten. Estoy trabajando con eureka y cloud gateway .. el problema que tengo es que para producción en que servidor se puede publicar gateway.. intente con jboss y wlidfly y no funcionan..

Ответить
@dermimalika2260
@dermimalika2260 - 13.07.2021 03:05

please how can we make the register not signIn?
I really need it can you share it if you have an example

Ответить
@duytranthe6495
@duytranthe6495 - 22.06.2021 07:42

can spring cloud gateway authorized users? It's so hard to archive it

Ответить
@alxx736
@alxx736 - 22.06.2021 05:53

Deberiamos segurizar los servicios internos que se comunican entre ellos? O no tiene mucho sentido?

Ответить
@RajA-hb1go
@RajA-hb1go - 17.06.2021 17:22

Thank you for the useful video, here you have added the authentication details as the query parameters, how we can add as a form parameters, please help

Ответить
@DavidSoles
@DavidSoles - 04.06.2021 19:53

Muy buena explicación. Gracias. Aunque me pregunto ¿de que manera los microservicios internos tendrían acceso a la información de la persona autenticada (Principal)? la información contenida en el JWT para verificar roles, etc...

Ответить
@jeycode9180
@jeycode9180 - 30.05.2021 00:17

Eres brutal. Qué opinas de Vaadin?

Ответить
@devashish_yt
@devashish_yt - 21.05.2021 22:08

To the point tutorial. Thanks a lot

Ответить
@lannisnguyen
@lannisnguyen - 21.04.2021 08:07

For the load balancer, what if we use the new Spring Cloud LoadBalancer which is considered to be more abstractions?

Ответить
@endlessdim6150
@endlessdim6150 - 19.03.2021 01:09

Hello Man. I dont understand that flow with checking JWT in a gateway service.
Ok, u validate it. And then pass string (which u call id). Eventually u have just user id ... no claims, no information about roles etc. U can for header, but parse it on filter of service (for example book service and he will delegate it to ur JWT validate service and in response get all information about user - his claims)
Schema( gateway (filtering if header is exist) -> book service (delegate in his filter to outer service JWT parsin and get claims) and then u add it to SpringSecurityContext) thats all.
Am i missing something?

Ответить
@calamaroweb
@calamaroweb - 27.01.2021 17:49

Excelente explicación. Yo estoy migrando los microservicios de un proyecto de Spring Boot a Quarkus para aprovechar mejor GraalVM y el ahorro de memoria ram ya que con SpringBoot aún no está muy "púlida" la integración con GraalVM. Pero el api gateway pienso mantenerlo con Spring Cloud/Eureka. Me subscribo al canal esperando más videos como éstos.

Ответить
@maeskii
@maeskii - 25.01.2021 11:21

No entendí nada

Ответить