spring-cloud-feign

Feign and Spring Security 5 - Client Credentials

百般思念 提交于 2021-02-12 09:20:08
问题 I am trying to invoke some backend system which is secured by a client_credentials grant type from a Feign client application. The access token from the backend system can be retrieved with the following curl structure (just as an example): curl --location --request POST '[SERVER URL]/oauth/grant' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --header 'Cookie: WebSessionID=172.22.72.1.1558614080219404; b8d49fdc74b7190aacd4ac9b22e85db8=2f0e4c4dbf6d4269fd3349f61c151223' \ -

Feign and Spring Security 5 - Client Credentials

假如想象 提交于 2021-02-12 09:12:50
问题 I am trying to invoke some backend system which is secured by a client_credentials grant type from a Feign client application. The access token from the backend system can be retrieved with the following curl structure (just as an example): curl --location --request POST '[SERVER URL]/oauth/grant' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --header 'Cookie: WebSessionID=172.22.72.1.1558614080219404; b8d49fdc74b7190aacd4ac9b22e85db8=2f0e4c4dbf6d4269fd3349f61c151223' \ -

How to manage Feign errors?

徘徊边缘 提交于 2021-02-07 18:18:21
问题 We are using Spring-boot with Spring-cloud and Spring-cloud-netflix with Spring-cloud-feign . We are creating our Gateway application that with the help of Feign will try to communicate with our authentication microservice in order to validate their credentials. Here you can see an example of our Feign authentication client: @FeignClient(value="auth", configuration = AuthClientConfiguration.class) public interface AuthClient { @RequestMapping(method = RequestMethod.GET, value = "/tokens",

How to use p12 client certificate with spring feign client

匆匆过客 提交于 2021-02-07 17:03:19
问题 I have a Spring Boot application that calls a remote service. This remote web service provided me a p12 file that should authenticate my application. How do I configure my feign client to use the p12 certificate ? I've tried settings these properties: -Djavax.net.ssl.keyStore=path_to_cert.p12 -Djavax.net.ssl.keyStorePassword=xxx -Djavax.net.ssl.keyStoreType=PKCS12 But it doesn't change anything, I still get this error: sun.security.provider.certpath.SunCertPathBuilderException: unable to find

How to create pointcut to feign client that supports interface inheritance?

天大地大妈咪最大 提交于 2021-01-29 15:54:02
问题 In a Spring Boot project I have a simple feign client @MyAnnotation @FeignClient(name="some-name", url="http://test.url") public interface MyClient { @RequestMapping(method = RequestMethod.GET, value = "/endpoint") List<Store> getSomething(); } I need to intercept all calls and for this and I'm creating a common library that can be used in different projects. To achieve it I try to use Spring AOP. I created an aspect that wraps all public methods of the object annotated with MyAnnotation

Feign Client fails to compile, it treats BindingResult as a second Body parameter

走远了吗. 提交于 2021-01-28 19:33:30
问题 I'm learning to use Spring's Feign Client, so I've built two simple projects (serviceA and serviceB) to test it out. I have the following code: serviceA rest interface: @RequestMapping("/users") public interface UserRest { @PostMapping public ResponseEntity<User> createUser(@Valid @RequestBody User user, BindingResult br); } serviceA rest interface implementation: @RestController public class UserController implements UserRest { @Override @PostMapping public ResponseEntity<User> createUser(

Spring cloud Feign OAuth2 request interceptor is not working

一曲冷凌霜 提交于 2021-01-27 14:52:10
问题 I am trying to create a simple REST client using spring cloud feign to consume a service which is secured with OAuth2 security tokens. I am using OAuth2FeignRequestInterceptor for adding the bearer token, check my below code. I am facing 401. and when try to debug my code I don't find the bearer token in my Request object. @Configuration @EnableConfigurationProperties(value=OAuth2ClientCredentialsProperties.class) @EnableOAuth2Client @Profile(OAuth2Profiles.CLIENT_CREDENTIALS) public class

Feign recognized GET method as POST

家住魔仙堡 提交于 2021-01-05 04:47:15
问题 I have a service defined as follow class Echo { private String message; // getters and setters omitted } @RequestMapping("/app") interface Resource { @RequestMapping(method = GET) Echo echo(@ModelAttribute Echo msg); } @RestController class ResourceImpl implements Resource { @Override Echo echo(Echo msg) { return msg; } } and his client on a different application @FeignClient(name = "app", url = "http://localhost:8080") interface Client extends Resource {} However, when I call resource method

Feign recognized GET method as POST

旧巷老猫 提交于 2021-01-05 04:45:48
问题 I have a service defined as follow class Echo { private String message; // getters and setters omitted } @RequestMapping("/app") interface Resource { @RequestMapping(method = GET) Echo echo(@ModelAttribute Echo msg); } @RestController class ResourceImpl implements Resource { @Override Echo echo(Echo msg) { return msg; } } and his client on a different application @FeignClient(name = "app", url = "http://localhost:8080") interface Client extends Resource {} However, when I call resource method

Feign recognized GET method as POST

为君一笑 提交于 2021-01-05 04:45:09
问题 I have a service defined as follow class Echo { private String message; // getters and setters omitted } @RequestMapping("/app") interface Resource { @RequestMapping(method = GET) Echo echo(@ModelAttribute Echo msg); } @RestController class ResourceImpl implements Resource { @Override Echo echo(Echo msg) { return msg; } } and his client on a different application @FeignClient(name = "app", url = "http://localhost:8080") interface Client extends Resource {} However, when I call resource method