Commit c9522f6d authored by ankumar's avatar ankumar

second commit

parent ac1ff236
......@@ -56,7 +56,6 @@ dependencies {
testImplementation 'org.springframework.security:spring-security-test'
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.2'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'
}
dependencyManagement {
......
......@@ -27,9 +27,9 @@ public class HelloResource {
@Autowired
private JwtUtil jwtTokenUtil;
@RequestMapping(value = {"/hello"},method = RequestMethod.GET)
@RequestMapping(value = {"/authorized"},method = RequestMethod.GET)
public String hello() {
return "Hello World";
return "Anant!!!!!!!!! You Are Authorized Person ";
}
@RequestMapping(value = "/authenticate", method = RequestMethod.POST)
......@@ -45,15 +45,4 @@ public class HelloResource {
final String jwt = jwtTokenUtil.generateToken(userDetails);
return ResponseEntity.ok(new AuthenticationResponse(jwt));
}
@RequestMapping(value = "/userId", method = RequestMethod.GET)
public List<CatalogItem> getCatalog(@PathVariable("userId") String userId) {
/*WebClient.Builder builder = WebClient.builder();*/
UserRating ratings = restTemplate.getForObject("http://product-rating-service/ratingsdata/users/" + userId, UserRating.class);
return ratings.getUserRating().stream().map(rating -> {
Product product = restTemplate.getForObject("http://product-info-service/product/" + rating.getProductId(), Product.class);
return new CatalogItem(product.getName(), product.getDesc(), rating.getRating());
})
.collect(Collectors.toList());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment