These are chat archives for spring-cloud/spring-cloud

20th
Aug 2015
Dave Syer
@dsyer
Aug 20 2015 07:45
Maybe you are trying to use the client before the eureka cache is refreshed? It takes a couple of minutes with the default settings.
ccit-spence
@ccit-spence
Aug 20 2015 10:52
@dsyer How is the favicon handled with Zuul? Not sure if I have it setup wrong or maybe a cache issue. I have set the link within the UI service to a favicon within static and disabled the default favicon via properties. Is that all that needs to be done?
Dave Syer
@dsyer
Aug 20 2015 12:07
Isn't it the browser that chooses the favicon? I would expect you need it in the root home of the proxy.
Leandro Borges
@lpborges
Aug 20 2015 14:10

Hi, I'm configuring a spring-clould-netflix aplication that use Feign to access a service.
This service use basic authentication, and for now I'm using RequestMapping to send the authentication:

@FeignClient(url="${biro.service.url}")
public interface BiroProductsClient {

    @RequestMapping(method = RequestMethod.GET, value = "/item/{idProduct}", consumes = "application/json",
            headers="Authorization: Basic ${biro.service.auth}")
    public BiroProductDTO getProduct(@PathVariable("idProduct") long idProduct);
}

I'm curious if this is the best way to use authentication with FeignClient

Dave Syer
@dsyer
Aug 20 2015 14:19
I'm impressed it even works!
Good to know
I would probably make it an interceptor
I believe you can provide a @Beanof type HttpClient
It would be global I guess
So your approach is interesting
Leandro Borges
@lpborges
Aug 20 2015 14:22
I still will make some more tests, since I will use another @FeignClient with other authentication
Dave Syer
@dsyer
Aug 20 2015 14:22
If you use Ribbon you have more options
Since Ribbon configuration can be customized per client
It would be more configuration than you have, but cleaner for the interface defining the @FeignClient
BTW we might switch our declarative REST support to pure Ribbon at some point.
It shouldn't be a big change for users.
Leandro Borges
@lpborges
Aug 20 2015 14:25
But I don't found how to configure Basic Authentication with Ribbon, there's a property for that?
Dave Syer
@dsyer
Aug 20 2015 15:27
No but you can add interceptors to the client
Leandro Borges
@lpborges
Aug 20 2015 16:36
The headers attribute of RequestMapping don't apply properties values (${biro.service.auth}).
So I will try with Ribbon and Interceptors, the documentation can be found at Spring Cloud or Ribbon?
Dave Syer
@dsyer
Aug 20 2015 17:17
Spring Cloud kind of
You provide a custom ribbon config class
That bit is documented
Adding i
an interceptor you have to work out for yourself
Leandro Borges
@lpborges
Aug 20 2015 17:24
Ok, I'm trying to figure out. Thanks for the help.