【发布时间】:2016-02-02 13:42:00
【问题描述】:
我有一个用 Spring boot 编写的 API,它使用 OAuth 来授权所有请求。
我正在使用 Spring OAuth2:
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
以及application.properties中的如下设置:
security.oauth2.client.client-id: xxxx
security.oauth2.client.client-secret: xxxx
security.oauth2.client.scope: read,write
我在各种不同的配置文件(“live”、“development”、“staging”等)中运行 API,我想在其中一些配置文件中禁用 OAuth。可以在不删除 maven 依赖项的情况下这样做(也许通过向 application-development.properties 添加一些东西?)。
到目前为止,我还没有找到任何直接的方法来做到这一点。我在应用程序启动期间以编程方式选择上下文,但这似乎不像 Spring 的方式。
【问题讨论】:
标签: java oauth oauth-2.0 spring-boot