title: Best way to propagate credentials between micro services using spring-session
body: <p>We are using an architecture very similar to the one described in <a href="https://spring.io/guides/tutorials/spring-security-and-angular-js/#_the_api_gateway_pattern_angular_js_and_spring_security_part_iv" rel="noreferrer">this great guide on spring.io</a>. Our gateway handles authentication, and sessions are stored in Redis using spring-session. Endpoints of our micro services are secured and also use spring-session.</p>
  
  <p>In a micro service I need to call an endpoint of another micro service. I get the URL easily through the discovery client, but I need to provide credentials and I'm not sure of the best way to achieve that.</p>
  
  <p>I am thinking about getting the SESSION cookie from the HttpRequest, store it in some kind of thread local variables or request scope bean, and use it in the RestTemplate to call the second micro service. I need this request scoped bean because the RestTemplate will be used in the service layer, i.e. not in the MVC controller, and I don't want to pollute my service layer methods with this session identifier I get from the cookie.</p>
  
  <p>Is there a better way to approach this need? Is there already some support in Spring Cloud for this?</p>
  
  <p>Thanks a lot for your input</p>