forked from loafle/openapi-generator-original
update spring samples
This commit is contained in:
parent
ba63aa55a5
commit
8b44c9dff1
@ -22,24 +22,24 @@ import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
|
|||||||
@EnableConfigurationProperties
|
@EnableConfigurationProperties
|
||||||
public class ClientConfiguration {
|
public class ClientConfiguration {
|
||||||
|
|
||||||
@Value("${openAPIPetstore.security.apiKey.key:}")
|
@Value("${openapipetstore.security.apiKey.key:}")
|
||||||
private String apiKeyKey;
|
private String apiKeyKey;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty(name = "openAPIPetstore.security.apiKey.key")
|
@ConditionalOnProperty(name = "openapipetstore.security.apiKey.key")
|
||||||
public ApiKeyRequestInterceptor apiKeyRequestInterceptor() {
|
public ApiKeyRequestInterceptor apiKeyRequestInterceptor() {
|
||||||
return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey);
|
return new ApiKeyRequestInterceptor("header", "api_key", this.apiKeyKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty("openAPIPetstore.security.petstoreAuth.client-id")
|
@ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id")
|
||||||
public OAuth2FeignRequestInterceptor petstoreAuthRequestInterceptor() {
|
public OAuth2FeignRequestInterceptor petstoreAuthRequestInterceptor() {
|
||||||
return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), petstoreAuthResourceDetails());
|
return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), petstoreAuthResourceDetails());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnProperty("openAPIPetstore.security.petstoreAuth.client-id")
|
@ConditionalOnProperty("openapipetstore.security.petstoreAuth.client-id")
|
||||||
@ConfigurationProperties("openAPIPetstore.security.petstoreAuth")
|
@ConfigurationProperties("openapipetstore.security.petstoreAuth")
|
||||||
public ImplicitResourceDetails petstoreAuthResourceDetails() {
|
public ImplicitResourceDetails petstoreAuthResourceDetails() {
|
||||||
ImplicitResourceDetails details = new ImplicitResourceDetails();
|
ImplicitResourceDetails details = new ImplicitResourceDetails();
|
||||||
details.setUserAuthorizationUri("http://petstore.swagger.io/api/oauth/dialog");
|
details.setUserAuthorizationUri("http://petstore.swagger.io/api/oauth/dialog");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user