a solicitud de micro servicio de @inter responde con el estado Prohibido en la aplicación Spring Cloud

Estoy investigando la arquitectura de microservicios. Elegí el Spring Cloud Framework.

Mi shema de aplicación se ve así:

También tengo el servidor de descubrimiento eureka pero decidí omitir la imagen para simplificarla.

Código fuente completo de ejemplo que puede encontrar en githib:https: //github.com/gredwhite/spring-clou

Explicación del problema:

hello servicio mundial:

@GetMapping("/helloWorld")
@HystrixCommand(fallbackMethod = "reliable")
public String hello() {
    return this.restTemplate.getForObject("http://hello-service/hello?name=World", String.class);
}

hello service:

@GetMapping("/hello")
public String hello(@RequestParam("name") String name) throws UnknownHostException, InterruptedException {           
     return "Hello " + name + "!";
 }

Cuando comencé lahello service e intente acceder alocalhost:8082/h/hello?name=Vasya (/h - ruta de contexto) - la solicitud se realiza correctamente y veoHello Vasya mensaje en la respuesta. @ Debo decir que la autenticación está deshabilitada para ese servicio.

hello world service tieneindex.html page y cuando intento acceder a él: el flujo de autenticación se realiza correctamente y, finalmente, esta aplicación inicia sesión correctamente. Entonces trato de ejecutar el método/hello desde elhello world service y veo la respuesta:

{"timestamp":"2018-05-17T08:53:04.623+0000","status":403,"error":"Forbidden","message":"Forbidden","path":"/hw/helloWorld"}
Configuración de Oauth2:

hello world service

@SpringBootApplication
@EnableEurekaClient
@RibbonClient(name = "say-hello")
@EnableAutoConfiguration
@EnableOAuth2Sso
public class HelloWorldStarter {

    public static void main(String[] args) {
        SpringApplication.run(HelloWorldStarter.class, args);
    }


    @RestController
    @EnableDiscoveryClient
    @EnableCircuitBreaker
    public static class HelloWorldController {
        @Autowired
        private RestTemplate restTemplate;
        @Autowired
        private DiscoveryClient discoveryClient;

        @GetMapping("/helloWorld")
        @HystrixCommand(fallbackMethod = "reliable")
        public String hello() {           
            return this.restTemplate.getForObject("http://hello-service/hello?name=World", String.class);
        }

        public String reliable() {
            return "Could not get response from service";
        }
    }

    @org.springframework.context.annotation.Configuration
    public static class Configuration {
        @Bean
        @LoadBalanced
        RestTemplate restTemplate() {
            return new RestTemplate();
        }
    }
}

application.yml:

spring:
  application:
    name: hello-world-service
server:
  port: 8081
  servlet:
    context-path: /hw
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka
  instance:
    preferIpAddress: true

security:
  oauth2:
    client:
      client-id: acme
      client-secret: acmesecret
      access-token-uri: http://localhost:8080/oauth/token
      user-authorization-uri: http://localhost:8080/oauth/authorize
    resource:
      user-info-uri: http://localhost:8080/me

logging:
  level:
    org.springframework.security: DEBUG
    org.springframework.web: DEBUG
Preguntas¿Como puedo solucionar este problemaDespués de la corrección del punto anterior, quiero saber cómo ejecutar una solicitud autorizada para ese servicio. En otras palabras, quiero habilitar la autorización oauth 2 en el servicio hello y tengo la posibilidad de hacer una solicitud desdehello world service

Respuestas a la pregunta(1)

Su respuesta a la pregunta