JavaCodeNet
JavaCodeNet

Reputation: 1165

Authentication in spring cloud gateway

I am newbie to spring cloud. I am trying to integrate spring cloud gateway(spring cloud Finchley.SR1) just to authenticate and route my requests.

My Application stack is as follows

  cloud:
    gateway:
      routes:
        - id: customers
          uri: http://localhost:8282/customers
          predicates:
          - Path=/customers/**
          - Header=employeeId, \d+
          filters:
          - RewritePath=/customers/(?<segment>.*), /$\{segment}
        - id: rates
          uri: http://localhost:8383/rates
          predicates:
          - Path=/rates/**
          filters:
          - RewritePath=/rates/(?<segment>.*), /$\{segment}

Need to implement following

I am not able to figure out how to handle these authentications in spring cloud gateway app. Is it possible to leverage hazelcast session replication that I added in Main Dashboard App, use it validate the user in gateway?

Or is there any better approach using spring cloud suite tools that I can use it here. A sample app will be useful

Upvotes: 4

Views: 4775

Answers (1)

유영준
유영준

Reputation: 1

In my case, I customized AuthenticationWebFilter class in Spring Security 2.0.5. And I customized ServerAuthenticationConverter class and SuccessHandler, FailureHandler and ReactiveAuthenticationManager class in AuthenticationWebFilter. If you use Spring security, I recommend searching the WebFilter. I hope it helps.

Upvotes: 0

Related Questions