spring-cloud-gateway | Spring Cloud Gateway with Keycloak for Access | Microservice library

 by   kuldeepsingh99 Java Version: Current License: No License

kandi X-RAY | spring-cloud-gateway Summary

kandi X-RAY | spring-cloud-gateway Summary

spring-cloud-gateway is a Java library typically used in Architecture, Microservice, Prometheus, Grafana applications. spring-cloud-gateway has no bugs, it has no vulnerabilities and it has low support. However spring-cloud-gateway build file is not available. You can download it from GitHub.

Spring Cloud Gateway with Keycloak for Access and Identity Management and Resilience4j for fault tolerance and resiliency, Prometheus and grafana for monitoring, jaeger for distributed tracing on kubernetes
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              spring-cloud-gateway has a low active ecosystem.
              It has 6 star(s) with 4 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              spring-cloud-gateway has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of spring-cloud-gateway is current.

            kandi-Quality Quality

              spring-cloud-gateway has no bugs reported.

            kandi-Security Security

              spring-cloud-gateway has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              spring-cloud-gateway does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              spring-cloud-gateway releases are not available. You will need to build from source code and install.
              spring-cloud-gateway has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed spring-cloud-gateway and discovered the below as its top functions. This is intended to give you an instant insight into spring-cloud-gateway implemented functionality, and help decide if they suit your requirements.
            • The reactive resilience factory bean
            • Spring security filter chain
            • Registers the global authentication provider with the authentication manager
            • The key resolver for the remote address
            • Customizer for custom metrics
            • Default ms2 web client
            • Configures authorization requests
            • Gets home token
            • Get the session index
            • The main entry point
            • Main entry point
            • Create M3 web client
            • Custom metrics common tags
            • Main application
            Get all kandi verified functions for this library.

            spring-cloud-gateway Key Features

            No Key Features are available at this moment for spring-cloud-gateway.

            spring-cloud-gateway Examples and Code Snippets

            No Code Snippets are available at this moment for spring-cloud-gateway.

            Community Discussions

            QUESTION

            Spring Cloud Gateway Preflight Cors Error with Angular
            Asked 2021-May-21 at 08:20

            I'm trying to use spring cloud gateway with spring security and trying to call the rest API through angular but I'm getting following error

            ...

            ANSWER

            Answered 2021-Apr-26 at 16:08

            I solved it by moving Angular App behind the API gateway and added the following code in the API Gateway and Microservice

            In API Gateway

            Source https://stackoverflow.com/questions/67155972

            QUESTION

            Implementing Spring Cloud Gateway In The Same Project
            Asked 2021-Mar-22 at 08:17

            I provide an api for other microservices in my spring boot microservice and I want to put a spring-cloud-gateway in front of this microservice.

            I have reviewed the well-known spring document (https://spring.io/guides/gs/gateway/) but as far as I understand it requires me to launch the cloud gateway in a separate project. But I want to run the RouteLocator bean there in my microservice. Not in a separate project, but in the same project.

            When I use it in the same project, I get a warning like this

            "Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency."

            Later, as he said in the warning, I remove the spring-boot-starter-web dependency, even coming in other projects, excluding them from there like this

            ...

            ANSWER

            Answered 2021-Mar-22 at 08:17

            You can start gateway in the same project, but this is a webflux based project. From documentation

            Spring Cloud Gateway is built on Spring Boot 2.x, Spring WebFlux, and Project Reactor. As a consequence, many of the familiar synchronous libraries (Spring Data and Spring Security, for example) and patterns you know may not apply when you use Spring Cloud Gateway. If you are unfamiliar with these projects, we suggest you begin by reading their documentation to familiarize yourself with some of the new concepts before working with Spring Cloud Gateway.

            and

            Spring Cloud Gateway requires the Netty runtime provided by Spring Boot and Spring Webflux. It does not work in a traditional Servlet Container or when built as a WAR.

            so you should have used spring-boot-starter-webflux instead of spring-boot-starter-web.

            Alternatively, if you need to use traditional Spring MVC, consider using Spring Netflix Zuul. This project is currently in maintenance mode and Spring Gateway is the successor of it, but it should work.

            Source https://stackoverflow.com/questions/66708646

            QUESTION

            Authorization not working in Gateway with OAuth2 Client + Resource Server
            Asked 2021-Feb-24 at 21:12

            I am using the following dependencies in one application: Spring-Cloud-Gateway, Spring Boot OAuth2 Client, Spring Boot OAuth2 Resource Server.

            I use the following security config:

            ...

            ANSWER

            Answered 2021-Feb-24 at 21:12

            Turns out that I misunderstood some basic OAuth2 concepts. The Authorization itself is working correctly when I send a JWT in the Authorization header (Implicit Flow). What did not work is the case when I tried to access a resource via the browser. I got redirected to the login page of Keycloak (Authorization Code Flow). After you sign in through the login page of Keycloak you do not receive the JWT but a Keycloak Session ID. Spring Cloud Gateway cannot perform Authorization on the basis of a Keycloak Session ID (do not know how that would work if I wanted to use Authorization Code Flow but I am using Implicit flow, so I am fine for now).

            Source https://stackoverflow.com/questions/65859586

            QUESTION

            Spring Cloud API Gateway Custom Filters ClassCastException on Object to Config
            Asked 2021-Feb-23 at 05:33

            I am trying to implement a Custom Filter for the Authorization Header in my Spring Cloud API Gateway by following this resource spring-cloud-gateway-creating-custom-route-filters-abstractgatewayfilterfactory.

            Here's my setup.

            pom.xml

            ...

            ANSWER

            Answered 2021-Feb-23 at 05:33

            I think the problem is because you have 2 constructors, 1 is empty, 1 is autowired. Try to remove the empty constructor and move the super method inside the 2nd constructor like this.

            Source https://stackoverflow.com/questions/66299547

            QUESTION

            Why am I not getting authenticated by my Spring-Cloud Gateway / OAuth2-Client when I am sending my valid bearer-token in the authorization header?
            Asked 2021-Feb-01 at 08:27

            I am developing a microservice infrastrucutre, and began by implementing a Spring Cloud Gateway to proxy all my requests. I secured my Gateway with keycloak via the spring-boot-starter-oauth2-client Dependency. I use the TokenRelay Filter to append the Bearer to my proxied requests. I basically followed this Blog https://blog.jdriven.com/2019/11/spring-cloud-gateway-with-openid-connect-and-token-relay/

            ...

            ANSWER

            Answered 2021-Feb-01 at 08:27

            So for anyone having a similar problem. The problem was in the spring-boot-starter-oauth2-client dependency. This made my gateway stateful, by sending back a SESSION-Cookie instead of an Access-Token from the authorization server.

            Unfortunately i couldn't use the official Spring-Boot-Adapter, provided by Keycloak (https://www.keycloak.org/docs/latest/securing_apps/#_spring_boot_adapter) because this Adapter has some web dependencies, and as the spring-cloud-gateway is built on webflux, the web dependencies required by keycloak cannot be used in conjunction.

            My solution is, to not use the spring-cloud-gateway anymore, but the spring-cloud-starter-netflix-zuul gateway. This is built on web, and not on webflux, so i was able to use the official Spring-Boot-Adapter by keycloak with it.

            Source https://stackoverflow.com/questions/65904945

            QUESTION

            Why do i have to secure my Resource-Service if my Gateway is already secured?
            Asked 2021-Jan-27 at 08:20

            I'm reading the article on how to secure my Spring Cloud Gateway with the token relay pattern.

            https://spring.io/blog/2019/08/16/securing-services-with-spring-cloud-gateway

            See https://static.spring.io/blog/bwilcock/20190801/demo.png

            After a user requests a resource, the gateway redirects him to the login page of the identity provider to authenticate himself. On success, the identity provider redirects you back to the original requested resource (the gateway), including the access-token provided by the identity provider.

            So now the gateway is secured. Why does the resource-server has to validate the access-token again against the identity provider? Didn't the gateway just validate it? Or didn't it, and the gateway is just there to relay the access-token to the resource-server so he can validate it?

            ...

            ANSWER

            Answered 2021-Jan-27 at 08:20

            Basically never trust the JWT.

            Finally, the Resource Server needs to know where it can find the public keys to validate the authenticity of the access token which it has been given. The UAA provides an endpoint which both the Resource Server and the Gateway rely upon at runtime to do this check. The endpoint is configured in the application.yml for each application

            The resource server can never be 100% sure that the access-token was created by the Identity-Provider, or even came from the gateway. So at least, you should make sure that the access-token was signed by the Identity-Provider by using the public key, exposed by a configured endpoint.

            Source https://stackoverflow.com/questions/65779225

            QUESTION

            Multi Container Docker app - Connection Refused between containers
            Asked 2021-Jan-11 at 00:27

            So I've got a multi-container application with a front-end, back-end API all sat behind an API gateway. At the moment all apps work fine when booted independently through their respective commands (Java spring apps and an Angular front-end). However, when I start the apps through docker-compose up, none of the apps can communicate with each other (getting a connection refused).

            The Gateway is just a basic spring-cloud-gateway starter app which routes requests through to the correct application. This is configured with the following code:

            ...

            ANSWER

            Answered 2021-Jan-11 at 00:27

            Thanks to @DavidMaze for making me notice this.

            Seems like I was being a bit of a fool. My apps are sending network requests to localhost. This works fine when they are all running outside of a container. When in a container they need to be sending requests to the names of the other containers. For example:

            app_1 runs on port 8080 app_2 runs on port 5000

            When running outside of docker, app_1 could send a network request to app_2 via http://localhost:5000. This does not work inside of a container as nothing is running on localhost:5000 in that container. Instead, it will need to reference the other container eg: http://app_2:5000.

            Source https://stackoverflow.com/questions/65658289

            QUESTION

            Account for @RequestBody parameter when using spring-cloud-gateway
            Asked 2020-Nov-03 at 08:36

            I have the following Spring-Cloud-Gateway configuration and controller endpoint targeted by that configuration but my @RequestBody parameter is always null when the request reaches the endpoint. Could you please direct me as to how I should modify my Spring-Cloud-Gateway configuration, so that problem does not persist?

            ...

            ANSWER

            Answered 2020-Nov-03 at 08:36

            The problem had nothing to do with the spring-cloud-gateway configuration. On Insomnia I had to specify

            Source https://stackoverflow.com/questions/64649224

            QUESTION

            Is it possible to configure Spring Cloud Gateway with a Rewrite rule for Vue Router's history mode?
            Asked 2020-Sep-11 at 09:38

            I am using Spring Cloud Gateway as an API-Gateway and also as a webserver hosting the static files (html/js/css) of an Vue.js SPA.

            Preclaimer: I'm not able to change this (bad) architecture due to organisational constraints.

            Currently, I'm using the default Vue Router hash mode, meaning client-side routing of the Vue app is accomplished via an URL hash like

            ...

            ANSWER

            Answered 2020-Aug-07 at 11:08

            You could fix it from the Spring Boot side. I mean, you could:

            1. Enable the Vue Router history mode like explained in the documentation here
            2. Build a Spring Boot forwarding controller like this:

            Source https://stackoverflow.com/questions/63299258

            QUESTION

            Spring Gateway AsyncPredicate not working with reactor and flux
            Asked 2020-Jul-29 at 10:34

            We have written a custom Predicate factory for the Spring-Gateway to route the requests. We are parsing the body of an XML request and then the route is being derived, based on particular Method existing in the Body. While doing this we have written the following code to create the ServerRquest.

            ...

            ANSWER

            Answered 2020-Jul-29 at 10:34

            The problem was, the greenwich version of those apis was beta. Now the object expected in CACHED_REQUEST_BODY_ATTR is required to be a PooledDataBuffer. So I changed my code accordinly now. Which looks like as following now:

            Source https://stackoverflow.com/questions/63114188

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install spring-cloud-gateway

            You can download it from GitHub.
            You can use spring-cloud-gateway like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the spring-cloud-gateway component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/kuldeepsingh99/spring-cloud-gateway.git

          • CLI

            gh repo clone kuldeepsingh99/spring-cloud-gateway

          • sshUrl

            git@github.com:kuldeepsingh99/spring-cloud-gateway.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link