【问题标题】:Use oauth2 authentication for the main app and basic auth for the management endpoints in spring boot?在 Spring Boot 中对主应用程序使用 oauth2 身份验证,对管理端点使用基本身份验证?
【发布时间】:2015-02-13 01:57:51
【问题描述】:
我正在使用 Spring Boot 构建一个 REST Api,我可以使用 Oauth2(使用 spring-security-oauth2)来保护它。
我想为执行器管理端点(指标、运行状况等)管理单独的身份验证和授权架构。
我希望管理端点在不同的端口上运行(application.properties 中的 management.port=8081)
我已经阅读了很多,但找不到方法。
谢谢
【问题讨论】:
标签:
spring-security
spring-boot
spring-security-oauth2
【解决方案1】:
那是因为您不能按端口分隔端点。如果执行器管理端点和管理端点在同一个组件上,则 Spring Boot 容器 (Tomcat) 将在一个端口上启动整个组件。
您所说的也许可以通过代理来实现。您将在代理上映射一些 url 以在内部与组件上的 url 对应。