Spring OAuth Authorization Server behind Spring Cloud Zuul Proxy

后端 未结 2 1774
伪装坚强ぢ
伪装坚强ぢ 2020-12-12 14:53

I am currently developing a application based on a micro service architecture. We use a API-Gateway implemented using Spring Cloud Netfix\'s Zuul Server to route the request

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 15:10

    As far as I understand your question, spring-cloud-security (for the EnableOauth2Sso part) and spring-cloud (for zuul), this is not possible to proxy the calls to the authorization server using zuul. The main reason being that spring-cloud-security secures the Gateway independently (and before accounting for) Zuul routing's logic.

    Which means that the (sample configuration from Dave Syer's OAuth2 example) spring.oauth2.client.* configuration

    spring:
      oauth2:
        client:
          accessTokenUri: http://localhost:9999/uaa/oauth/token
          userAuthorizationUri: http://localhost:9999/uaa/oauth/authorize
          clientId: acme
          clientSecret: acmesecret
    

    is considered before allowing any access to the Zuul's routes zuul.routes.*

    Moreover this setup enables the client agent to store two Cookies: one for the Gateway and one for the Authorization Server.

    I hope this helps.

提交回复
热议问题