Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
ProductCatalogApp-New
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Anant Kumar
ProductCatalogApp-New
Commits
c9522f6d
Commit
c9522f6d
authored
Nov 13, 2019
by
ankumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
second commit
parent
ac1ff236
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
14 deletions
+2
-14
build.gradle
catalog-service/build.gradle
+0
-1
HelloResource.java
...main/java/com/authorization/controller/HelloResource.java
+2
-13
No files found.
catalog-service/build.gradle
View file @
c9522f6d
...
...
@@ -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
{
...
...
catalog-service/src/main/java/com/authorization/controller/HelloResource.java
View file @
c9522f6d
...
...
@@ -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
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment